package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=1fd7bddce07cf5d244fc9427f7b5e4d4
sha512=c0f2a0fdc8253e0ea999d8d4c58bfbf32b18d251a2e1d9656bf279de5f01a33e9aabac3af4d95f465f8b671e7711ebd37218043face233340a0c11b08fa62f78
doc/batteries.unthreaded/BatInt/Safe_int/index.html
Module BatInt.Safe_int
Source
Safe operations on integers.
This module provides operations on the type int
of integers. Values of this type may be either 31 bits on 32-bit processors or 63 bits on 64-bit processors. Operations which overflow raise exception Number.Overflow
.
This module implements Number.Numeric
, Number.Bounded
, Number.Discrete
.
Important note Untested.
An alias for the type of integers.
Integer division. This division rounds the real quotient of its arguments towards zero, as specified for Pervasives.(/)
.
Integer division. This division rounds the real quotient of its arguments towards zero, as specified for Pervasives.(/)
.
Integer remainder. If y
is not zero, the result of Int.rem x y
satisfies the following property: x = Int.add (Int.mul (Int.div x y) y) (Int.rem x y)
.
modulo a b
computes the remainder of the integer division of a
by b
. This is defined only if b <> 0
.
The result of modulo a b
is a number m
between 0
and abs ( b - 1 )
if a >= 0
or between ~- ( abs ( b - 1 ) )
if a < 0
and such that a * k + (abs b) = m
, for some k
.
Comparison: a <> b
is true if and only if a
and b
have different values.
Comparison: a > b
is true if and only if a
is strictly greater than b
.
Comparison: a < b
is true if and only if a
is strictly smaller than b
.
Comparison: a >= b
is true if and only if a
is greater or equal to b
.
Convert the given floating-point number to integer, discarding the fractional part (truncate towards 0). The result of the conversion is undefined if, after truncation, the number is outside the range [Int.min_int
, Int.max_int
].
Convert the given string to an integer The string is read in decimal (by default) or in hexadecimal, octal or binary if the string begins with 0x
, 0o
or 0b
respectively.
Return the string representation of its argument, in signed decimal.