tyabu12 / ocaml-round

A floating-point rounding control library for OCaml.

Home Page:https://tyabu.hatenablog.jp/entry/ocaml-round

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

round

Build Status

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.

Requirements

  • GNU make
  • OCaml (>= 4.02)
  • dune (>= 1.2)

Installation

Using opam

opam pin add -y round git@github.com:tyabu12/ocaml-round.git

From sources

make
make install

Test

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
...

Documentation

To generate docs, odoc is required.

make doc

The generated docs can then be found locally at _build/default/_doc/_html/index.html.

License

See LICENSE.

About

A floating-point rounding control library for OCaml.

https://tyabu.hatenablog.jp/entry/ocaml-round

License:Apache License 2.0


Languages

Language:C 65.2%Language:OCaml 28.6%Language:Makefile 6.2%