round is a floating-point rounding control library for OCaml.
round provides functions about floating-point with specified rounding directions.
round follows IEE-754 that defines rounding behaviors about basic operators and sqrt functions.
- GNU make
- OCaml (>= 4.02)
- dune (>= 1.2)
opam pin add -y round git@github.com:tyabu12/ocaml-round.git
make
make install
You can confirm behavior of floating-point rounding direction:
$ make test
x = 1.000000e+00, y = 1.000000e-40, z = -1.000000e-40
round NearestTiesToEven:
x + y = 1.000000000000000000e+00
x + z = 1.000000000000000000e+00
round ToZero:
x + y = 1.000000000000000000e+00
x + z = 9.999999999999998890e-01
round Up:
x + y = 1.000000000000000222e+00
x + z = 1.000000000000000000e+00
round Down:
x + y = 1.000000000000000000e+00
x + z = 9.999999999999998890e-01
...
To generate docs, odoc is required.
make doc
The generated docs can then be found locally at _build/default/_doc/_html/index.html
.
See LICENSE.