Useful numeric algorithms for floats that cover some deficiencies in the math module. More interesting is digits/1, which implements the algorithm from: http://www.cs.indiana.edu/~burger/fp/index.html See also "Printing Floating-Point Numbers Quickly and Accurately" in Proceedings of the SIGPLAN '96 Conference on Programming Language Design and Implementation.
Returns a string that accurately represents the given integer or float using a conservative amount of digits. Great for generating human-readable output, or compact ASCII serializations for floats.
Returns a string that accurately represents the given integer or float using a conservative amount of digits. Great for generating human-readable output, or compact ASCII serializations for floats.