# \[ANN\] checked\_oint v0.1.0

**URL:** <https://discuss.ocaml.org/t/ann-checked-oint-v0-1-0/14580>\
**Category:** Community\
**Tags:** announce\
**Created:** [May 3, 2024, 2:13pm UTC](https://discuss.ocaml.org/t/ann-checked-oint-v0-1-0/14580 "2024-05-03T14:13:23Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Hirrolot](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/hirrolot/32/4100_2.png) [@Hirrolot](https://discuss.ocaml.org/u/Hirrolot)\
**Post date:** [May 3, 2024, 2:13pm UTC](https://discuss.ocaml.org/t/ann-checked-oint-v0-1-0/14580/1 "2024-05-03T14:13:23Z")

</div>

I’d like to announce a new library: [`checked_oint`](https://github.com/Hirrolot/checked_oint). It implements checked arithmetic for both signed and unsigned integers of 8, 16, 32, 64, and 128 bits. Unlike `stdint` or `ocaml-integers`, routines in this library either return an option or raise an exception when a result of an arithmetic operation cannot be represented in a desired integer type. In addition, it contains abstractions for manipulating arbitrary integers and integer types in a generic and type-safe manner, which I find quite useful for compiler/interpreter implementations.

Usage example:

```ocaml
open 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))

```

Feel free to ask any questions in the comments.

---

_[View the full topic](https://discuss.ocaml.org/t/ann-checked-oint-v0-1-0/14580)._
