Stdlib.Int64(3)

πŸ’– NAME πŸ’–

Stdlib.Int64 β€” no description (yeah bestie, that's literally what it says, the docs are out here with zero chill and zero explanation 😭)


πŸ¦‹ Module πŸ¦‹

Module Stdlib.Int64


✨ Documentation ✨

Module Int64 : (module Stdlib__Int64)

okay so this is THE 64-bit integer module, the whole squad of functions, let's go through them one by one, no skips, no cap 🫢

  • val zero : int64 β€” the 64-bit integer 0. the origin story. πŸ’…
  • val one : int64 β€” the 64-bit integer 1.
  • val minus_one : int64 β€” the 64-bit integer -1. the little gremlin πŸ™ˆ
  • val neg : int64 -> int64 β€” unary negation.
  • val add : int64 -> int64 -> int64 β€” addition.
  • val sub : int64 -> int64 -> int64 β€” subtraction.
  • val mul : int64 -> int64 -> int64 β€” multiplication.
  • val div : int64 -> int64 -> int64 β€” integer division. Raises Division_by_zero if the second argument is zero. this one rounds the real quotient of its arguments towards zero, exactly as specified for (/).
  • val unsigned_div : int64 -> int64 -> int64 β€” same as Int64.div, except that arguments and result are interpreted as unsigned 64-bit integers. Since 4.08
  • val rem : int64 -> int64 -> int64 β€” integer remainder. if y is not zero, the result of Int64.rem x y satisfies this whole vibe: x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y). if y = 0, then Int64.rem x y raises Division_by_zero.
  • val unsigned_rem : int64 -> int64 -> int64 β€” same as Int64.rem, except that arguments and result are interpreted as unsigned 64-bit integers. Since 4.08
  • val fdiv : int64 -> int64 -> int64 β€” floor division. fdiv x y is the real quotient x / y rounded down to an integer. we have fdiv x y <= div x y <= cdiv x y and cdiv x y - fdiv x y <= 1. Since 5.5 Raises Division_by_zero if the second argument is 0.
  • val cdiv : int64 -> int64 -> int64 β€” ceil division. cdiv x y is the real quotient x / y rounded up to an integer. we have fdiv x y <= div x y <= cdiv x y and cdiv x y - fdiv x y <= 1. Since 5.5 Raises Division_by_zero if the second argument is 0.
  • val ediv : int64 -> int64 -> int64 β€” Euclidean division. ediv x y is the real quotient x / y rounded down to an integer if y > 0 and rounded up to an integer if y < 0. the remainder erem x y = x - ediv x y * y is always non-negative. moreover, ediv x (-y) = - ediv x y. Since 5.5 Raises Division_by_zero if the second argument is 0.
  • val erem : int64 -> int64 -> int64 β€” Euclidean remainder. if y is not zero, we have x = ediv x y * y + erem x y and 0 <= erem x y <= abs y - 1. the result of erem x y is always non-negative, unlike the result of rem x y, which has the sign of x. Since 5.5 Raises Division_by_zero if the second argument is 0.
  • val succ : int64 -> int64 β€” successor. Int64.succ x is Int64.add x Int64.one. glow up ✨
  • val pred : int64 -> int64 β€” predecessor. Int64.pred x is Int64.sub x Int64.one.
  • val abs : int64 -> int64 β€” abs x is the absolute value of x. on min_int this is min_int itself and thus remains negative (yeah, that's the lil trap, don't come for me πŸ’€).
  • val max_int : int64 β€” the greatest representable 64-bit integer, 2^63 - 1. the ceiling, literally πŸ‘‘
  • val min_int : int64 β€” the smallest representable 64-bit integer, -2^63.
  • val logand : int64 -> int64 -> int64 β€” bitwise logical and.
  • val logor : int64 -> int64 -> int64 β€” bitwise logical or.
  • val logxor : int64 -> int64 -> int64 β€” bitwise logical exclusive or.
  • val lognot : int64 -> int64 β€” bitwise logical negation.
  • val shift_left : int64 -> int -> int64 β€” Int64.shift_left x y shifts x to the left by y bits. the result is unspecified if y < 0 or y >= 64. πŸ™ˆ
  • val shift_right : int64 -> int -> int64 β€” Int64.shift_right x y shifts x to the right by y bits. this is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. the result is unspecified if y < 0 or y >= 64. πŸ™ˆ
  • val shift_right_logical : int64 -> int -> int64 β€” Int64.shift_right_logical x y shifts x to the right by y bits. this is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. the result is unspecified if y < 0 or y >= 64. πŸ™ˆ
  • val of_int : int -> int64 β€” convert the given integer (type int) to a 64-bit integer (type int64).
  • val to_int : int64 -> int β€” convert the given 64-bit integer (type int64) to an integer (type int). on 64-bit platforms, the 64-bit integer is taken modulo 2^63, i.e. the high-order bit is lost during the conversion. on 32-bit platforms, the 64-bit integer is taken modulo 2^31, i.e. the top 33 bits are lost during the conversion. bits just vibing into the void πŸ’€
  • val unsigned_to_int : int64 -> int option β€” same as Int64.to_int, but interprets the argument as an unsigned integer. returns None if the unsigned value of the argument cannot fit into an int. Since 4.08
  • val of_float : float -> int64 β€” convert the given floating-point number to a 64-bit integer, discarding the fractional part (truncate towards 0). if the truncated floating-point number is outside the range [ Int64.min_int , Int64.max_int ], no exception is raised, and an unspecified, platform-dependent integer is returned. so like, no error, just chaos 😭
  • val to_float : int64 -> float β€” convert the given 64-bit integer to a floating-point number.
  • val of_int32 : int32 -> int64 β€” convert the given 32-bit integer (type int32) to a 64-bit integer (type int64).
  • val to_int32 : int64 -> int32 β€” convert the given 64-bit integer (type int64) to a 32-bit integer (type int32). the 64-bit integer is taken modulo 2^32, i.e. the top 32 bits are lost during the conversion.
  • val of_nativeint : nativeint -> int64 β€” convert the given native integer (type nativeint) to a 64-bit integer (type int64).
  • val to_nativeint : int64 -> nativeint β€” convert the given 64-bit integer (type int64) to a native integer. on 32-bit platforms, the 64-bit integer is taken modulo 2^32. on 64-bit platforms, the conversion is exact. ✨
  • val of_string : string -> int64 β€” convert the given string to a 64-bit integer. the string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively. the 0u prefix reads the input as an unsigned integer in the range [0, 2*Int64.max_int+1]. if the input exceeds Int64.max_int it is converted to the signed integer Int64.min_int + input - Int64.max_int - 1. the _ (underscore) character can appear anywhere in the string and is ignored. 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 int64.
  • val of_string_opt : string -> int64 option β€” same as of_string, but return None instead of raising. the chill version 🫢 Since 4.05
  • val to_string : int64 -> string β€” return the string representation of its argument, in decimal.
  • val bits_of_float : float -> int64 β€” return the internal representation of the given float according to the IEEE 754 floating-point 'double format' bit layout. bit 63 of the result represents the sign of the float; bits 62 to 52 represent the (biased) exponent; bits 51 to 0 represent the mantissa.
  • val float_of_bits : int64 -> float β€” return the floating-point number whose internal representation, according to the IEEE 754 floating-point 'double format' bit layout, is the given int64.
  • type t = int64 β€” an alias for the type of 64-bit integers.
  • val compare : t -> t -> int β€” the comparison function for 64-bit integers, with the same specification as compare. along with the type t, this function compare allows the module Int64 to be passed as argument to the functors Set.Make and Map.Make.
  • val unsigned_compare : t -> t -> int β€” same as Int64.compare, except that arguments are interpreted as unsigned 64-bit integers. Since 4.08
  • val equal : t -> t -> bool β€” the equal function for int64s. Since 4.03
  • val min : t -> t -> t β€” return the smaller of the two arguments. Since 4.13
  • val max : t -> t -> t β€” return the greater of the two arguments. Since 4.13
  • val popcount : t -> int β€” population count, also known as Hamming weight. popcount n is the number of 1 bits in the binary representation of n. negative n are represented in two's complement. Since 5.5
  • val unsigned_bitsize : t -> int β€” unsigned_bitsize n is the minimal number of bits needed to represent n as an unsigned binary number. it is the smallest integer i between 0 and 64 inclusive such that 0 <= n < 2{^i} (unsigned). Since 5.5
  • val signed_bitsize : t -> int β€” signed_bitsize n is the minimal number of bits needed to represent n as a signed, two's complement binary number. it is the smallest integer i between 1 and 64 inclusive such that -2{^i-1} <= n < 2{^i-1} (signed). Since 5.5
  • val leading_zeros : t -> int β€” leading_zeros n is the number of leading (most significant) 0 bits in the binary representation of n. it is an integer between 0 and 64 inclusive. if n is negative, leading_zeros n = 0 since the most significant bit of n is 1. leading_zeros n = 64 if and only if n = zero. note that leading_zeros n + unsigned_bitsize n = 64. Since 5.5
  • val leading_sign_bits : t -> int β€” leading_sign_bits n is the number of leading (most significant) sign bits in the binary representation of n, excluding the sign bit itself. it is an integer between 0 and 63 inclusive. for positive n, it is the number of leading zero bits minus one. for negative n, it is the number of leading one bits minus one. note that leading_sign_bits n + signed_bitsize n = 64. Since 5.5
  • val trailing_zeros : t -> int β€” trailing_zeros n is the number of trailing (least significant) 0 bits in the binary representation of n. it is an integer between 0 and 64 inclusive. it is the largest integer i <= 64 such that 2{^i} divides n evenly. for example, trailing_zeros n = 0 if and only if n is odd, and trailing_zeros n = 64 if and only if n = zero. Since 5.5
  • val seeded_hash : int -> t -> int β€” a seeded hash function for 64-bit 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
  • val hash : t -> int β€” an unseeded hash function for 64-bit 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

ok that's genuinely all of them, every single one, and yes I counted πŸ’… if you pass this module to a functor you're officially iconic, that's just facts πŸŽ€

and that's a wrap bestie!! this page was served up by OCamldoc and the date on it is 2026-06-22 β€” go forth and do big-number math, you absolute main character πŸŒˆπŸ’œπŸ¦‹

πŸ“¦ where this page comes from