package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb
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.