NI JSON number-of-digits bug
The NI primitive has a big in the number of digits used in flattening floats: * EXT flattened to only 8 digits * SGL flattened to an excessive 18 digits
NI might not consider the SGL thing a bug, as the emphasise JSON as a machine-to-machine format of IEEE numbers, and are interested in being sure that they get bit-for-bit recovery. But 18 digits is excessive I think, and makes for very large files. DBLs are flattened by NI to 20 digits, higher than our preferred 15 digits, but this is a smaller difference.
Comments (5)
-
reporter -
reporter %.7g is problematic because it has fewer significant figures for some numbers.
%_7g is what I would prefer for human readability, but %.7e (engineering notation always) is fine for long data files. So I am considering using %#_7g for short SGL arrays (which humans might want to read) and %.7e for long ones.
-
reporter Problem with using Spreadsheet function is that it uses Inf and -Inf rather than the Infinity and -Infinity of the NI JSON function. But using "Format into String" in a loop allows us to swap these, while still having performance of 820 ns, slightly faster than NI JSON.
-
reporter Did SGLs and DBLs the new way.
-
reporter - changed status to resolved
- Log in to comment
Speed experiments suggest the following for flattening an array of 10,000 SGLs: