.TH "Stdlib.Int32" 3o 2020-10-30 OCamldoc "OCaml library" .SH NAME Stdlib.Int32 \- no description .SH Module Module Stdlib.Int32 .SH Documentation .sp Module .BI "Int32" : .B (module Stdlib__int32) .sp .sp .sp .sp .I val zero : .B int32 .sp The 32\-bit integer 0\&. .sp .I val one : .B int32 .sp The 32\-bit integer 1\&. .sp .I val minus_one : .B int32 .sp The 32\-bit integer \-1\&. .sp .I val neg : .B int32 -> int32 .sp Unary negation\&. .sp .I val add : .B int32 -> int32 -> int32 .sp Addition\&. .sp .I val sub : .B int32 -> int32 -> int32 .sp Subtraction\&. .sp .I val mul : .B int32 -> int32 -> int32 .sp Multiplication\&. .sp .I val div : .B int32 -> int32 -> int32 .sp Integer division\&. This division rounds the real quotient of its arguments towards zero, as specified for .ft B (/) .ft R \&. .sp .B "Raises Division_by_zero" if the second argument is zero\&. .sp .I val unsigned_div : .B int32 -> int32 -> int32 .sp Same as .ft B Int32\&.div .ft R , except that arguments and result are interpreted as unsigned 32\-bit integers\&. .sp .B "Since" 4.08.0 .sp .I val rem : .B int32 -> int32 -> int32 .sp Integer remainder\&. If .ft B y .ft R is not zero, the result of .ft B Int32\&.rem x y .ft R satisfies the following property: .ft B x = Int32\&.add (Int32\&.mul (Int32\&.div x y) y) (Int32\&.rem x y) .ft R \&. If .ft B y = 0 .ft R , .ft B Int32\&.rem x y .ft R raises .ft B Division_by_zero .ft R \&. .sp .I val unsigned_rem : .B int32 -> int32 -> int32 .sp Same as .ft B Int32\&.rem .ft R , except that arguments and result are interpreted as unsigned 32\-bit integers\&. .sp .B "Since" 4.08.0 .sp .I val succ : .B int32 -> int32 .sp Successor\&. .ft B Int32\&.succ x .ft R is .ft B Int32\&.add x Int32\&.one .ft R \&. .sp .I val pred : .B int32 -> int32 .sp Predecessor\&. .ft B Int32\&.pred x .ft R is .ft B Int32\&.sub x Int32\&.one .ft R \&. .sp .I val abs : .B int32 -> int32 .sp Return the absolute value of its argument\&. .sp .I val max_int : .B int32 .sp The greatest representable 32\-bit integer, 2^31 \- 1\&. .sp .I val min_int : .B int32 .sp The smallest representable 32\-bit integer, \-2^31\&. .sp .I val logand : .B int32 -> int32 -> int32 .sp Bitwise logical and\&. .sp .I val logor : .B int32 -> int32 -> int32 .sp Bitwise logical or\&. .sp .I val logxor : .B int32 -> int32 -> int32 .sp Bitwise logical exclusive or\&. .sp .I val lognot : .B int32 -> int32 .sp Bitwise logical negation\&. .sp .I val shift_left : .B int32 -> int -> int32 .sp .ft B Int32\&.shift_left x y .ft R shifts .ft B x .ft R to the left by .ft B y .ft R bits\&. The result is unspecified if .ft B y < 0 .ft R or .ft B y >= 32 .ft R \&. .sp .I val shift_right : .B int32 -> int -> int32 .sp .ft B Int32\&.shift_right x y .ft R shifts .ft B x .ft R to the right by .ft B y .ft R bits\&. This is an arithmetic shift: the sign bit of .ft B x .ft R is replicated and inserted in the vacated bits\&. The result is unspecified if .ft B y < 0 .ft R or .ft B y >= 32 .ft R \&. .sp .I val shift_right_logical : .B int32 -> int -> int32 .sp .ft B Int32\&.shift_right_logical x y .ft R shifts .ft B x .ft R to the right by .ft B y .ft R bits\&. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of .ft B x .ft R \&. The result is unspecified if .ft B y < 0 .ft R or .ft B y >= 32 .ft R \&. .sp .I val of_int : .B int -> int32 .sp Convert the given integer (type .ft B int .ft R ) to a 32\-bit integer (type .ft B int32 .ft R )\&. On 64\-bit platforms, the argument is taken modulo 2^32\&. .sp .I val to_int : .B int32 -> int .sp Convert the given 32\-bit integer (type .ft B int32 .ft R ) to an integer (type .ft B int .ft R )\&. On 32\-bit platforms, the 32\-bit integer is taken modulo 2^31, i\&.e\&. the high\-order bit is lost during the conversion\&. On 64\-bit platforms, the conversion is exact\&. .sp .I val unsigned_to_int : .B int32 -> int option .sp Same as .ft B Int32\&.to_int .ft R , but interprets the argument as an unsigned integer\&. Returns .ft B None .ft R if the unsigned value of the argument cannot fit into an .ft B int .ft R \&. .sp .B "Since" 4.08.0 .sp .I val of_float : .B float -> int32 .sp Convert the given floating\-point number to a 32\-bit integer, discarding the fractional part (truncate towards 0)\&. The result of the conversion is undefined if, after truncation, the number is outside the range [ .ft B Int32\&.min_int .ft R , .ft B Int32\&.max_int .ft R ]\&. .sp .I val to_float : .B int32 -> float .sp Convert the given 32\-bit integer to a floating\-point number\&. .sp .I val of_string : .B string -> int32 .sp Convert the given string to a 32\-bit integer\&. The string is read in decimal (by default, or if the string begins with .ft B 0u .ft R ) or in hexadecimal, octal or binary if the string begins with .ft B 0x .ft R , .ft B 0o .ft R or .ft B 0b .ft R respectively\&. .sp The .ft B 0u .ft R prefix reads the input as an unsigned integer in the range .ft B [0, 2*Int32\&.max_int+1] .ft R \&. If the input exceeds .ft B Int32\&.max_int .ft R it is converted to the signed integer .ft B Int32\&.min_int + input \- Int32\&.max_int \- 1 .ft R \&. .sp The .ft B _ .ft R (underscore) character can appear anywhere in the string and is ignored\&. .sp .B "Raises Failure" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type .ft B int32 .ft R \&. .sp .I val of_string_opt : .B string -> int32 option .sp Same as .ft B of_string .ft R , but return .ft B None .ft R instead of raising\&. .sp .B "Since" 4.05 .sp .I val to_string : .B int32 -> string .sp Return the string representation of its argument, in signed decimal\&. .sp .I val bits_of_float : .B float -> int32 .sp Return the internal representation of the given float according to the IEEE 754 floating\-point \&'single format\&' bit layout\&. Bit 31 of the result represents the sign of the float; bits 30 to 23 represent the (biased) exponent; bits 22 to 0 represent the mantissa\&. .sp .I val float_of_bits : .B int32 -> float .sp Return the floating\-point number whose internal representation, according to the IEEE 754 floating\-point \&'single format\&' bit layout, is the given .ft B int32 .ft R \&. .sp .I type t = .B int32 .sp An alias for the type of 32\-bit integers\&. .sp .I val compare : .B t -> t -> int .sp The comparison function for 32\-bit integers, with the same specification as .ft B compare .ft R \&. Along with the type .ft B t .ft R , this function .ft B compare .ft R allows the module .ft B Int32 .ft R to be passed as argument to the functors .ft B Set\&.Make .ft R and .ft B Map\&.Make .ft R \&. .sp .I val unsigned_compare : .B t -> t -> int .sp Same as .ft B Int32\&.compare .ft R , except that arguments are interpreted as unsigned 32\-bit integers\&. .sp .B "Since" 4.08.0 .sp .I val equal : .B t -> t -> bool .sp The equal function for int32s\&. .sp .B "Since" 4.03.0 .sp