Static ReadonlyGREATEST_Bit 255, used as the negative sign bit in the 256-bit IFixed encoding.
Static ReadonlyNOT_A mask containing every bit below bit 255.
neg uses this value while flipping the IFixed sign bit.
Static ReadonlyONEThe exact IFixed representation of 1.0, 1000000000000000000n.
StaticabsRemoves the IFixed sign bit from a value's mathematical magnitude.
Values greater than or equal to GREATEST_BIT are treated as negative and
passed through neg; all other values are returned unchanged.
The IFixed value to inspect.
The non-negative magnitude under the IFixed convention.
StaticiConverts little-endian bytes to an IFixed bigint.
The method delegates to Casting.bigIntFromBytes, so the byte order is
little-endian and the input array is reversed in place. The resulting bigint
is not sign-decoded; bit 255 is interpreted only when another IFixed
method reads it.
The little-endian IFixed bytes.
The encoded IFixed bigint.
StaticiConverts a JavaScript number to an 18-decimal IFixed bigint.
The absolute value is multiplied by ONE and floored. Negative inputs then
receive the IFixed sign-bit encoding through neg. JavaScript number
precision applies before the floor.
The local number to encode.
The signed IFixed representation.
StaticiConverts decimal byte strings to an IFixed bigint.
Each string is first converted with Casting.bytesFromStringBytes, then the
resulting byte array follows the little-endian and mutation behavior of
iFixedFromBytes.
Decimal strings such as "255" and "0".
The encoded IFixed bigint.
StaticnegNegates an IFixed value in the sign-bit encoding.
The operation flips the lower 255 bits, adds one, and flips bit 255. It
returns 0n for 0n and is an involution for values represented by this
encoding.
The IFixed value to negate.
The negated IFixed value.
StaticnumberConverts an IFixed bigint to a JavaScript number.
The method reads bit 255 as the sign, divides the magnitude by ONE, and
adds the integer and fractional parts. The final number can lose precision
when the magnitude is larger than JavaScript can represent exactly.
The signed 18-decimal IFixed value.
The decoded local number.
StaticsignReturns the mathematical sign under the IFixed sign-bit convention.
Values greater than or equal to GREATEST_BIT return -1. Zero returns
0. All other values return 1.
The IFixed value to inspect.
-1, 0, or 1.
Provides conversions for signed 18-decimal IFixed values.
IFixed stores the magnitude in a bigint and uses bit
255as its negative sign bit. The class does not validate that inputs fit a particular serialized width; it applies this sign-bit convention to the supplied bigint.