Belt.Int

[`Belt.Int`]() Utilities for Int.

toFloat

RESCRIPT
let toFloat: int => float

Converts a given `int` to a `float`. ```rescript Js.log(Belt.Int.toFloat(1) === 1.0) /* true */ ```

fromFloat

RESCRIPT
let fromFloat: float => int

Converts a given `float` to an `int`. ```rescript Js.log(Belt.Int.fromFloat(1.0) === 1) /* true */ ```

fromString

RESCRIPT
let fromString: string => option<int>

Converts a given `string` to an `int`. Returns `Some(int)` when the input is a number, `None` otherwise. ```rescript Js.log(Belt.Int.fromString("1") === Some(1)) /* true */ ```

toString

RESCRIPT
let toString: int => string

Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood. ```rescript Js.log(Belt.Int.toString(1) === "1") /* true */ ```

+

RESCRIPT
let _: %rescript.typehole

Addition of two `int` values. Same as the addition from `Pervasives`. ```rescript open Belt.Int Js.log(2 + 2 === 4) /* true */ ```

-

RESCRIPT
let _: %rescript.typehole

Subtraction of two `int` values. Same as the subtraction from `Pervasives`. ```rescript open Belt.Int Js.log(2 - 1 === 1) /* true */ ```

*

RESCRIPT
let _: %rescript.typehole

Multiplication of two `int` values. Same as the multiplication from `Pervasives`. ```rescript open Belt.Int Js.log(2 * 2 === 4) /* true */ ```

/

RESCRIPT
let _: %rescript.typehole

Division of two `int` values. Same as the division from `Pervasives`. ```rescript open Belt.Int Js.log(4 / 2 === 2); /* true */ ```