# Standard integer `intstd/core/types/int: V` functions.

These are arbitrary precision signed integer with an efficient runtime representation. For more details, see:

“What About the Integer Numbers? ”Fast Arithmetic with Tagged Integers – A Plea for Hardware Support“ Daan Leijen, Technical report MSR-TR-2022-17, 2022-07-11, v1.0. Presented at the ML workshop 2022.” https://​www.​microsoft.​com/​en-​us/​research/​uploads/​prod/​2022/​07/​int.​pdf.

Convert an `int16std/core/types/int16: V` to an `intstd/core/types/int: V`.

Convert an `int8std/core/types/int8: V` to an `intstd/core/types/int: V`.

Convert an `int8std/core/types/int8: V` to an `intstd/core/types/int: V` but interpret the `int8std/core/types/int8: V` as an unsigned 8-bit value between 0 and 255.

Convert an `intptr_tstd/core/types/intptr_t: V` to an `intstd/core/types/int: V`.

Convert an `ssize_tstd/core/types/ssize_t: V` to an `intstd/core/types/int: V`.

Are two integers not equal?

Euclidean modulus of two integers; always a non-negative number. See also `divmodstd/core/int/divmod: (x : int, y : int) -> (int, int)`.

Multiply two integers.

Substract two integers.

Euclidean-0 division of two integers. See also `divmodstd/core/int/divmod: (x : int, y : int) -> (int, int)`.

Is the first integer smaller than the second?

Is the first integer smaller or equal to the second?

Are two integers equal?

Is the first integer greater than the second?

Is the first integer greater or equal to the second?

Raise an integer `i` to the power of `exp`.

Negate an integer.

Return the absolute value of an integer.

Convert an int to a boolean, using `Falsestd/core/types/False: bool` for 0 and `Truestd/core/types/True: bool` otherwise.

Compare two integers.

Return the number of decimal digits of `i`. Return `0` when `i(==)std/core/int/(==): (x : int, y : int) -> bool0`.

Decrement.

Euclidean-0 division & modulus. Euclidean division is defined as: For any `D` and `d` where `d!=0` , we have:

1. `D == d*(D/d) + (D%d)`
2. `D%d` is always positive where `0 <= D%d < abs(d)`

Moreover, Euclidean-0 is a total function, for the case where `d(==)std/core/int/(==): (x : int, y : int) -> bool0` we have that `D%0 == D` and `D/0 == 0` . So property (1) still holds, but not property (2).

Useful laws that hold for Euclidean-0 division:

• `D/(-d) == -(D/d)`
• `D%(-d) == D%d`
• `D/(2^n) == sar(D,n) ` (where `2^n` means `2` to the power of `n`)
• `D%(2^n) == D & ((2^n) - 1) `

See also Division and modulus for computer scientists, Daan Leijen, 2001 for further information (available at: https://​www.​microsoft.​com/​en-​us/​research/​wp-​content/​uploads/​2016/​02/​divmodnote-​letter.​pdf).

Calculate `10^exp`.

Calculate `2^exp`.

Increment.

Clamp an `intstd/core/types/int: V` to fit in an `int16std/core/types/int16: V`.

Clamp an `intstd/core/types/int: V` to fit in an `int8std/core/types/int8: V`.

Clamp an `intstd/core/types/int: V` to fit in an `intptr_tstd/core/types/intptr_t: V`.

Is this an even integer?

Return the number of ending `0` digits of `i`. Return `0` when `i(==)std/core/int/(==): (x : int, y : int) -> bool0`.

Is the integer negative (strictly smaller than zero).

Is this an odd integer?

Is the integer positive (strictly greater than zero).

Is this equal to zero?

Return the maximum of two integers.

Transform an integer to a maybe type, using `Nothingstd/core/types/Nothing: forall<a> maybe<a>` for `0`.

Convert a `maybe<intstd/core/types/int: V>` to an `intstd/core/types/int: V` using zero for `Nothingstd/core/types/Nothing: forall<a> maybe<a>`.

Return the minimum of two integers.

Order two integers in ascending order.

Parse an integer. If an illegal digit character is encountered `Nothingstd/core/types/Nothing: forall<a> maybe<a>` is returned. An empty string, or a string starting with white space will result in `Nothingstd/core/types/Nothing: forall<a> maybe<a>` A string can start with a `(-)std/core/int/(-): (x : int, y : int) -> int` sign for negative numbers, and with `0x` or `0X` for hexadecimal numbers (in which case the `hex` parameter is ignored).

Raise an integer `i` to the power of `exp`.

Convert an `intstd/core/types/int: V` to a string.

Compare an integer `i` with zero.

Convert an integer to an `ssize_tstd/core/types/ssize_t: V`. The number is clamped to the maximal or minimum `ssize_tstd/core/types/ssize_t: V` value if it is outside the range of an `ssize_tstd/core/types/ssize_t: V`. Needed for evidence indices in `std/core/hnd`.

Clamp an `intstd/core/types/int: V` to fit in an `int8std/core/types/int8: V` but interpret the `intstd/core/types/int: V` as an unsigned 8-bit value, and clamp between 0 and 255.

private import std/core/typesstd/core/types