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 integer0. the origin story. πval one : int64β the 64-bit integer1.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. RaisesDivision_by_zeroif 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 asInt64.div, except that arguments and result are interpreted as unsigned 64-bit integers. Since 4.08val rem : int64 -> int64 -> int64β integer remainder. ifyis not zero, the result ofInt64.rem x ysatisfies this whole vibe:x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y). ify = 0, thenInt64.rem x yraisesDivision_by_zero.val unsigned_rem : int64 -> int64 -> int64β same asInt64.rem, except that arguments and result are interpreted as unsigned 64-bit integers. Since 4.08val fdiv : int64 -> int64 -> int64β floor division.fdiv x yis the real quotientx / yrounded down to an integer. we havefdiv x y <= div x y <= cdiv x yandcdiv x y - fdiv x y <= 1. Since 5.5 RaisesDivision_by_zeroif the second argument is0.val cdiv : int64 -> int64 -> int64β ceil division.cdiv x yis the real quotientx / yrounded up to an integer. we havefdiv x y <= div x y <= cdiv x yandcdiv x y - fdiv x y <= 1. Since 5.5 RaisesDivision_by_zeroif the second argument is0.val ediv : int64 -> int64 -> int64β Euclidean division.ediv x yis the real quotientx / yrounded down to an integer ify > 0and rounded up to an integer ify < 0. the remaindererem x y = x - ediv x y * yis always non-negative. moreover,ediv x (-y) = - ediv x y. Since 5.5 RaisesDivision_by_zeroif the second argument is0.val erem : int64 -> int64 -> int64β Euclidean remainder. ifyis not zero, we havex = ediv x y * y + erem x yand0 <= erem x y <= abs y - 1. the result oferem x yis always non-negative, unlike the result ofrem x y, which has the sign ofx. Since 5.5 RaisesDivision_by_zeroif the second argument is0.val succ : int64 -> int64β successor.Int64.succ xisInt64.add x Int64.one. glow up β¨val pred : int64 -> int64β predecessor.Int64.pred xisInt64.sub x Int64.one.val abs : int64 -> int64βabs xis the absolute value ofx. onmin_intthis ismin_intitself 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 yshiftsxto the left byybits. the result is unspecified ify < 0ory >= 64. πval shift_right : int64 -> int -> int64βInt64.shift_right x yshiftsxto the right byybits. this is an arithmetic shift: the sign bit ofxis replicated and inserted in the vacated bits. the result is unspecified ify < 0ory >= 64. πval shift_right_logical : int64 -> int -> int64βInt64.shift_right_logical x yshiftsxto the right byybits. this is a logical shift: zeroes are inserted in the vacated bits regardless of the sign ofx. the result is unspecified ify < 0ory >= 64. πval of_int : int -> int64β convert the given integer (typeint) to a 64-bit integer (typeint64).val to_int : int64 -> intβ convert the given 64-bit integer (typeint64) to an integer (typeint). on 64-bit platforms, the 64-bit integer is taken modulo2^63, i.e. the high-order bit is lost during the conversion. on 32-bit platforms, the 64-bit integer is taken modulo2^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 asInt64.to_int, but interprets the argument as an unsigned integer. returnsNoneif the unsigned value of the argument cannot fit into anint. Since 4.08val 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 (typeint32) to a 64-bit integer (typeint64).val to_int32 : int64 -> int32β convert the given 64-bit integer (typeint64) to a 32-bit integer (typeint32). the 64-bit integer is taken modulo2^32, i.e. the top 32 bits are lost during the conversion.val of_nativeint : nativeint -> int64β convert the given native integer (typenativeint) to a 64-bit integer (typeint64).val to_nativeint : int64 -> nativeintβ convert the given 64-bit integer (typeint64) to a native integer. on 32-bit platforms, the 64-bit integer is taken modulo2^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 with0u) or in hexadecimal, octal or binary if the string begins with0x,0oor0brespectively. the0uprefix reads the input as an unsigned integer in the range[0, 2*Int64.max_int+1]. if the input exceedsInt64.max_intit is converted to the signed integerInt64.min_int + input - Int64.max_int - 1. the_(underscore) character can appear anywhere in the string and is ignored. RaisesFailureif the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in typeint64.val of_string_opt : string -> int64 optionβ same asof_string, but returnNoneinstead of raising. the chill version π«Ά Since 4.05val 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 givenint64.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 ascompare. along with the typet, this functioncompareallows the moduleInt64to be passed as argument to the functorsSet.MakeandMap.Make.val unsigned_compare : t -> t -> intβ same asInt64.compare, except that arguments are interpreted as unsigned 64-bit integers. Since 4.08val equal : t -> t -> boolβ theequalfunction forint64s. Since 4.03val min : t -> t -> tβ return the smaller of the two arguments. Since 4.13val max : t -> t -> tβ return the greater of the two arguments. Since 4.13val popcount : t -> intβ population count, also known as Hamming weight.popcount nis the number of1bits in the binary representation ofn. negativenare represented in two's complement. Since 5.5val unsigned_bitsize : t -> intβunsigned_bitsize nis the minimal number of bits needed to representnas an unsigned binary number. it is the smallest integeribetween 0 and 64 inclusive such that0 <= n < 2{^i}(unsigned). Since 5.5val signed_bitsize : t -> intβsigned_bitsize nis the minimal number of bits needed to representnas a signed, two's complement binary number. it is the smallest integeribetween 1 and 64 inclusive such that-2{^i-1} <= n < 2{^i-1}(signed). Since 5.5val leading_zeros : t -> intβleading_zeros nis the number of leading (most significant)0bits in the binary representation ofn. it is an integer between 0 and 64 inclusive. ifnis negative,leading_zeros n = 0since the most significant bit ofnis1.leading_zeros n = 64if and only ifn = zero. note thatleading_zeros n + unsigned_bitsize n = 64. Since 5.5val leading_sign_bits : t -> intβleading_sign_bits nis the number of leading (most significant) sign bits in the binary representation ofn, excluding the sign bit itself. it is an integer between 0 and 63 inclusive. for positiven, it is the number of leading zero bits minus one. for negativen, it is the number of leading one bits minus one. note thatleading_sign_bits n + signed_bitsize n = 64. Since 5.5val trailing_zeros : t -> intβtrailing_zeros nis the number of trailing (least significant)0bits in the binary representation ofn. it is an integer between 0 and 64 inclusive. it is the largest integeri <= 64such that2{^i}dividesnevenly. for example,trailing_zeros n = 0if and only ifnis odd, andtrailing_zeros n = 64if and only ifn = zero. Since 5.5val seeded_hash : int -> t -> intβ a seeded hash function for 64-bit ints, with the same output value asHashtbl.seeded_hash. this function allows this module to be passed as argument to the functorHashtbl.MakeSeeded. Since 5.1val hash : t -> intβ an unseeded hash function for 64-bit ints, with the same output value asHashtbl.hash. this function allows this module to be passed as argument to the functorHashtbl.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
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms