Module Int
: (moduleStdlib__Int)Integerstypet = int
The type for integer values.
valzero : intzero is the integer 0 .
valone : intone is the integer 1 .
valminus_one : intminus_one is the integer -1 .
valneg : int->intnegx is ~-x .
valadd : int->int->intaddxy is the addition x+y .
valsub : int->int->intsubxy is the subtraction x-y .
valmul : int->int->intmulxy is the multiplication x*y .
valdiv : int->int->intdivxy is the division x/y . See (/) for details.
valrem : int->int->intremxy is the remainder xmody . See (mod) for details.
valsucc : int->intsuccx is addx1 .
valpred : int->intpredx is subx1 .
valabs : int->intabsx is the absolute value of x . That is x if x is positive and negx if x is negative. Warning. This
may be negative if the argument is Int.min_int .
valmax_int : intmax_int is the greatest representable integer, 2 ^ Sys.int_size-1-1 .
valmin_int : intmin_int is the smallest representable integer, -2 ^ Sys.int_size-1 .
vallogand : int->int->intlogandxy is the bitwise logical and of x and y .
vallogor : int->int->intlogorxy is the bitwise logical or of x and y .
vallogxor : int->int->intlogxorxy is the bitwise logical exclusive or of x and y .
vallognot : int->intlognotx is the bitwise logical negation of x .
valshift_left : int->int->intshift_leftxn shifts x to the left by n bits. The result is unspecified if n<0 or n>Sys.int_size .
valshift_right : int->int->intshift_rightxn shifts x to the right by n bits. This is an arithmetic shift: the sign bit of x is
replicated and inserted in the vacated bits. The result is unspecified if n<0 or n>Sys.int_size .
valshift_right_logical : int->int->intshift_rightxn shifts x to the right by n bits. This is a logical shift: zeroes are inserted in the
vacated bits regardless of the sign of x . The result is unspecified if n<0 or n>Sys.int_size .
Predicatesandcomparisonsvalequal : int->int->boolequalxy is true if and only if x=y .
valcompare : int->int->intcomparexy is comparexy but more efficient.
valmin : int->int->int
Return the smaller of the two arguments.
Since 4.13
valmax : int->int->int
Return the greater of the two arguments.
Since 4.13
Convertingvalto_float : int->floatto_floatx is x as a floating point number.
valof_float : float->intof_floatx truncates x to an integer. The result is unspecified if the argument is nan or falls outside
the range of representable integers.
valto_string : int->stringto_stringx is the written representation of x in decimal.
valseeded_hash : int->int->int
A seeded hash function for ints, with the same output value as Hashtbl.seeded_hash . This function allows
this module to be passed as argument to the functor Hashtbl.MakeSeeded .
Since 5.1
valhash : int->int
An unseeded hash function for ints, with the same output value as Hashtbl.hash . This function allows
this module to be passed as argument to the functor Hashtbl.Make .
Since 5.1
OCamldoc 2025-06-12 Stdlib.Int(3o)