package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=b691e5870f876c6e590d6aa51b4c5457
sha512=3b0643ff337cd70da8c4b77887d212e82d043a7163fca36588be12186bc86bbcf0d56b13349325f12eabb96c846204c88560786342f50af7bf4e20b9480d3964
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.