790 lines
9.6 KiB
HTML
790 lines
9.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Int64</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Int64</H1>
|
|
Section: OCaml library (3o)<BR>Updated: 2020-01-30<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Int64 - 64-bit integers.
|
|
<A NAME="lbAC"> </A>
|
|
<H2>Module</H2>
|
|
|
|
Module Int64
|
|
<A NAME="lbAD"> </A>
|
|
<H2>Documentation</H2>
|
|
|
|
<P>
|
|
Module
|
|
<B>Int64</B>
|
|
|
|
<BR> :
|
|
<B>sig end</B>
|
|
|
|
<P>
|
|
<P>
|
|
64-bit integers.
|
|
<P>
|
|
This module provides operations on the type
|
|
<B>int64</B>
|
|
|
|
of
|
|
signed 64-bit integers. Unlike the built-in
|
|
<B>int</B>
|
|
|
|
type,
|
|
the type
|
|
<B>int64</B>
|
|
|
|
is guaranteed to be exactly 64-bit wide on all
|
|
platforms. All arithmetic operations over
|
|
<B>int64</B>
|
|
|
|
are taken
|
|
modulo 2^64
|
|
<P>
|
|
Performance notice: values of type
|
|
<B>int64</B>
|
|
|
|
occupy more memory
|
|
space than values of type
|
|
<B>int</B>
|
|
|
|
, and arithmetic operations on
|
|
<B>int64</B>
|
|
|
|
are generally slower than those on
|
|
<B>int</B>
|
|
|
|
. Use
|
|
<B>int64</B>
|
|
|
|
only when the application requires exact 64-bit arithmetic.
|
|
<P>
|
|
Literals for 64-bit integers are suffixed by L:
|
|
<B>let zero: int64 = 0L</B>
|
|
|
|
|
|
|
|
<B>let one: int64 = 1L</B>
|
|
|
|
<B>let m_one: int64 = -1L</B>
|
|
|
|
<B></B>
|
|
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val zero </I>
|
|
|
|
:
|
|
<B>int64</B>
|
|
|
|
<P>
|
|
The 64-bit integer 0.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val one </I>
|
|
|
|
:
|
|
<B>int64</B>
|
|
|
|
<P>
|
|
The 64-bit integer 1.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val minus_one </I>
|
|
|
|
:
|
|
<B>int64</B>
|
|
|
|
<P>
|
|
The 64-bit integer -1.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val neg </I>
|
|
|
|
:
|
|
<B>int64 -> int64</B>
|
|
|
|
<P>
|
|
Unary negation.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val add </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Addition.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val sub </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Subtraction.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val mul </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Multiplication.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val div </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Integer division. Raise
|
|
<B>Division_by_zero</B>
|
|
|
|
if the second
|
|
argument is zero. This division rounds the real quotient of
|
|
its arguments towards zero, as specified for
|
|
<B>(/)</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val unsigned_div </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>Int64.div</B>
|
|
|
|
, except that arguments and result are interpreted as unsigned 64-bit integers.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.08.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val rem </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Integer remainder. If
|
|
<B>y</B>
|
|
|
|
is not zero, the result
|
|
of
|
|
<B>Int64.rem x y</B>
|
|
|
|
satisfies the following property:
|
|
<B>x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y)</B>
|
|
|
|
.
|
|
If
|
|
<B>y = 0</B>
|
|
|
|
,
|
|
<B>Int64.rem x y</B>
|
|
|
|
raises
|
|
<B>Division_by_zero</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val unsigned_rem </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>Int64.rem</B>
|
|
|
|
, except that arguments and result are interpreted as unsigned 64-bit integers.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.08.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val succ </I>
|
|
|
|
:
|
|
<B>int64 -> int64</B>
|
|
|
|
<P>
|
|
Successor.
|
|
<B>Int64.succ x</B>
|
|
|
|
is
|
|
<B>Int64.add x Int64.one</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val pred </I>
|
|
|
|
:
|
|
<B>int64 -> int64</B>
|
|
|
|
<P>
|
|
Predecessor.
|
|
<B>Int64.pred x</B>
|
|
|
|
is
|
|
<B>Int64.sub x Int64.one</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val abs </I>
|
|
|
|
:
|
|
<B>int64 -> int64</B>
|
|
|
|
<P>
|
|
Return the absolute value of its argument.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val max_int </I>
|
|
|
|
:
|
|
<B>int64</B>
|
|
|
|
<P>
|
|
The greatest representable 64-bit integer, 2^63 - 1.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val min_int </I>
|
|
|
|
:
|
|
<B>int64</B>
|
|
|
|
<P>
|
|
The smallest representable 64-bit integer, -2^63.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val logand </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Bitwise logical and.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val logor </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Bitwise logical or.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val logxor </I>
|
|
|
|
:
|
|
<B>int64 -> int64 -> int64</B>
|
|
|
|
<P>
|
|
Bitwise logical exclusive or.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val lognot </I>
|
|
|
|
:
|
|
<B>int64 -> int64</B>
|
|
|
|
<P>
|
|
Bitwise logical negation.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val shift_left </I>
|
|
|
|
:
|
|
<B>int64 -> int -> int64</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>Int64.shift_left x y</B>
|
|
|
|
shifts
|
|
<B>x</B>
|
|
|
|
to the left by
|
|
<B>y</B>
|
|
|
|
bits.
|
|
The result is unspecified if
|
|
<B>y < 0</B>
|
|
|
|
or
|
|
<B>y >= 64</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val shift_right </I>
|
|
|
|
:
|
|
<B>int64 -> int -> int64</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>Int64.shift_right x y</B>
|
|
|
|
shifts
|
|
<B>x</B>
|
|
|
|
to the right by
|
|
<B>y</B>
|
|
|
|
bits.
|
|
This is an arithmetic shift: the sign bit of
|
|
<B>x</B>
|
|
|
|
is replicated
|
|
and inserted in the vacated bits.
|
|
The result is unspecified if
|
|
<B>y < 0</B>
|
|
|
|
or
|
|
<B>y >= 64</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val shift_right_logical </I>
|
|
|
|
:
|
|
<B>int64 -> int -> int64</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>Int64.shift_right_logical x y</B>
|
|
|
|
shifts
|
|
<B>x</B>
|
|
|
|
to the right by
|
|
<B>y</B>
|
|
|
|
bits.
|
|
This is a logical shift: zeroes are inserted in the vacated bits
|
|
regardless of the sign of
|
|
<B>x</B>
|
|
|
|
.
|
|
The result is unspecified if
|
|
<B>y < 0</B>
|
|
|
|
or
|
|
<B>y >= 64</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val of_int </I>
|
|
|
|
:
|
|
<B>int -> int64</B>
|
|
|
|
<P>
|
|
Convert the given integer (type
|
|
<B>int</B>
|
|
|
|
) to a 64-bit integer
|
|
(type
|
|
<B>int64</B>
|
|
|
|
).
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val to_int </I>
|
|
|
|
:
|
|
<B>int64 -> int</B>
|
|
|
|
<P>
|
|
Convert the given 64-bit integer (type
|
|
<B>int64</B>
|
|
|
|
) to an
|
|
integer (type
|
|
<B>int</B>
|
|
|
|
). 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.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val unsigned_to_int </I>
|
|
|
|
:
|
|
<B>int64 -> int option</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>Int64.to_int</B>
|
|
|
|
, but interprets the argument as an unsigned integer.
|
|
Returns
|
|
<B>None</B>
|
|
|
|
if the unsigned value of the argument cannot fit into an
|
|
<B>int</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.08.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val of_float </I>
|
|
|
|
:
|
|
<B>float -> int64</B>
|
|
|
|
<P>
|
|
Convert the given floating-point number to a 64-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 [
|
|
<B>Int64.min_int</B>
|
|
|
|
,
|
|
<B>Int64.max_int</B>
|
|
|
|
].
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val to_float </I>
|
|
|
|
:
|
|
<B>int64 -> float</B>
|
|
|
|
<P>
|
|
Convert the given 64-bit integer to a floating-point number.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val of_int32 </I>
|
|
|
|
:
|
|
<B>int32 -> int64</B>
|
|
|
|
<P>
|
|
Convert the given 32-bit integer (type
|
|
<B>int32</B>
|
|
|
|
)
|
|
to a 64-bit integer (type
|
|
<B>int64</B>
|
|
|
|
).
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val to_int32 </I>
|
|
|
|
:
|
|
<B>int64 -> int32</B>
|
|
|
|
<P>
|
|
Convert the given 64-bit integer (type
|
|
<B>int64</B>
|
|
|
|
) to a
|
|
32-bit integer (type
|
|
<B>int32</B>
|
|
|
|
). The 64-bit integer
|
|
is taken modulo 2^32, i.e. the top 32 bits are lost
|
|
during the conversion.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val of_nativeint </I>
|
|
|
|
:
|
|
<B>nativeint -> int64</B>
|
|
|
|
<P>
|
|
Convert the given native integer (type
|
|
<B>nativeint</B>
|
|
|
|
)
|
|
to a 64-bit integer (type
|
|
<B>int64</B>
|
|
|
|
).
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val to_nativeint </I>
|
|
|
|
:
|
|
<B>int64 -> nativeint</B>
|
|
|
|
<P>
|
|
Convert the given 64-bit integer (type
|
|
<B>int64</B>
|
|
|
|
) 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.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val of_string </I>
|
|
|
|
:
|
|
<B>string -> int64</B>
|
|
|
|
<P>
|
|
Convert the given string to a 64-bit integer.
|
|
The string is read in decimal (by default, or if the string
|
|
begins with
|
|
<B>0u</B>
|
|
|
|
) or in hexadecimal, octal or binary if the
|
|
string begins with
|
|
<B>0x</B>
|
|
|
|
,
|
|
<B>0o</B>
|
|
|
|
or
|
|
<B>0b</B>
|
|
|
|
respectively.
|
|
<P>
|
|
The
|
|
<B>0u</B>
|
|
|
|
prefix reads the input as an unsigned integer in the range
|
|
<B>[0, 2*Int64.max_int+1]</B>
|
|
|
|
. If the input exceeds
|
|
<B>Int64.max_int</B>
|
|
|
|
it is converted to the signed integer
|
|
<B>Int64.min_int + input - Int64.max_int - 1</B>
|
|
|
|
.
|
|
<P>
|
|
The
|
|
<B>_</B>
|
|
|
|
(underscore) character can appear anywhere in the string
|
|
and is ignored.
|
|
Raise
|
|
<B>Failure Int64.of_string</B>
|
|
|
|
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
|
|
<B>int64</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val of_string_opt </I>
|
|
|
|
:
|
|
<B>string -> int64 option</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>of_string</B>
|
|
|
|
, but return
|
|
<B>None</B>
|
|
|
|
instead of raising.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.05
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val to_string </I>
|
|
|
|
:
|
|
<B>int64 -> string</B>
|
|
|
|
<P>
|
|
Return the string representation of its argument, in decimal.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val bits_of_float </I>
|
|
|
|
:
|
|
<B>float -> int64</B>
|
|
|
|
<P>
|
|
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.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val float_of_bits </I>
|
|
|
|
:
|
|
<B>int64 -> float</B>
|
|
|
|
<P>
|
|
Return the floating-point number whose internal representation,
|
|
according to the IEEE 754 floating-point 'double format' bit layout,
|
|
is the given
|
|
<B>int64</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<I>type t </I>
|
|
|
|
=
|
|
<B>int64</B>
|
|
|
|
<P>
|
|
<P>
|
|
An alias for the type of 64-bit integers.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val compare </I>
|
|
|
|
:
|
|
<B>t -> t -> int</B>
|
|
|
|
<P>
|
|
The comparison function for 64-bit integers, with the same specification as
|
|
<B>compare</B>
|
|
|
|
. Along with the type
|
|
<B>t</B>
|
|
|
|
, this function
|
|
<B>compare</B>
|
|
|
|
allows the module
|
|
<B>Int64</B>
|
|
|
|
to be passed as argument to the functors
|
|
<B>Set.Make</B>
|
|
|
|
and
|
|
<B>Map.Make</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val unsigned_compare </I>
|
|
|
|
:
|
|
<B>t -> t -> int</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>Int64.compare</B>
|
|
|
|
, except that arguments are interpreted as unsigned
|
|
64-bit integers.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.08.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val equal </I>
|
|
|
|
:
|
|
<B>t -> t -> bool</B>
|
|
|
|
<P>
|
|
The equal function for int64s.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
4.03.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">Module</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">Documentation</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:46 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|