Closed semireg closed 1 year ago
I think I'd have to call that a bug. numbers-parser
should be presenting the data as formatted by Numbers at the very least when using --formatting
on the command-line. By default it uses built-in types and Numbers uses floats for that (well decimal128 to be specific).
I'll need to see what the difference is in formatting between something stored as 1.000
and 1
.
I've made updates that enable cat-numbers --formatting
to extract the format for decimals. Compare:
% cat-numbers -b tests/data/issue-44.numbers
1.0,1.0
0.0,0.0
-2.0,-2.0
-100.0,-100.0
-100.0,-100.0
-100.1234,-100.1234
-100.1234,-100.1234
True,False
10000.0,10000.0
1000.125,1000.1234559999999
% cat-numbers -b --formatting tests/data/issue-44.numbers
1,1.0000
0,0.0000
-2,-2.00000
-100,100
(100),(100)
-100.1234,100.1234
(100.1234),(100.1234)
TRUE,FALSE
10000,"10,000"
1000.125,1000.12
If a document has cells: 1, 2, 3 with Data Format as Number, what is the best way to extract the values as strings, vs. getting cast to "1.0", "2.0", and "3.0"?
I looked at the cat_numbers source and formatted_value, but I'm still getting "3.0" regardless if I change the Number formatting to something like 7 decimal places. If I change the Data Format to "text" it works as I'd expect.