package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=1bcb27dfbd130eb057561196ef851649
sha512=2a56611b09a5f1cba6457539f8b6bc87a5f2a5454b36cdb39f6e0d6a5dac6db179aab1ba87c74dd49cc41df31a9a96feb349028ea41df7371ecb47f4d9dfafc4
doc/batteries.unthreaded/BatInt/Safe_int/index.html
Module BatInt.Safe_int
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.
val zero : tThe integer 0.
val one : tThe integer 1.
val minus_one : tThe integer -1.
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.
val max_num : tThe greatest representable integer, which is either 230-1 or 262-1.
val min_num : tThe smallest representable integer, -230 or 262.
val of_float : float -> tConvert 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].
val to_float : t -> floatConvert the given integer to a floating-point number.
val of_string : string -> tConvert 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.
val to_string : t -> stringReturn the string representation of its argument, in signed decimal.
val operations : t BatNumber.numericval of_int : int -> tval to_int : t -> intSubmodules regrouping all infix operations on safe integers
module Infix : BatNumber.Infix with type bat__infix_t = tmodule Compare : BatNumber.Compare with type bat__compare_t = tBoilerplate code
val print : 'a BatInnerIO.output -> t -> unitval ord : t -> t -> BatOrd.order