J code writes csv (tables / csv: writecsv), losing significant digits (not always using typewritten notation)

   load 'tables/csv'
   a=. 2 4 $ 1.2345e_10
   makecsv a
1.2345e-10,1.2345e-10,1.2345e-10,1.2345e-10
1.2345e-10,1.2345e-10,1.2345e-10,1.2345e-10

   b=. 2 4 $ 1.2345e_8
   makecsv b
0.000000012,0.000000012,0.000000012,0.000000012
0.000000012,0.000000012,0.000000012,0.000000012

The csv package uses the J: internal format function 8!:0. According to the J dictionary ,

exponential notation is used for nonzero numbers with a value less than 1_9 or more than 29

Otherwise, there can be a maximum of 9 digits after the decimal point.

 (8!:0) 1.2345e_10
+----------+
|1.2345e-10|
+----------+

(8!:0) 1.2345e_8
+-----------+
|0.000000012|
+-----------+

The question is how to save significant numbers in the case 1.2345e-8?

+4
source share

All Articles