package octez-proto-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V0/Make/Z/index.html
Module Make.Z
Source
Tezos Protocol Environment - Arbitrary precision arithmetic.
type t = Z.t
val zero : t
val one : t
Euclidean division and remainder. ediv_rem a b
returns a pair (q, r)
such that a = b * q + r
and 0 <= r < |b|
. Raises Division_by_zero
if b = 0
.
Shifts to the left. Equivalent to a multiplication by a power of 2. The second argument must be non-negative.
Shifts to the right. This is an arithmetic shift, equivalent to a division by a power of 2 with rounding towards -oo. The second argument must be non-negative.
val to_string : t -> string
Gives a human-readable, decimal string representation of the argument.
val of_string : string -> t
Converts a string to an integer. An optional -
prefix indicates a negative number, while a +
prefix is ignored. An optional prefix 0x
, 0o
, or 0b
(following the optional -
or +
prefix) indicates that the number is, represented, in hexadecimal, octal, or binary, respectively. Otherwise, base 10 is assumed. (Unlike C, a lone 0
prefix does not denote octal.) Raises an Invalid_argument
exception if the string is not a syntactically correct representation of an integer.
val to_int64 : t -> int64
Converts to a 64-bit integer. May raise Overflow
.
val of_int64 : int64 -> t
Converts from a 64-bit integer.
val to_int : t -> int
Converts to a base integer. May raise an Overflow
.
val of_int : int -> t
Converts from a base integer.
val numbits : t -> int
Returns the number of significant bits in the given number. If x
is zero, numbits x
returns 0. Otherwise, numbits x
returns a positive integer n
such that 2^{n-1} <= |x| < 2^n
. Note that numbits
is defined for negative arguments, and that numbits (-x) = numbits x
.