AuthorWalter Bright
Sourcestd/int128.d
Int128;data;lo);longlo | signed lower 64 bits |
lo);ulonglo | unsigned lower 64 bits |
hi, longlo);longhi | upper 64 bits |
longlo | lower 64 bits |
data);Centdata | Cent data |
toHash() const;opEquals(longlo) const;longlo | signed value to compare with |
opEquals(ulonglo) const;ulonglo | unsigned value to compare with |
opEquals(Int128op2) const;Int128op2 | value to compare with |
opUnary(string op)() const| op | "+" |
opUnary(string op)() const| op | "-", "~" |
opUnary(string op)()| op | "++", "--" |
opCast(T : bool)() const;| T | bool |
opCast(T : long)() const| T | integral type |
const Int128 a = Int128(0xffff_ffff_ffff_ffffL, 0x0123_4567_89ab_cdefL);writeln(cast(long)a);// 0x0123_4567_89ab_cdefLwriteln(cast(int)a);// 0x89ab_cdefwriteln(cast(byte)a);// cast(byte)0xef
opCast(T : real)() const;| T | floating point type |
const Int128 a = Int128(-1L << 60);writeln(cast(double)a);// -(2.0^^60)writeln(cast(double)(a * a));// 2.0^^120
opBinary(string op)(Int128op2) constopBinary(string op, Int)(const Intop2) constopBinary(string op, IntLike)(auto ref IntLikeop2) constopBinaryRight(string op, Int)(const Intop2) constopBinaryRight(string op, IntLike)(auto ref IntLikeop2) constopBinary(string op)(longop2) constopBinary(string op)(longop2) constopBinary(string op)(longop2) const| op | one of the arithmetic binary operators |
Int128op2 | second operand |
opOpAssign(string op)(Int128op2)opOpAssign(string op, Int)(auto ref Intop2)| op | one of +, -, etc. |
Int128op2 | second operand |
opCmp(Int128op2) const;opCmp(Int)(const Intop2) constopCmp(IntLike)(auto ref IntLikeop2) constInt128op2 | right hand operand |
toString(Writer, FormatSpec)(ref scope Writersink, ref scope const FormatSpecfmt) const;Writersink | Output range to write to. |
FormatSpecfmt | Astd.format.FormatSpec which controls how the number is displayed. |
toString is rarely directly invoked; the usual way of using it is viastd.format.format:import std.format : format;writeln(format("%s", Int128.max));// "170141183460469231731687303715884105727"writeln(format("%s", Int128.min));// "-170141183460469231731687303715884105728"writeln(format("%x", Int128.max));// "7fffffffffffffffffffffffffffffff"writeln(format("%X", Int128.max));// "7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"writeln(format("%032X", Int128(123L)));// "0000000000000000000000000000007B"writeln(format("%+ 40d", Int128(123L)));// " +123"writeln(format("%+-40d", Int128(123L)));// "+123 "
import std.conv : to;writeln(to!wstring(Int128.max));// "170141183460469231731687303715884105727"wwriteln(to!dstring(Int128.max));// "170141183460469231731687303715884105727"d
min;max;