checked_ointchecked_oint is an OCaml library for checked integer arithmetic. We support the full set of signed and unsigned integers of bitnesses 8, 16, 32, 64, and 128.
$ opam install checked_ointopen Checked_oint
let () =
let x = U8.of_int_exn 50 in
let y = U8.of_int_exn 70 in
assert (U8.equal (U8.add_exn x y) (U8.of_int_exn 120));
assert (Option.is_none (U8.mul x y))You can find the API documentation here.
version field in dune-project.dune build to generate checked_oint.opam.CHANGELOG.md.git pull && opam publish.