Docs / Language Manual / IntegerAndFloat

Integer and Float


32-bits, truncated when necessary. Reason provides the usual operations on them: +, -, *, /, etc.


See the Int32 module in the standard library. For JS compilation, see Js.Int.

Tips & Tricks

Careful when you bind to JavaScript numbers! Long ones might be truncated. Bind JS number as float instead.


Float requires other operators: +., -., *., /., etc. Like 0.5 +. 0.6.


There's no Float module in the current standard library. For JS compilation, see Js.Float.

Design Decisions

"Why the heck can't I just use an overloaded + for both int and float?"

There's a lot of history to this, but one day we'll be able to. Let's hang in there =)

Additionally, floats are rather special in Reason/OCaml native. Check here if you're interested in learning some rather interesting optimizations!