package dtoa
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Converts OCaml floats into strings (doubles to ascii, "d to a"), using the efficient Grisu3 algorithm.
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.3.0.tar.gz
sha256=ddfb10cad93b80e3a4c4a384351974d46c92464246ea27d4b87280760dbe7174
md5=b974e5ef17b357b0e8fe24c1fcc472c5
doc/README.html
ocaml-dtoa
This library provides a function that converts OCaml floats into strings, using the efficient Grisu3 algorithm.
The Grisu3 algorithm is described in "Printing Floating-Point Numbers Quickly And Accurately with Integers" by Florian Loitsch.
The implementation is adapted from double-conversion.
Current Status
Currently, this library exposes three functions:
ecma_string_of_float : float -> string: formats the float according to the ECMAScript specification's implementation of Number.prototype.toString. Notably, the output of this function is valid JSON.shortest_string_of_float : float -> string: formats the float as compactly as possible, for example returning123e6instead of123000000or1.23e+08.g_fmt : float -> string: formats the float in the same way as David M. Gay'sg_fmt.
The underlying fast_dtoa() function computes the significand and exponent, which are formatted by the above functions in dtoa_stubs.c. It is a port of the double-conversion library from C++ to C.
Many features of double-conversion are still missing. Patches are welcome!
License
ocaml-dtoa is MIT-licensed.
Author
ocaml-dtoa was created by Facebook for the Flow project.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page