Expand description
§fastnum
Fixed-size signed and unsigned decimal numbers, implemented in pure Rust. Suitable for financial, crypto and any other fixed-precision calculations.
§Overview
fastnum
provides signed and unsigned exact precision decimal numbers suitable for financial calculations that
require significant integral and fractional digits with no round-off errors (such as 0.1 + 0.2 ≠ 0.3).
Any fastnum
decimal type consists of an N-bit big unsigned integer, paired with a 64-bit control block which
contains a 16-bit scaling factor determines the position of the decimal point, sign, special, and signaling flags.
Trailing zeros are preserved and may be exposed when in string form.
Thus, fastnum
decimal numbers are trivially copyable and don’t require any dynamic allocation.
This allows you to get additional performance gains by eliminating not only dynamic allocation, like such, but also will
get rid of one indirect addressing, which improves cache-friendliness and reduces the CPU load.
§Why fastnum?
- Strictly exact precision: no round-off errors (such as 0.1 + 0.2 ≠ 0.3).
- Special values:
fastnum
support±0
,±Infinity
andNaN
special values with IEEE 754 semantic. - Blazing fast:
fastnum
numerics are as fast as native types, well almost :). - Trivially copyable types: all
fastnum
numerics are trivially copyable (both integer and decimal, ether signed and unsigned) and can be stored on the stack, as they’re fixed size. - No dynamic allocation: no expensive sys-call’s, no indirect addressing, cache-friendly.
- Compile-time integer and decimal parsing: all the
from_*
methods onfastnum
integers and decimals areconst
, which allows parsing of integers and numerics from string slices and floats at compile time. Additionally, the string to be parsed does not have to be a literal: it could, for example, be obtained viainclude_str!
, orenv!
. - Const-evaluated in compile time macro-helpers: any type has its own macro helper which can be used for definitions of constants or variables whose value is known in advance. This allows you to perform all the necessary checks at the compile time.
- Short dependencies list by default:
fastnum
depends only uponbnum
by default. All other dependencies are optional. Support for crates such asrand
andserde
can be enabled with crate features. no-std
compatible:fastnum
can be used inno_std
environments.const
evaluation: nearly all methods defined onfastnum
integers and decimals areconst
, which allows complex compile-time calculations and checks.- Full range of advanced mathematical functions: exponential, roots, power, logarithmic, and trigonometric functions
for working with exact precision decimals.
And yes, they’re all
const
too.
§Installation
To install and use fastnum
, add the following line to your Cargo.toml
file in the [dependencies]
section:
fastnum = "0.2"
Or, to enable various fastnum
features as well, add for example this line instead:
fastnum = { version = "0.2", features = ["serde"] } # enables the "serde" feature
§Example usage
use fastnum::{udec256, UD256};
let a = udec256!(0.1);
let b = udec256!(0.2);
assert_eq!(a + b, udec256!(0.3));
§Const-evaluated in compile time macro-helpers
Any type has its own macro helper which can be used for definitions of constants or variables whose value is known in advance. This allows you to perform all the necessary checks at the compile time.
Decimal type | Integer part | Bits | Signed | Helper macro |
---|---|---|---|---|
D128 | U128 | 128 | ✅ | dec128!(0.1) |
UD128 | U128 | 128 | udec128!(0.1) | |
D256 | U256 | 256 | ✅ | dec256!(0.1) |
UD256 | U256 | 256 | udec256!(0.1) | |
D512 | U512 | 512 | ✅ | dec512!(0.1) |
UD512 | U512 | 512 | udec512!(0.1) |
§Examples
Basic usage:
use fastnum::*;
// This value will be evaluated at compile-time and inlined directly into the relevant context when used.
const PI: UD256 = udec256!(3.141592653589793115997963468544185161590576171875);
Compile-time calculations:
use fastnum::*;
// This value will be evaluated at compile-time and inlined directly into the relevant context when used.
const PI_X_2: UD256 = udec256!(2).mul(udec256!(3.141592653589793115997963468544185161590576171875));
Compile-time checks
use fastnum::*;
// Invalid character.
const E: UD256 = udec256!(A3.5);
use fastnum::*;
// Arithmetic error during calculation.
const E: UD256 = udec256!(1.5).div(udec256!(0));
§Representation
§Abstract model
Numbers represent the values which can be manipulated by, or be the results of. Numbers may be finite numbers (numbers whose value can be represented exactly), or they may be special values (infinities and other values which aren’t finite numbers).
§Finite numbers
The numerical value of a finite number is given by: (–1)sign × coefficient × 10exponent.
- sign – a value which must be either
0
or1
, where1
indicates that the number is negative or is the negative zero and0
indicates that the number is zero or positive. - coefficient – an unsigned integer which is zero or positive.
- exponent – a signed integer which indicates the power of ten by which the coefficient is multiplied.
For example, if the sign had the value 1
, the exponent had the value –1
, and the coefficient had the value 25
,
then the numerical value of the number is exactly –2.5
.
Trailing zeros are preserved and may be exposed when in string form. These can be truncated using the normalize or round functions.
A number with a coefficient of 0
is permitted to have both +
and -
sign.
Negative zero is accepted as an operand for all operations (see IEEE 754).
The quantum of a finite number is given by: 1 × 10-exp. This is the value of a unit in the least significant position of the coefficient of a finite number.
This abstract definition deliberately allows for multiple representations of values which are numerically equal but are
visually distinct (such as 1
and 1.00
).
However, there is a one-to-one mapping between the abstract representation and the result of the primary conversion to
string using to-scientific-string on that abstract representation.
In other words, if one number has a different abstract representation to another, then the primary string conversion
will also be different.
§Exponent
The exponent is represented by a two’s complement 16-bit binary integer.
The adjusted exponent is the value of the decimal number exponent when that number is expressed as though in
scientific notation with one digit (non-zero unless the coefficient is 0
) before any decimal point.
This is given by the value of the exponent + (Clength – 1), where Clength is the length of the
coefficient in decimal digits.
When a limit to the exponent Elimit applies, it must result in a balanced range of positive or negative
numbers, taking into account the magnitude of the coefficient.
To achieve this balanced range, the minimum and maximum values of the adjusted exponent (Emin and E
max respectively) must have magnitudes which differ by no more than one, so Emin will be –E
max ±1.
IEEE 754 further constrains this so that Emin = 1 – Emax.
Therefore, if the length of the coefficient is Clength digits, the exponent may take any of the values
-Elimit – (Clength – 1) + 1 through Elimit – (Clength – 1).
§Special values
In addition to the finite numbers, numbers must also be able to represent one of three named special values:
§NaN
Special value called “Not a Number” (NaN
) to be returned as the result of certain “invalid” operations, such as
0 / 0
, ∞ × 0
, or sqrt(−1)
.
In general, NaN
s will be propagated: most operations involving a NaN
will result in a NaN
.
There are two kinds of NaN
:
quiet NaN
– a value representing undefined results (Not a Number) which doesn’t cause anInvalid operation
condition.signaling NaN
– a value representing undefined results (Not a Number) which will usually cause an Invalid operation condition if used in any operation defined in this specification (see IEEE 754 §3.2 and §6.2).
Signaling NaN
could be used by a runtime system to flag uninitialized variables, or extend the decimal numbers
with other special values without slowing down the computations with ordinary values, although such extensions aren’t
common.
§Infinity
±Infinity
– a value representing a number whose magnitude is infinitely large (see IEEE 754 §3.2 and §6.1).
When a number has one of these special values, its coefficient and exponent are undefined.
All special values may have a sign, as for finite numbers.
The sign of an Infinity
is significant (that is, it is possible to have both positive and negative infinity),
and the sign of a NaN
has no meaning.
§Signed zero
Signed zero (±0
) is zero with an associated sign.
In ordinary arithmetic, the number 0
does not have a sign, so that −0
, +0
and 0
are equivalent.
However, in computing, some number representations allow for the existence of two zeros, often denoted by −0
(negative
zero) and +0
(positive zero), regarded as equal by the numerical comparison operations but with possible different
behaviors in particular operations.
Real arithmetic with signed zeros can be considered a variant of the extended real number line such that 1/−0 = −∞
and
1/+0 = +∞
.
Division is undefined only for ±0/±0
and ±∞/±∞
.
Negatively signed zero echoes the mathematical analysis concept of approaching 0
from below as a one-sided limit,
which may be denoted by x → 0−
, x → +0
. The notation −0
may be used informally to denote a negative number that
has been rounded to zero. The concept of negative zero also has some theoretical applications in statistical mechanics
and other disciplines.
More about Signed Zero.
§Normal numbers, subnormal numbers, and Underflow
In any context where exponents are bounded, most finite numbers are normal.
Non-zero finite numbers whose adjusted exponents are greater than or equal to Emin are called normal
numbers.
Those non-zero numbers whose adjusted exponents are less than Emin are called subnormal numbers.
Like other numbers, subnormal numbers are accepted as operands for all operations and may result from any operation.
If a result is subnormal, before any rounding, then the Subnormal
exception condition is raised.
For a subnormal result, the minimum value of the exponent becomes Emin – (precision – 1), called E
tiny, where precision is the working precision, as described below.
The result will be rounded, if necessary, to ensure that the exponent is no smaller than Etiny.
If, during this rounding, the result becomes inexact, then the Underflow
condition is raised.
A subnormal result doesn’t necessarily raise Underflow, therefore, but is always indicated by the Subnormal
condition (even if, after rounding, its value is 0
or ten to the power of Emin).
When a number “underflows” to zero during a calculation, its exponent will be Etiny. The maximum value of the exponent is unaffected.
The minimum value of the exponent for subnormal numbers is the same as the minimum value of exponent, which can arise during operations which don’t result in subnormal numbers, which occurs in the case where Clength = precision.
§Memory layout
Under the hood any N-bit decimal type consists of an N-bit big unsigned integer (coefficient), paired with a 64-bit control block which consists of the following components:
- a signed 16-bit integer scaling factor (negotiated exponent),
- decimal number flags (include sign and special value flags),
- signaling flags for Exceptional conditions,
- decimal Context includes rounding mode and signals traps,
- Extra precision digits.
--- title: D256 decimal memory layout (bytes) config: theme: 'forest' packet: bitsPerRow: 40 bitWidth: 18 --- packet-beta 0-31: "coefficient (U256)" 32-39: "control block"
--- title: Control block memory layout (bits) config: theme: 'forest' packet: bitsPerRow: 64 bitWidth: 10 --- packet-beta 0-15: "exp" 16-18: "flags" 19-26: "signals" 27-39: "context" 40-63: "extra precision"
§Signaling flags and trap-enablers
The exceptional conditions, which may arise during performing arithmetic operations on decimal numbers, are grouped into signals, which can be controlled individually.
Signaling flags are very similar to the processor flag register and
contain information about arithmetic errors such as operation overflow, division by 0
, or loss of precision
calculations.
Depending on the needs of the application, flags may be ignored, considered as informational, or cause panic!
.
The signals are:
Signal | Description |
---|---|
CLAMPED | The exponent of a result has been altered. |
DIVISION_BY_ZERO | Non-zero dividend is divided by zero. |
INEXACT | Result is not exact (one or more non-zero coefficient digits were discarded during rounding). |
INVALID_OPERATION | Invalid operation. Result would be undefined or impossible. |
OVERFLOW | Indicates that exponent of the decimal result is too large to fit the target type. |
ROUNDED | Result has been rounded (that is, some zero or non-zero coefficient digits were discarded). |
SUBNORMAL | Result is subnormal (its adjusted exponent is less than Emin), before any rounding. |
UNDERFLOW | Result is both subnormal and inexact. |
For each of the signals, the corresponding flag in signals block is set to 1
when the signal occurs.
For each of the signals, the corresponding Context trap-enabler indicates which action is to be taken when the
signal occurs (see IEEE 754 §7).
If 0
, a defined result is supplied, and execution continues (for example, an overflow is perhaps converted to a
positive or negative infinity). If 1
, then execution of the operation cause panic!
.
§Clamped
This occurs and signals clamped if the exponent of a result has been altered in order to fit the constraints of the
underlying i16
integer type.
This may occur when the exponent of a zero result would be outside the bounds of a representation, or (in the IEEE 754
interchange formats) when a large normal number would have an encoded exponent that can’t be represented.
In this latter case, the exponent is reduced to fit and the corresponding number of zero digits are appended to the
coefficient (“fold-down”).
The condition always occurs when a subnormal value rounds to zero.
use fastnum::{decimal::*, *};
let res = dec256!(1E-10) + dec256!(1E-100);
assert_eq!(res, dec256!(1E-10));
assert!(res.is_op_inexact());
assert!(res.is_op_rounded());
assert!(res.is_op_clamped());
§Division by zero
This occurs and signals division-by-zero if division of a finite number by zero was attempted, and the dividend wasn’t
zero.
The result of the operation is ±Infinity
, where sign is the exclusive or of the signs of the operands for divide, or
is 1
for an odd power of -0
, for power.
use fastnum::{decimal::*, *};
let ctx = Context::default().with_signal_traps(SignalsTraps::empty());
let res = dec256!(1).with_ctx(ctx) / dec256!(0).with_ctx(ctx);
assert!(res.is_infinite());
assert!(res.is_op_div_by_zero());
§Inexact
This occurs and signals inexact whenever the result of an operation is not exact (that is, it needed to be rounded, and any discarded digits were non-zero), or if an overflow or underflow condition occurs. The result in all cases is unchanged.
For example, 1/3 = 0.333333333333(3)
. The result of division is an infinite decimal fraction that can’t
be stored in any of the existing types: performing the operation will cause overflow for any finite count of
decimal digits.
However, the result can be obtained if we make a deal and agree to the loss of precision.
In this case, the result will be the rounded value, accompanied by information that rounding has been performed and
the result may not be exact.
Result | Rounded (HalfUp) | Rounded (Down) | Inexact | |
---|---|---|---|---|
6 / 3 | 2 | 2 | 2 | |
1 / 3 | 0.333333333333(3) | 0.333333333333 | 0.333333333333 | ⁉️ |
2 / 3 | 0.666666666666(6) | 0.666666666667 | 0.666666666666 | ⁉️ |
For most practical purposes this is an acceptable trade-off. However, we always leave the possibility to be sure that the result is strictly exact and there was no loss of precision.
use fastnum::{decimal::*, *};
let res = dec128!(1) / dec128!(3);
assert_eq!(res, dec128!(0.333333333333333333333333333333333333333));
assert!(res.is_op_inexact());
§Invalid operation
This occurs and signals invalid-operation if:
- an operand to an operation is
NaN
. - an attempt is made to add
+Infinity
to-Infinity
during an addition or subtraction operation. - an attempt is made to multiply
0
by±Infinity
. - an attempt is made to divide either
+Infinity
or-Infinity
by either+Infinity
or-Infinity
. - the divisor for a remainder operation is zero.
- the dividend for a remainder operation is
±Infinity
. - either operand of the quantize operation is infinite.
- the operand of any logarithm function is less than zero.
- the operand of the square-root operation has a negative sign and a non-zero coefficient.
- both operands of the power operation are zero, or if the first operand is less than zero and the second operand doesn’t have an integral value or is infinite.
use fastnum::{decimal::*, *};
let ctx = Context::default().with_signal_traps(SignalsTraps::empty());
let res = D128::INFINITY.with_ctx(ctx) - D128::INFINITY.with_ctx(ctx);
assert!(res.is_nan());
assert!(res.is_op_invalid());
§Overflow
This occurs, and signals overflow if the adjusted exponent of a result (from a conversion or from an operation that is not an attempt to divide by zero), after rounding, would be greater than the largest value that can be handled by the implementation (the value Emax).
The result depends on the rounding mode:
- For round-half-up and round-half-even (and for round-half-down and round-up), the result of the operation is
±Infinity
, where sign is the sign of the intermediate result. - For round-down the result is the largest finite number that can be represented in the current precision, with the sign of the intermediate result.
- For round-ceiling, the result is the same as for round-down if the sign of the intermediate result is
-
, or isInfinity
otherwise. - For round-floor, the result is the same as for round-down if the sign of the intermediate result is
+
, or is-Infinity
otherwise.
In all cases, Inexact
and Rounded
will also be raised.
use fastnum::{decimal::*, *};
let ctx = Context::default().with_signal_traps(SignalsTraps::empty());
let res = D128::MAX.with_ctx(ctx) * D128::MAX.with_ctx(ctx);
assert!(res.is_infinite());
assert!(res.is_op_overflow());
assert!(res.is_op_rounded());
assert!(res.is_op_inexact());
§Rounded
This occurs and signals rounded whenever the result of an operation is rounded (that is, some zero or non-zero digits were discarded from the coefficient), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The rounded signal may be tested (or trapped) to determine if a given operation (or sequence of operations) caused a loss of precision.
use fastnum::{decimal::*, *};
let res = D128::MAX * dec128!(1.0);
assert_eq!(res, D128::MAX);
assert!(res.is_op_rounded());
§Subnormal
This occurs and signals subnormal whenever the result of a conversion or operation is subnormal (that is, its adjusted exponent is less than Emin, before any rounding). The result in all cases is unchanged. The subnormal signal may be tested (or trapped) to determine if a given or operation (or sequence of operations) yielded a subnormal result.
use fastnum::{decimal::*, *};
let ctx = Context::default().with_signal_traps(SignalsTraps::empty());
let res = dec128!(1E-30000).with_ctx(ctx) / dec128!(1E2768).with_ctx(ctx);
assert!(res.is_op_subnormal());
§Underflow
This occurs and signals underflow if a result is inexact and the adjusted exponent of the result would be smaller (more
negative) than the smallest value that can be handled by the implementation (the value Emin).
That is, the result is both inexact and subnormal.
The result after an underflow will be a subnormal number rounded, if necessary, so that its exponent is not less than
Etiny.
This may result in 0
with the sign of the intermediate result and an exponent of Etiny.
In all cases, Inexact
, Rounded
, and Subnormal
will also be raised.
use fastnum::{decimal::*, *};
let ctx = Context::default().with_signal_traps(SignalsTraps::empty());
let res = dec128!(1e-32767).with_ctx(ctx) / D128::MAX.with_ctx(ctx);
assert!(res.is_op_underflow());
assert!(res.is_op_inexact());
assert!(res.is_op_rounded());
assert!(res.is_op_subnormal());
§Precision
Precision is an integral number of decimal digits. It is limited by the maximum decimal digits that N-bit unsigned coefficient can hold.
§Arithmetic
The fastnum
crate provides support for fast correctly rounded decimal floating-point arithmetic. It offers several
advantages over the native floating-point (IEEE 754) types:
§Exact precision
fastnum
decimals provide an arithmetic that works in the same way as the arithmetic that people learn
at school. Decimal numbers can be represented exactly. In contrast, numbers like 1.1
and 2.2
do not have exact
representations in binary floating point. End users typically would not expect 1.1 + 2.2
to display as
3.3000000000000003
as it does with binary floating point.
Floats:
let n: f64 = 1.1 + 2.2;
assert_eq!(n.to_string(), "3.3000000000000003");
Decimals:
use fastnum::udec256;
let n = udec256!(1.1) + udec256!(2.2);
assert_eq!(n.to_string(), "3.3");
The exactness carries over into arithmetic. In decimal floating point, 0.1 + 0.1 + 0.1 - 0.3
is exactly equal to zero.
In binary floating point, the result is 5.5511151231257827e-017
. While near to zero, the differences prevent reliable
equality testing and differences can accumulate. For this reason, decimal is preferred in accounting applications which
have strict equality invariants.
Floats:
let n: f64 = 0.1 + 0.1 + 0.1 - 0.3;
assert_eq!(n.to_string(), "0.00000000000000005551115123125783");
Decimals:
use fastnum::udec256;
let n = udec256!(0.1) + udec256!(0.1) + udec256!(0.1) - udec256!(0.3);
assert_eq!(n.to_string(), "0.0");
assert!(n.is_zero());
§Fixed precision
fastnum
incorporates a notion of significant places so that 1.30 + 1.20
is 2.50
. The trailing zero is kept
to indicate significance. This is the customary presentation for monetary applications. For multiplication, the
“schoolbook” approach uses all the figures in the multiplicands. For instance, 1.3 * 1.2
gives 1.56
while
1.30 * 1.20
gives 1.5600
.
Decimals:
use fastnum::udec256;
let n = udec256!(1.30) + udec256!(1.20);
assert_eq!(n, udec256!(2.50));
let n = udec256!(1.3) * udec256!(1.2);
assert_eq!(n, udec256!(1.56));
let n = udec256!(1.30) * udec256!(1.20);
assert_eq!(n, udec256!(1.5600));
More about decimal arithmetic: IBM’s General Decimal Arithmetic Specification.
§Arithmetic rules
The following general rules apply to all arithmetic operations except where stated below.
-
Every operation on finite numbers is carried out as though an exact mathematical result is computed, using integer arithmetic on the coefficient (or significant decimal digits) where possible.
If the coefficient of the theoretical exact result has no more than precision digits, then (unless there is an underflow or overflow) it is used for the result without change. Otherwise (it has more than precision digits) it is rounded (shortened) to exactly precision digits, using the current rounding algorithm, and the exponent is increased by the number of digits removed.
If the value of the adjusted exponent of the result is less than Emin (that is, the result is zero or subnormal), the calculated coefficient and exponent form the result, unless the value of the exponent is less than Etiny, in which case the exponent will be set to Etiny, the coefficient will be rounded (if necessary, and possibly to zero) to match the adjustment of the exponent, and the sign is unchanged.
If the result (before rounding) was non-zero and subnormal then the
Subnormal
exceptional condition is raised. If rounding of a subnormal result leads to an inexact result then theUnderflow
exceptional condition is also raised.If the value of the adjusted exponent of a non-zero result is larger than Emax, then an exceptional condition (overflow) results. In this case, the result is as defined under the
Overflow
exceptional condition, and may be infinite. It will have the same sign as the theoretical result. -
Arithmetic using the special value
±Infinity
follows the usual rules, where-Infinity
is less than every finite number and+Infinity
is greater than every finite number. Under these rules, an infinite result is always exact. Certain uses of infinity raise anInvalid operation
condition. -
The result of any arithmetic operation that has an operand which is a
NaN
(a quietNaN
or a signalingNaN
) is alwaysNaN
. The sign and any diagnostic information is copied from the first operand which is a signalingNaN
, or if neither is signaling then from the first operand which is aNaN
. Whenever a result is aNaN
, the sign of the result depends only on the copied operand (the following rules don’t apply). -
The
Invalid operation
condition may be raised when an operand to an operation is invalid (for example, if it exceeds the bounds that an implementation can handle, or the operation is a logarithm and the operand is negative). -
The sign of the multiplication or division result will be
-
only if the operands have different signs. -
The sign of the addition or subtraction result will be 1 only if the result is less than zero, except for the special cases below where the result is a negative
0
. -
A result which is a negative zero (
-0
) can occur only when:- a result is rounded to zero, and the value before rounding had a sign of
-
. - the operation is an addition of
-0
to+0
, or a subtraction of+0
from-0
. - the operation is an addition of operands with opposite signs (or is a subtraction of operands with the same sign),
the result has a coefficient of
0
, and the rounding is round-floor. - the operation is a multiplication or division, and the result has a coefficient of
0
and the signs of the operands are different. - the operation is
power
, the first operand is-0
, and the second operand is positive, integral, and odd. - the operation is
power
, the first operand is-Infinity
, and the second operand is negative, integral, and odd. - the operation is
quantize
or around-to-integral
, the first operand is negative, and the magnitude of the result is zero. In either case the final exponent may be non-zero. - the operation is
square-root
and the operand is-0
. - the operation is one of the operations
max
,max-magnitude
,min
,min-magnitude
,next-plus
,next-toward
,reduce
, or is a copy operation.
- a result is rounded to zero, and the value before rounding had a sign of
§Examples involving special values:
use fastnum::{*, decimal::*};
let ctx = Context::default().without_traps();
assert_eq!(D256::INFINITY + dec256!(1), D256::INFINITY);
assert!((D256::NAN.with_ctx(ctx) + dec256!(1).with_ctx(ctx)).is_nan());
assert!((D256::NAN.with_ctx(ctx) + D256::INFINITY.with_ctx(ctx)).is_nan());
assert_eq!(dec256!(1) - D256::INFINITY, D256::NEG_INFINITY);
assert_eq!(dec256!(-1) - D256::INFINITY, D256::NEG_INFINITY);
assert_eq!(dec256!(-0) - dec256!(+0), dec256!(-0));
assert_eq!(dec256!(-1) * dec256!(0), dec256!(-0));
assert_eq!(dec256!(1).with_ctx(ctx) / dec256!(0).with_ctx(ctx), D256::INFINITY);
assert_eq!(dec256!(1).with_ctx(ctx) / dec256!(-0).with_ctx(ctx), D256::NEG_INFINITY);
§Notes:
-
Operands may have more than precision digits and aren’t rounded before use.
-
The Context defines the rules for unwrapping the result of an arithmetic operation containing Exceptional conditions.
-
If a result is rounded, remains finite, and is not subnormal, its coefficient will have exactly precision digits (except after the
quantize
orround-to-integral
operations, as described below). That is, only unrounded or subnormal coefficients can have fewer than precision digits. -
Trailing zeros aren’t removed after operations. The reduce operation may be used to remove trailing zeros if desired.
§Arithmetic operations
All arithmetic operations over decimals are exact.
Operation | Rust operator | Unsigned | Signed |
---|---|---|---|
abs | ➖ | ➖ | abs , unsigned_abs |
add | a + b , a += b | add | add |
subtract | a - b , a -= b | sub | sub |
multiply | a * b , a *= b | mul | mul |
divide | a / b , a /= b | div | div |
remainder | a % b , a %= b | rem | rem |
negation | -a | neg | neg |
powi | ➖ | pow | powi |
§Abs
The absolute value or modulus of a decimal number, denoted, is the non-negative value of without regard to its sign.
The unsigned_abs
method returns
UnsignedDecimal
.
§Examples:
use fastnum::*;
assert_eq!(dec256!(1.3).abs(), dec256!(1.3));
assert_eq!(dec256!(-1.3).abs(), dec256!(1.3));
assert_eq!(dec256!(-1.3).unsigned_abs(), udec256!(1.3));
§Addition and subtraction
add(self, other)
| sub(self, other)
If either operand is a special value then the general rules apply. Otherwise, the operands are added (after inverting the sign used for the second operand if the operation is a subtraction), as follows:
- The coefficient of the result is computed by adding or subtracting the aligned coefficients of the two operands. The
aligned coefficients are computed by comparing the exponents of the operands:
- If they have the same exponent, the aligned coefficients are the same as the original coefficients.
- Otherwise, the aligned coefficient of the number with the larger exponent is its original coefficient multiplied by 10n, where n is the absolute difference between the exponents, and the aligned coefficient of the other operand is the same as its original coefficient.
- If the signs of the operands differ, then the smaller aligned coefficient is subtracted from the larger; otherwise they’re added.
- The exponent of the result is the minimum of the exponents of the two operands.
- The sign of the result is determined as follows:
- If the result is non-zero, then the sign of the result is the sign of the operand having the larger absolute value.
- Otherwise, the sign of a zero result is
0
unless either both operands were negative or the signs of the operands were different and the rounding is round-floor.
§Examples:
use fastnum::{udec256, dec256};
assert_eq!(udec256!(12) + udec256!(7.00), udec256!(19.00));
assert_eq!(udec256!(1E+2) + udec256!(1E+4), udec256!(1.01E+4));
assert_eq!(udec256!(1.3) - udec256!(1.07), udec256!(0.23));
assert_eq!(udec256!(1.3) - udec256!(1.30), udec256!(0.00));
assert_eq!(dec256!(1.3) - dec256!(2.07), dec256!(-0.77));
§Division
If either operand is a special value then the general rules apply.
Otherwise, if the divisor is zero then the Division by zero
condition is raised and the result is an Infinity
with a sign which is the exclusive or of the signs of the operands.
Otherwise, a long division is performed, as follows:
-
An integer variable, adjust, is initialized to
0
. -
If the dividend is non-zero, the coefficient of the result is computed as follows (using working copies of the operand coefficients, as necessary):
- The operand coefficients are adjusted so that the coefficient of the dividend is greater than or equal to the
coefficient of the divisor and is also less than ten times the coefficient of the divisor, thus:
- While the coefficient of the dividend is less than the coefficient of the divisor, it is multiplied by
10
and adjust is incremented by1
. - While the coefficient of the dividend is greater than or equal to ten times the coefficient of the divisor
the coefficient of the divisor is multiplied by
10
and adjust is decremented by1
.
- While the coefficient of the dividend is less than the coefficient of the divisor, it is multiplied by
- The result coefficient is initialized to
0
. - The following steps are then repeated until the division is complete:
- While the coefficient of the divisor is smaller than or equal to the coefficient of the dividend the former
is subtracted from the latter and the coefficient of the result is incremented by
1
. - If the coefficient of the dividend is now
0
and adjust is greater than or equal to0
, or if the coefficient of the result has precision digits, the division is complete. Otherwise, the coefficients of the result and the dividend are multiplied by10
and adjust is incremented by1
.
- While the coefficient of the divisor is smaller than or equal to the coefficient of the dividend the former
is subtracted from the latter and the coefficient of the result is incremented by
- Any remainder (the final coefficient of the dividend) is recorded and taken into account for rounding.
Otherwise (the dividend is zero), the coefficient of the result is zero and adjust is unchanged (is
0
). - The operand coefficients are adjusted so that the coefficient of the dividend is greater than or equal to the
coefficient of the divisor and is also less than ten times the coefficient of the divisor, thus:
-
The exponent of the result is computed by subtracting the sum of the original exponent of the divisor and the value of adjust at the end of the coefficient calculation from the original exponent of the dividend.
-
The sign of the result is the exclusive or of the signs of the operands.
§Examples:
use fastnum::*;
assert_eq!(dec128!(1) / dec128!(3), dec128!(0.333333333333333333333333333333333333333));
assert_eq!(dec128!(2) / dec128!(3), dec128!(0.66666666666666666666666666666666666667));
assert_eq!(dec128!(5) / dec128!(2), dec128!(2.5));
assert_eq!(dec128!(1) / dec128!(10), dec128!(0.1));
assert_eq!(dec128!(12) / dec128!(12), dec128!(1));
assert_eq!(dec128!(8.00) / dec128!(2), dec128!(4.00));
assert_eq!(dec128!(2.400) / dec128!(2.0), dec128!(1.20));
assert_eq!(dec128!(1000) / dec128!(100), dec128!(10));
assert_eq!(dec128!(1000) / dec128!(1), dec128!(1000));
assert_eq!(dec128!(2.40E+6) / dec128!(2), dec128!(1.20E+6));
Note that the results as described above can alternatively be expressed as follows: The ideal (simplest) exponent for the result of a division is the exponent of the dividend less the exponent of the divisor.
After the division, if the result is exact, then the coefficient and exponent giving the correct value and with the exponent closest to the ideal exponent is returned. If the result is inexact, the coefficient will have exactly precision digits (unless the result is subnormal), and the exponent will be set appropriately.
§Multiplication
If either operand is a special value then the general rules apply. Otherwise, the operands are multiplied together (long multiplication), resulting in a number which may be as long as the sum of the lengths of the two operands, as follows:
- The coefficient of the result, before rounding, is computed by multiplying together the coefficients of the operands.
- The exponent of the result, before rounding, is the sum of the exponents of the two operands.
- The sign of the result is the exclusive or of the signs of the operands.
The result is then rounded to precision digits if necessary, counting from the most significant digit of the result.
§Examples:
use fastnum::*;
assert_eq!(dec128!(1.20) * dec128!(3), dec128!(3.60));
assert_eq!(dec128!(7) * dec128!(3), dec128!(21));
assert_eq!(dec128!(0.9) * dec128!(0.8), dec128!(0.72));
assert_eq!(dec128!(0.9) * dec128!(-0), dec128!(-0.0));
assert_eq!(dec128!(654321) * dec128!(654321), dec128!(4.28135971041E+11));
§Fused multiply-add
Operation takes three operands.
The first two are multiplied together, using multiplication,
with sufficient precision and exponent range that the result is exact and unrounded.
No flags are set by the multiplication unless one of the first two operands is a signaling NaN
, or one is a zero and
the other is an Infinity
.
Unless the multiplication failed, the third operand is then added to the result of that multiplication, using add, under
the current context.
In other words, mul_add(x, y, z)
delivers a result which is (x × y) + z
with only the one, final, rounding.
§Examples:
use fastnum::*;
assert_eq!(dec128!(1.0).mul_add(dec128!(2), dec128!(0.5)), dec128!(2.5));
§Remainder
rem(self, other)
| rem(self, other)
Remainder takes two operands; it returns the remainder from integer division. If either operand is a special value then the general rules apply.
Otherwise, the result is the residue of the dividend after the operation of calculating integer division, rounded to precision digits if necessary. The sign of the result, if non-zero, is the same as that of the original dividend.
§Examples:
use fastnum::*;
assert_eq!(dec128!(2.1) % dec128!(3), dec128!(2.1));
assert_eq!(dec128!(10) % dec128!(3), dec128!(1));
assert_eq!(dec128!(10) % dec128!(6), dec128!(4));
assert_eq!(dec128!(-10) % dec128!(3), dec128!(-1));
assert_eq!(dec128!(10.2) % dec128!(1), dec128!(0.2));
assert_eq!(dec128!(10) % dec128!(0.3), dec128!(0.1));
assert_eq!(dec128!(3.6) % dec128!(1.3), dec128!(1.0));
Notes:
- The divide-integer and remainder operations are defined so that they may be calculated as a by-product of the standard division operation (described above). The division process is ended as soon as the integer result is available; the residue of the dividend is the remainder.
- The sign of the result will always be a sign of the dividend.
- The remainder operation differs from the remainder operation defined in IEEE 754 (the remainder-near operator), in
that it gives the same results for numbers, whose values are equal to integers as would the usual remainder operator
on integers.
For example, the result of the operation remainder(
10
,6
) as defined here is4
, and remainder(10.0
,6
) would give4.0
(as would remainder(10
,6.0
) or remainder(10.0
,6.0
)). The IEEE 754 remainder operation would, however, give the result-2
because its integer division step chooses the closest integer, not the one nearer zero.
§Power
If either operand is a special value then the general rules apply.
The following rules apply:
- If both operands are zero, or if the first operand is less than zero and the second operand doesn’t have an
integral value or is infinite, an [‘Invalid operation’] condition is raised, the result is
NaN
, and the following rules don’t apply. - If the first operand is infinite, the result will be exact and will be
Infinity
if the second operand is positive,1
if the second operand is a zero, and0
if the second operand is negative.
- If the first operand is a zero, the result will be exact and will be
Infinity
if the second is negative or0
if the second is positive.
- If the second operand is a zero, the result will be
1
and exact. - In cases not covered above, the result will be inexact unless the second operator has an integral value and the result is finite and can be expressed exactly within precision digits. In this latter case, if the result is unrounded, then its exponent will be that which would result if the operation were calculated by repeated multiplication (if the second operand is negative then the reciprocal of the first operand is used, with the absolute value of the second operand determining the multiplications).
- Inexact finite results should be correctly rounded but may be up to 1 ulp (unit in last place) in error.
- The sign of the result will be
-
only if the second operand has an integral value and is odd (and is not infinite) and also the sign of the first operand is-
. In all other cases, the sign of the result will be0
.
§Notes:
- When the result is inexact, the cost of power at a given precision is likely to be at least twice as expensive as the exp function (see notes under that function).
- An infinite result is always exact, as described in the general rules.
powi()
is simpler power operation which only required support for integer powers.- It can be argued that the special cases where one operand is zero and the other is
infinite (such as power(
0
,Infinity
) and power(Infinity
,0
)) should return aNaN
, whereas the specification above leads to results of0
and1
respectively for the two examples. IfNaN
results are desired instead, then these special cases should be tested for before calling the power operation.
§Examples:
use fastnum::*;
assert_eq!(dec256!(2).powi(3), dec256!(8));
assert_eq!(dec256!(-2).powi(3), dec256!(-8));
assert_eq!(dec256!(9).powi(2), dec256!(81));
assert_eq!(dec256!(1).powi(-2), dec256!(1));
assert_eq!(dec256!(10).powi(20), dec256!(1e20));
assert_eq!(dec256!(4).powi(-2), dec256!(0.0625));
assert_eq!(dec256!(2).powi(-3), dec256!(0.125));
assert_eq!(D256::INFINITY.powi(-1), dec256!(0));
assert_eq!(D256::INFINITY.powi(0), dec256!(1));
assert_eq!(D256::INFINITY.powi(1), D256::INFINITY);
assert_eq!(D256::NEG_INFINITY.powi(-1), dec256!(-0));
assert_eq!(D256::NEG_INFINITY.powi(0), dec256!(1));
assert_eq!(D256::NEG_INFINITY.powi(1), D256::NEG_INFINITY);
assert_eq!(D256::NEG_INFINITY.powi(2), D256::INFINITY);
§Square root
If the operand is a special value then the general rules apply.
Otherwise, the ideal exponent of the result is defined to be half the exponent of the operand (rounded to an integer,
towards [–Infinity
], if necessary) and then:
- If the operand is less than zero, an [‘Invalid operation’] condition is raised.
- If the operand is greater than zero, the result is the square root of the operand.
- Otherwise (the operand is equal to zero), the result will be the zero with the same sign as the operand and with the ideal exponent.
§Examples:
use fastnum::*;
assert_eq!(dec128!(0).sqrt(), dec128!(0));
assert_eq!(dec128!(-0).sqrt(), dec128!(-0));
assert_eq!(dec128!(0.39).sqrt(), dec128!(0.62449979983983982058468931209397944611));
assert_eq!(dec128!(4).sqrt(), dec128!(2));
assert_eq!(dec128!(100).sqrt(), dec128!(10));
assert_eq!(dec128!(1).sqrt(), dec128!(1));
assert_eq!(dec128!(1.0).sqrt(), dec128!(1.0));
assert_eq!(dec128!(1.00).sqrt(), dec128!(1.0));
assert_eq!(dec128!(7).sqrt(), dec128!(2.64575131106459059050161575363926042571));
assert_eq!(dec128!(10).sqrt(), dec128!(3.16227766016837933199889354443271853372));
§Notes:
A negative zero is allowed as an operand as per IEEE 754 §5.4.1. Square-root can also be calculated by using the power operation (with a second operand of 0.5).
§N-th roots
If the operand is a special value, then the general rules apply.
Otherwise, the ideal exponent of the result is defined to be half the exponent of the operand (rounded to an integer,
towards [–Infinity
], if necessary) and then:
- If the operand is less than zero and
n
is even, an [‘Invalid operation’] condition is raised. - If the operand is equal to zero, the result will be the zero with the same sign as the operand and with the ideal exponent.
- Otherwise, the result is the N-th root of the operand.
§Examples:
use fastnum::*;
assert_eq!(dec128!(16).nth_root(4), dec128!(2));
§Notes:
N-th root can also be calculated by using the power operation (with a second operand of 1/n
).
§Exponential function
If the operand is a special value then the general rules apply.
Otherwise,
the result is e
raised to the power of the operand,
with the following cases:
- If the operand is [
–Infinity
], the result is0
and exact. - If the operand is a zero, the result is
1
and exact. - If the operand is
Infinity
, the result isInfinity
and exact. Otherwise, the result is inexact and will be rounded using the context rounding mode. - The coefficient will have exact precision digits (unless the result is subnormal).
§Examples:
use fastnum::*;
assert_eq!(D128::NEG_INFINITY.exp(), dec128!(0));
assert!(D128::INFINITY.exp().is_infinite());
assert_eq!(dec128!(0).exp(), dec128!(1));
assert_eq!(dec128!(1).exp(), D128::E);
assert_eq!(dec128!(-1).exp(), dec128!(0.36787944117144232159552377016146086745));
assert_eq!(D128::LN_2.exp().round(20), dec128!(2));
§Notes:
The standard Taylor series expansion method is used for calculation ex.
§Binary exponential function
If the operand is a special value then the general rules apply.
Otherwise, the result is 2
raised to the power of the operand, with the following cases:
- If the operand is [
–Infinity
], the result is0
and exact. - If the operand is a zero, the result is
1
and exact. - If the operand is
Infinity
, the result isInfinity
and exact. - Otherwise, the result is inexact and will be rounded using the context rounding mode.
- The coefficient will have exactly precision digits (unless the result is subnormal).
§Examples:
use fastnum::*;
assert_eq!(D128::NEG_INFINITY.exp2(), dec128!(0));
assert!(D128::INFINITY.exp2().is_infinite());
assert_eq!(dec128!(0).exp2(), dec128!(1));
assert_eq!(dec128!(1).exp2(), dec128!(2));
assert_eq!(dec128!(2).exp2(), dec128!(4));
§Notes:
The standard Taylor series expansion method is used for calculation 2x.
§Logarithm function
Base | Method | Associated constants |
---|---|---|
e | ln(self) | ‘ln(2)’, ‘ln(10)’ |
2 | log2(self) | ‘log2(e)’, ‘log2(10)’ |
10 | log10(self) | ‘log10(e)’, ‘log10(2)’ |
base | log(self, base) |
If the operand is a special value then the general rules apply. Otherwise, the operand must be a zero or positive, and the result is the logarithm base base of the operand, with the following cases:
- If the operand is a zero, the result is [
–Infinity
] and exact. - If the operand is
+Infinity
, the result is+Infinity
and exact. - If the operand equals one, the result is
0
and exact. - Otherwise, the result is inexact and will be correctly rounded using the Context rounding setting.
§Examples:
use fastnum::*;
assert_eq!(dec256!(2).ln(), D256::LN_2);
assert_eq!(dec256!(10).ln(), D256::LN_10);
assert_eq!(dec256!(100).log10(), D256::TWO);
assert_eq!(dec256!(512).log2(), dec256!(9));
§Trigonometric functions
§Base trigonometric functions
ƒ | Method | Domain | Set of principal values |
---|---|---|---|
sin(x) | sin(self) | -∞ < x < +∞ | -1 ≤ x ≤ 1 |
cos(x) | cos(self) | -∞ < x < +∞ | -1 ≤ x ≤ 1 |
tan(x) | tan(self) | -∞ < x < +∞ | -∞ < x < +∞ |
§Inverse trigonometric functions
ƒ | Method | Domain | Set of principal values |
---|---|---|---|
asin(x) | asin(self) | -1 ≤ x ≤ 1 | -π/2 ≤ x ≤ π/2 |
acos(x) | acos(self) | -1 ≤ x ≤ 1 | 0 ≤ x ≤ π |
atan(x) | atan(self) | -∞ < x < +∞ | -π/2 ≤ x ≤ π/2 |
§Hyperbolic functions
ƒ | Method | Domain | Set of principal values |
---|---|---|---|
sinh(x) | sinh(self) | -∞ < x < +∞ | -∞ < x < +∞ |
cosh(x) | cosh(self) | -∞ < x < +∞ | 1 ≤ x < +∞ |
tanh(x) | tanh(self) | -∞ < x < +∞ | -1 < x < 1 |
§Inverse hyperbolic functions
ƒ | Method | Domain | Set of principal values |
---|---|---|---|
asinh(x) | asinh(self) | -∞ < x < +∞ | -∞ < x < +∞ |
acosh(x) | acosh(self) | 1 ≤ x < +∞ | -∞ < x < +∞ |
atanh(x) | atanh(self) | -1 < x < 1 | -∞ < x < +∞ |
§Compare and ordering
The result of any compare operation is always exact and unrounded.
Rust operator | Unsigned | Signed | |
---|---|---|---|
eq | == | eq | eq |
ne | != | ne | ne |
lt | < | lt | lt |
le | <= | le | le |
gt | > | gt | gt |
ge | >= | ge | ge |
cmp | ➖ | cmp | cmp |
max | ➖ | max | max |
min | ➖ | min | min |
clamp | ➖ | clamp | clamp |
§Total-ordering predicate
The IEEE 754 standard provides a Total-ordering predicate, which defines a total ordering on canonical members of the supported arithmetic format. The predicate agrees with the comparison predicates (see section § Comparison predicates) when one decimal number is less than the other.
The main differences are:
NaN
is sortable.NaN
is treated as if it had a larger absolute value thanInfinity
(or any other decimal numbers).
(-NaN
<-Infinity
< … <+Infinity
< +NaN
)- Negative zero is treated as smaller than positive zero.
- If both sides of the comparison refer to the same decimal datum, the one with the lesser exponent is treated as having a lesser absolute value.
§Examples
use fastnum::*;
assert!(dec256!(0.2) == dec256!(0.2));
assert!(dec256!(0.2) > dec256!(0.1));
assert!(dec256!(0.1) < dec256!(0.3));
assert!(D256::MAX < D256::INFINITY);
assert!(D256::INFINITY < D256::NAN);
assert!(D256::NAN != D256::NAN);
§Rust operators overloads
Common numerical operations (such as addition operator +
, addition assignment operator +=
, division operator
/
, etc…) are overloaded for fastnum
decimals, so we
can treat them the same way we treat other numbers.
use fastnum::*;
let a = udec256!(3.5);
let b = udec256!(2.5);
let c = a + b;
assert_eq!(c, udec256!(6));
Unfortunately, the current version of Rust doesn’t support const traits, so this example fails to compile:
use fastnum::*;
const A: UD256 = udec256!(3.5);
const B: UD256 = udec256!(2.5);
const C: UD256 = A + B;
In constant calculations and static contexts, until the feature
is
stabilized, the following const methods should be used:
use fastnum::*;
const A: UD256 = udec256!(3.5);
const B: UD256 = udec256!(2.5);
const C: UD256 = A.add(B);
assert_eq!(C, udec256!(6));
§Decimal context
Decimal context represents the user-selectable parameters and rules which govern the results of arithmetic operations (for example, the rounding mode when rounding occurs).
The context is defined by the following parameters:
rounding_mode
: a named value which indicates the algorithm to be used when rounding is necessary, see more about rounding mode;signal_traps
: for each of the signals, the corresponding trap-enabler indicates which action is to be taken when the signal occurs (see IEEE 754 §7). See more about Signals.
§Default context
Signal | Trap-enabler |
---|---|
CLAMPED | |
DIVISION_BY_ZERO | ⚠️ |
INEXACT | |
INVALID_OPERATION | ⚠️ |
OVERFLOW | ⚠️ |
ROUNDED | |
SUBNORMAL | |
UNDERFLOW |
§Reduce
Normalize (or reduce) takes one operand and reduces a number to its shortest (coefficient) form.
If the final result is finite, it is reduced to its simplest form, with all trailing zeros removed and its sign
preserved.
That is, while the coefficient is non-zero and a multiple of ten the coefficient is divided by ten and the exponent is
incremented by 1
.
Otherwise (the coefficient is zero) the exponent is set to 0
.
In all cases the sign is unchanged.
§Examples
use fastnum::{*, decimal::*};
let a = dec256!(-1234500);
assert_eq!(a.digits(), u256!(1234500));
assert_eq!(a.fractional_digits_count(), 0);
let b = a.reduce();
assert_eq!(b.digits(), u256!(12345));
assert_eq!(b.fractional_digits_count(), -2);
§Rescale
If self
is a special value then the general rules apply, and an Invalid operation
condition is raised
and the result is NaN
.
Otherwise, rescale
quantize the self
decimal number specified to the power of ten of the quantum (new_scale
).
The coefficient:
- may be rounded using the Context rounding setting (if the exponent is being increased),
- multiplied by a positive power of ten (if the exponent is being decreased),
- or is unchanged (if the exponent is already equal to the given scale factor).
If the length of the coefficient after the quantize operation overflows max value, then an Clamped
condition is
raised and the result will be saturated.
§Examples
use fastnum::{*, decimal::*};
let ctx = Context::default().without_traps();
assert_eq!(dec256!(2.17).rescale(3), dec256!(2.170));
assert_eq!(dec256!(2.17).rescale(2), dec256!(2.17));
assert_eq!(dec256!(2.17).rescale(1), dec256!(2.2));
assert_eq!(dec256!(2.17).rescale(0), dec256!(2));
assert_eq!(dec256!(2.17).rescale(-1), dec256!(0));
assert!(D256::NEG_INFINITY.with_ctx(ctx).rescale(2).is_nan());
assert!(D256::NAN.with_ctx(ctx).rescale(1).is_nan());
§Quantize
Returns a value equal to self
(rounded), having the exponent of other
.
The quantize
semantics specifies the desired quantum by example.
The sign and coefficient of the other
are ignored.
If either operand is a special value then the general rules apply,
except that:
- if either operand is infinite and the other is finite, an
Invalid operation
condition is raised and the result isNaN
; - or if both are infinite, then the result is the first operand.
Otherwise (both operands are finite), quantize
returns the number which is equal in value (except for any rounding)
and sign to the first operand and which has an exponent set to be equal to the exponent of the second operand.
The coefficient:
- may be rounded using the Context rounding setting (if the exponent is being increased),
- multiplied by a positive power of ten (if the exponent is being decreased),
- or is unchanged (if the exponent is already equal to the given scale factor).
§Examples
use fastnum::{*, decimal::*};
let ctx = Context::default().without_traps();
assert_eq!(dec256!(2.17).quantize(dec256!(0.001)), dec256!(2.170));
assert_eq!(dec256!(2.17).quantize(dec256!(0.01)), dec256!(2.17));
assert_eq!(dec256!(2.17).quantize(dec256!(0.1)), dec256!(2.2));
assert_eq!(dec256!(2.17).quantize(dec256!(1e+0)), dec256!(2));
assert_eq!(dec256!(2.17).quantize(dec256!(1e+1)), dec256!(0));
assert_eq!(D256::NEG_INFINITY.quantize(D256::INFINITY), D256::NEG_INFINITY);
assert!(dec256!(2).with_ctx(ctx).quantize(D256::INFINITY).is_nan());
assert_eq!(dec256!(-0.1).quantize(dec256!(1)), dec256!(-0));
assert_eq!(dec256!(-0).quantize(dec256!(1e+5)), dec256!(-0E+5));
assert!(dec128!(0.34028).with_ctx(ctx).quantize(dec128!(1e-32765)).is_nan());
assert!(dec128!(-0.34028).with_ctx(ctx).quantize(dec128!(1e-32765)).is_nan());
assert_eq!(dec256!(217).quantize(dec256!(1e-1)), dec256!(217.0));
assert_eq!(dec256!(217).quantize(dec256!(1e+0)), dec256!(217));
assert_eq!(dec256!(217).quantize(dec256!(1e+1)), dec256!(2.2E+2));
assert_eq!(dec256!(217).quantize(dec256!(1e+2)), dec256!(2E+2));
This operation is very similar to rescale, which has the same semantics except that the second operand specified the
power of ten of the quantum.
In addition, unlike rescale
, if the length of the coefficient after the quantize
operation is greater than
precision, then an Invalid operation
condition is raised.
This guarantees that, unless there is an error condition, the exponent of the quantize
result is always equal to that
of the second operand.
Also, unlike other operations, quantize
will never raise Underflow
, even if the result is subnormal and inexact.
§Rounding
Rounding is applied when a result coefficient has more significant digits than the value of precision. In this case the result coefficient is shortened to precision digits and may then be incremented by one (which may require further shortening), depending on the rounding algorithm selected and the remaining digits of the original coefficient. The exponent is adjusted to compensate for any shortening.
When a result is rounded, the coefficient may become longer than the current precision. In this case the least significant digit of the coefficient (it will be a zero) is removed (reducing the precision by one), and the exponent is incremented by one. This in turn may give rise to an overflow condition, which determines the result after overflow.
§Rounding mode
RoundingMode enum determines how to calculate the last digit of the number when performing rounding:
Mode | Description | Default |
---|---|---|
Up | Always round away from zero. | |
Down | Always round towards zero. | |
Ceiling | Round towards +∞. | |
Floor | Round towards -∞. | |
HalfUp | Round to ‘nearest neighbor’, or up if ending decimal is 5 . | ✅ |
HalfDown | Round to ‘nearest neighbor’, or down if ending decimal is 5 . | |
HalfEven | Round to ‘nearest neighbor’, if equidistant, round towards nearest even digit. |
§Up
Round away from zero. If all the discarded digits are zero the result is unchanged. Otherwise, the result coefficient
should be incremented by 1
(rounded up).
5.5
→6.0
2.5
→3.0
1.6
→2.0
1.1
→2.0
-1.1
→-2.0
-1.6
→-2.0
-2.5
→-3.0
-5.5
→-6.0
§Down
Round toward zero, truncate. The discarded digits are ignored; the result is unchanged.
5.5
→5.0
2.5
→2.0
1.6
→1.0
1.1
→1.0
-1.1
→-1.0
-1.6
→-1.0
-2.5
→-2.0
-5.5
→-5.0
§Ceiling
Round toward +∞. If all the discarded digits are zero or if the sign is 1
the result is unchanged. Otherwise, the
result coefficient should be incremented by 1
(rounded up).
5.5
→6.0
2.5
→3.0
1.6
→2.0
1.1
→2.0
-1.1
→-1.0
-1.6
→-1.0
-2.5
→-2.0
-5.5
→-5.0
§Floor
Round toward -∞. If all the discarded digits are zero or if the sign is 0
the result is unchanged. Otherwise, the
sign is 1
and the result coefficient should be incremented by 1
.
5.5
→5.0
2.5
→2.0
1.6
→1.0
1.1
→1.0
-1.1
→-2.0
-1.6
→-2.0
-2.5
→-3.0
-5.5
→-6.0
§HalfUp
If the discarded digits represent greater than or equal to half (0.5
) of the value of a one in the next left position
then the result coefficient should be incremented by 1
(rounded up). Otherwise, the discarded digits are ignored.
5.5
→6.0
2.5
→3.0
1.6
→2.0
1.1
→1.0
-1.1
→-1.0
-1.6
→-2.0
-2.5
→-3.0
-5.5
→-6.0
§HalfDown
If the discarded digits represent greater than half (0.5
) of the value of a one in the next left position then the
result coefficient should be incremented by 1
(rounded up). Otherwise (the discarded digits are 0.5
or less) the
discarded digits are ignored.
5.5
→5.0
2.5
→2.0
1.6
→2.0
1.1
→1.0
-1.1
→-1.0
-1.6
→-2.0
-2.5
→-2.0
-5.5
→-5.0
§HalfEven
If the discarded digits represent greater than half (0.5
) the value of a one in the next left position then the result
coefficient should be incremented by 1
(rounded up). If they represent less than half, then the result coefficient is
not adjusted (that is, the discarded digits are ignored).
Otherwise (they represent exactly half) the result coefficient is unaltered if its rightmost digit is even, or
incremented by 1
(rounded up) if its rightmost digit is odd (to make an even digit).
5.5
→6.0
2.5
→2.0
1.6
→2.0
1.1
→1.0
-1.1
→-1.0
-1.6
→-2.0
-2.5
→-2.0
-5.5
→-6.0
§Extra precision
Description is coming soon…
§Base and mathematical constants
Const | Value | Signed | Unsigned |
---|---|---|---|
NAN | NaN | NAN | NAN |
INFINITY | +∞ | INFINITY | INFINITY |
NEG_INFINITY | -∞ | NEG_INFINITY | |
MIN | 0 for unsigned and -(2N - 1) × 1032’768 for signed | MIN | MIN |
MAX | (2N - 1) × 1032’768 | MAX | MAX |
MIN_POSITIVE | 1 × 10-32’768 | MIN_POSITIVE | MIN_POSITIVE |
EPSILON | Machine epsilon | EPSILON | EPSILON |
ZERO | 0 | ZERO | ZERO |
ONE | 1 | ONE | ONE |
… | |||
TEN | 10 | TEN | TEN |
PI | Archimedes’ constant π | PI | PI |
E | Euler’s number e | E | E |
TAU | The full circle constant τ = 2π | TAU | TAU |
FRAC_1_PI | 1 / π | FRAC_1_PI | FRAC_1_PI |
FRAC_2_PI | 2 / π | FRAC_2_PI | FRAC_2_PI |
FRAC_PI_2 | π / 2 | FRAC_PI_2 | FRAC_PI_2 |
FRAC_PI_3 | π / 3 | FRAC_PI_3 | FRAC_PI_3 |
FRAC_PI_4 | π / 4 | FRAC_PI_4 | FRAC_PI_4 |
FRAC_PI_6 | π / 6 | FRAC_PI_6 | FRAC_PI_6 |
FRAC_PI_8 | π / 8 | FRAC_PI_8 | FRAC_PI_8 |
FRAC_2_SQRT_PI | 2 / sqrt(π ) | FRAC_2_SQRT_PI | FRAC_2_SQRT_PI |
LN_2 | ln(2) | LN_2 | LN_2 |
LN_10 | ln(10) | LN_10 | LN_10 |
LOG2_E | log2(e) | LOG2_E | LOG2_E |
LOG10_E | log10(e) | LOG10_E | LOG10_E |
SQRT_2 | sqrt(2) | SQRT_2 | SQRT_2 |
FRAC_1_SQRT_2 | 1 / sqrt(2) | FRAC_1_SQRT_2 | FRAC_1_SQRT_2 |
LOG10_2 | log10(2) | LOG10_2 | LOG10_2 |
LOG2_10 | log2(10) | LOG2_10 | LOG2_10 |
§Examples
use fastnum::{*, decimal::RoundingMode::*};
assert_eq!(D128::PI, dec128!(3.14159265358979323846264338327950288420));
assert_eq!(D128::TAU, dec128!(2).with_rounding_mode(Down) * D128::PI);
§Formatting
Rust’s fmt::Display
formatting options for fastnum
decimals:
Placeholder | Format | Description |
---|---|---|
{} | Default Display | Format as “human readable” number. |
{:.<PREC>} | Display with precision | Format number with exactly PREC digits after the decimal place. |
{:e} / {:E} | Exponential format | Formats in scientific notation with either e or E as exponent delimiter. Precision is kept exactly. |
{:.<PREC>e} | Formats in scientific notation, keeping number | Number is rounded / zero padded until. |
{:?} | Debug | Shows internal representation of decimal. |
{:#?} | Alternate Debug (used by dbg!() ) | Shows simple int+exponent string representation of decimal. |
§Default display
- “Small” fractional numbers (close to zero) are printed in scientific notation
- Number is considered “small” by number of leading zeros exceeding a threshold
- Configurable by the compile-time environment variable:
RUST_FASTNUM_FMT_EXPONENTIAL_LOWER_THRESHOLD
- Default
5
- Default
- Example:
1.23e-3
will print as0.00123
but1.23e-10
will be1.23E-10
- Trailing zeros will be added to “small” integers, avoiding scientific notation
- May appear to have more precision than they do
- Example: decimal
1e1
would be rendered as10
- The threshold for “small” is configured by compile-time environment variable:
RUST_FASTNUM_FMT_EXPONENTIAL_UPPER_THRESHOLD
- Default
15
- Default
1e15
=>1000000000000000
- Large integers (e.g.
1e50000000
) will print in scientific notation, not a 1 followed by fifty million zeros
- All other numbers are printed in standard decimal notation
§Display with precision
Numbers with fractional components will be rounded at precision point, or have zeros padded to precision point. Integers will have zeros padded to the precision point. To prevent unreasonably sized output, a threshold limits the number of padded zeros:
- Greater than the default case, since specific precision was requested
- Configurable by the compile-time environment variable:
RUST_BIGDECIMAL_FMT_MAX_INTEGER_PADDING
- Default
1000
If digits exceed this threshold, they’re printed without a decimal-point, suffixed with scale of the decimal.
§Serialization
If you’re passing decimal numbers between systems, be sure to use a serialization format which explicitly supports decimal numbers and doesn’t require transformations to floating-point binary numbers, or there will be information loss.
Text formats like JSON should work ok as long as the receiver will also parse numbers as decimals so complete precision is kept accurate. Typically, JSON-parsing implementations don’t do this by default, and need special configuration.
Binary formats like msgpack
may expect/require representing numbers as 64-bit [IEEE-754]
floating-point, and will likely lose precision by default unless you explicitly format
the decimal as a string, bytes, or some custom structure.
§Serde
serde
feature allows to serialize and deserialize fasnum
decimals via the
serde
crate.
- Decimals are always serialized as as a string.
- Decimals deserialize behavior defined via
RUST_FASTNUM_SERDE_DESERIALIZE_MODE
. Possible values are:
Mode | Description | Default |
---|---|---|
Strict | Allow only string values such as "0.1" , "0.25" , etc. Any other numbers like 0.1 or 1 triggers parsing error. | ✅ |
Stringify | Decimal values such as 0.1 will be stringify to "0.1" first and then parse as decimal numbers. | |
Any | Allow any values. Parse performs in-place. Result may be inexact because there is no correct limited binary representation for some floating-point numbers, such as 0.1 . |
[dependencies]
fastnum = { version = "0.2", features = ["serde"] }
Basic usage:
use fastnum::{udec256, UD256};
use serde::*;
use serde_json;
#[derive(Debug, Serialize, Deserialize)]
struct MyStruct {
name: String,
value: UD256,
}
let json_src = r#"{ "name": "foo", "value": "1234567e-3" }"#;
let my_struct: MyStruct = serde_json::from_str(&json_src).unwrap();
dbg!(&my_struct);
// MyStruct { name: "foo", value: UD256("1234.567") }
println!("{}", serde_json::to_string(&my_struct).unwrap());
// {"name":"foo","value":"1234.567"}
Should panic:
use fastnum::{udec256, UD256};
use serde::*;
use serde_json;
#[derive(Debug, Serialize, Deserialize)]
struct MyStruct {
name: String,
value: UD256,
}
let json_src = r#"{ "name": "foo", "value": 1234567e-3 }"#;
let my_struct: MyStruct = serde_json::from_str(&json_src).unwrap();
§Features
Feature | Default | Description |
---|---|---|
std | ✅ | |
numtraits | Includes implementations of traits from the num_traits crate. | |
rand | Allows creation of random fastnum decimals via the rand crate. | |
zeroize | Enables the Zeroize trait implementation from the zeroize crate for fastnum decimals. | |
serde | Enables serialization and deserialization of fastnum decimals via the serde crate. | |
diesel | Enables serialization and deserialization of fastnum decimals for diesel crate. | |
diesel_postgres | Enables serialization and deserialization of fastnum decimals for diesel PostgreSQL backend. | |
diesel_mysql | Enables serialization and deserialization of fastnum decimals for diesel MySQL backend. | |
sqlx | Enables serialization and deserialization of fastnum decimals for sqlx crate. | |
sqlx_postgres | Enables serialization and deserialization of fastnum decimals for sqlx PostgreSQL backend. | |
sqlx_mysql | Enables serialization and deserialization of fastnum decimals for sqlx MySQL backend. | |
tokio-postgres | Enables serialization and deserialization of fastnum decimals for tokio-postgres crate. | |
utoipa | Enables support of fastnum decimals for autogenerated OpenAPI documentation via the utoipa crate. | |
dev | This feature opens up some otherwise private API, that can be useful to implement a third party integrations. Do not use this feature for any other use-cases. |
§Compile-time configuration
You can set a few default parameters at compile-time via environment variables:
Environment Variable | Default |
---|---|
RUST_FASTNUM_DEFAULT_ROUNDING_MODE | HalfUp |
RUST_FASTNUM_FMT_EXPONENTIAL_LOWER_THRESHOLD | 5 |
RUST_FASTNUM_FMT_EXPONENTIAL_UPPER_THRESHOLD | 15 |
RUST_FASTNUM_FMT_MAX_INTEGER_PADDING | 1000 |
RUST_FASTNUM_SERDE_DESERIALIZE_MODE | Strict |
Re-exports§
pub use decimal::ParseError as DecimalParseError;
pub use int::ParseError as IntParseError;
pub use decimal::*;
pub use int::*;
Modules§
Macros§
- dec64
- A macro to construct 64-bit signed
D64
decimal from literals in compile time. - dec128
- A macro to construct 128-bit signed
D128
decimal from literals in compile time. - dec192
- A macro to construct 192-bit signed
D192
decimal from literals in compile time. - dec256
- A macro to construct 256-bit signed
D256
decimal from literals in compile time. - dec320
- A macro to construct 320-bit signed
D320
decimal from literals in compile time. - dec384
- A macro to construct 384-bit signed
D384
decimal from literals in compile time. - dec448
- A macro to construct 448-bit signed
D448
decimal from literals in compile time. - dec512
- A macro to construct 512-bit signed
D512
decimal from literals in compile time. - dec576
- A macro to construct 576-bit signed
D576
decimal from literals in compile time. - dec640
- A macro to construct 640-bit signed
D640
decimal from literals in compile time. - dec704
- A macro to construct 704-bit signed
D704
decimal from literals in compile time. - dec768
- A macro to construct 768-bit signed
D768
decimal from literals in compile time. - dec832
- A macro to construct 832-bit signed
D832
decimal from literals in compile time. - dec896
- A macro to construct 896-bit signed
D896
decimal from literals in compile time. - dec960
- A macro to construct 960-bit signed
D960
decimal from literals in compile time. - dec1024
- A macro to construct 1024-bit signed
D1024
decimal from literals in compile time. - dec1088
- A macro to construct 1088-bit signed
D1088
decimal from literals in compile time. - dec1152
- A macro to construct 1152-bit signed
D1152
decimal from literals in compile time. - dec1216
- A macro to construct 1216-bit signed
D1216
decimal from literals in compile time. - dec1280
- A macro to construct 1280-bit signed
D1280
decimal from literals in compile time. - dec1344
- A macro to construct 1344-bit signed
D1344
decimal from literals in compile time. - dec1408
- A macro to construct 1408-bit signed
D1408
decimal from literals in compile time. - dec1472
- A macro to construct 1472-bit signed
D1472
decimal from literals in compile time. - dec1536
- A macro to construct 1536-bit signed
D1536
decimal from literals in compile time. - dec1600
- A macro to construct 1600-bit signed
D1600
decimal from literals in compile time. - dec1664
- A macro to construct 1664-bit signed
D1664
decimal from literals in compile time. - dec1728
- A macro to construct 1728-bit signed
D1728
decimal from literals in compile time. - dec1792
- A macro to construct 1792-bit signed
D1792
decimal from literals in compile time. - dec1856
- A macro to construct 1856-bit signed
D1856
decimal from literals in compile time. - dec1920
- A macro to construct 1920-bit signed
D1920
decimal from literals in compile time. - dec1984
- A macro to construct 1984-bit signed
D1984
decimal from literals in compile time. - dec2048
- A macro to construct 2048-bit signed
D2048
decimal from literals in compile time. - dec2112
- A macro to construct 2112-bit signed
D2112
decimal from literals in compile time. - dec2176
- A macro to construct 2176-bit signed
D2176
decimal from literals in compile time. - dec2240
- A macro to construct 2240-bit signed
D2240
decimal from literals in compile time. - dec2304
- A macro to construct 2304-bit signed
D2304
decimal from literals in compile time. - dec2368
- A macro to construct 2368-bit signed
D2368
decimal from literals in compile time. - dec2432
- A macro to construct 2432-bit signed
D2432
decimal from literals in compile time. - dec2496
- A macro to construct 2496-bit signed
D2496
decimal from literals in compile time. - dec2560
- A macro to construct 2560-bit signed
D2560
decimal from literals in compile time. - dec2624
- A macro to construct 2624-bit signed
D2624
decimal from literals in compile time. - dec2688
- A macro to construct 2688-bit signed
D2688
decimal from literals in compile time. - dec2752
- A macro to construct 2752-bit signed
D2752
decimal from literals in compile time. - dec2816
- A macro to construct 2816-bit signed
D2816
decimal from literals in compile time. - dec2880
- A macro to construct 2880-bit signed
D2880
decimal from literals in compile time. - dec2944
- A macro to construct 2944-bit signed
D2944
decimal from literals in compile time. - dec3008
- A macro to construct 3008-bit signed
D3008
decimal from literals in compile time. - dec3072
- A macro to construct 3072-bit signed
D3072
decimal from literals in compile time. - dec3136
- A macro to construct 3136-bit signed
D3136
decimal from literals in compile time. - dec3200
- A macro to construct 3200-bit signed
D3200
decimal from literals in compile time. - dec3264
- A macro to construct 3264-bit signed
D3264
decimal from literals in compile time. - dec3328
- A macro to construct 3328-bit signed
D3328
decimal from literals in compile time. - dec3392
- A macro to construct 3392-bit signed
D3392
decimal from literals in compile time. - dec3456
- A macro to construct 3456-bit signed
D3456
decimal from literals in compile time. - dec3520
- A macro to construct 3520-bit signed
D3520
decimal from literals in compile time. - dec3584
- A macro to construct 3584-bit signed
D3584
decimal from literals in compile time. - dec3648
- A macro to construct 3648-bit signed
D3648
decimal from literals in compile time. - dec3712
- A macro to construct 3712-bit signed
D3712
decimal from literals in compile time. - dec3776
- A macro to construct 3776-bit signed
D3776
decimal from literals in compile time. - dec3840
- A macro to construct 3840-bit signed
D3840
decimal from literals in compile time. - dec3904
- A macro to construct 3904-bit signed
D3904
decimal from literals in compile time. - dec3968
- A macro to construct 3968-bit signed
D3968
decimal from literals in compile time. - dec4032
- A macro to construct 4032-bit signed
D4032
decimal from literals in compile time. - dec4096
- A macro to construct 4096-bit signed
D4096
decimal from literals in compile time. - dec4160
- A macro to construct 4160-bit signed
D4160
decimal from literals in compile time. - dec4224
- A macro to construct 4224-bit signed
D4224
decimal from literals in compile time. - dec4288
- A macro to construct 4288-bit signed
D4288
decimal from literals in compile time. - dec4352
- A macro to construct 4352-bit signed
D4352
decimal from literals in compile time. - dec4416
- A macro to construct 4416-bit signed
D4416
decimal from literals in compile time. - dec4480
- A macro to construct 4480-bit signed
D4480
decimal from literals in compile time. - dec4544
- A macro to construct 4544-bit signed
D4544
decimal from literals in compile time. - dec4608
- A macro to construct 4608-bit signed
D4608
decimal from literals in compile time. - dec4672
- A macro to construct 4672-bit signed
D4672
decimal from literals in compile time. - dec4736
- A macro to construct 4736-bit signed
D4736
decimal from literals in compile time. - dec4800
- A macro to construct 4800-bit signed
D4800
decimal from literals in compile time. - dec4864
- A macro to construct 4864-bit signed
D4864
decimal from literals in compile time. - dec4928
- A macro to construct 4928-bit signed
D4928
decimal from literals in compile time. - dec4992
- A macro to construct 4992-bit signed
D4992
decimal from literals in compile time. - dec5056
- A macro to construct 5056-bit signed
D5056
decimal from literals in compile time. - dec5120
- A macro to construct 5120-bit signed
D5120
decimal from literals in compile time. - dec5184
- A macro to construct 5184-bit signed
D5184
decimal from literals in compile time. - dec5248
- A macro to construct 5248-bit signed
D5248
decimal from literals in compile time. - dec5312
- A macro to construct 5312-bit signed
D5312
decimal from literals in compile time. - dec5376
- A macro to construct 5376-bit signed
D5376
decimal from literals in compile time. - dec5440
- A macro to construct 5440-bit signed
D5440
decimal from literals in compile time. - dec5504
- A macro to construct 5504-bit signed
D5504
decimal from literals in compile time. - dec5568
- A macro to construct 5568-bit signed
D5568
decimal from literals in compile time. - dec5632
- A macro to construct 5632-bit signed
D5632
decimal from literals in compile time. - dec5696
- A macro to construct 5696-bit signed
D5696
decimal from literals in compile time. - dec5760
- A macro to construct 5760-bit signed
D5760
decimal from literals in compile time. - dec5824
- A macro to construct 5824-bit signed
D5824
decimal from literals in compile time. - dec5888
- A macro to construct 5888-bit signed
D5888
decimal from literals in compile time. - dec5952
- A macro to construct 5952-bit signed
D5952
decimal from literals in compile time. - dec6016
- A macro to construct 6016-bit signed
D6016
decimal from literals in compile time. - dec6080
- A macro to construct 6080-bit signed
D6080
decimal from literals in compile time. - dec6144
- A macro to construct 6144-bit signed
D6144
decimal from literals in compile time. - dec6208
- A macro to construct 6208-bit signed
D6208
decimal from literals in compile time. - dec6272
- A macro to construct 6272-bit signed
D6272
decimal from literals in compile time. - dec6336
- A macro to construct 6336-bit signed
D6336
decimal from literals in compile time. - dec6400
- A macro to construct 6400-bit signed
D6400
decimal from literals in compile time. - dec6464
- A macro to construct 6464-bit signed
D6464
decimal from literals in compile time. - dec6528
- A macro to construct 6528-bit signed
D6528
decimal from literals in compile time. - dec6592
- A macro to construct 6592-bit signed
D6592
decimal from literals in compile time. - dec6656
- A macro to construct 6656-bit signed
D6656
decimal from literals in compile time. - dec6720
- A macro to construct 6720-bit signed
D6720
decimal from literals in compile time. - dec6784
- A macro to construct 6784-bit signed
D6784
decimal from literals in compile time. - dec6848
- A macro to construct 6848-bit signed
D6848
decimal from literals in compile time. - dec6912
- A macro to construct 6912-bit signed
D6912
decimal from literals in compile time. - dec6976
- A macro to construct 6976-bit signed
D6976
decimal from literals in compile time. - dec7040
- A macro to construct 7040-bit signed
D7040
decimal from literals in compile time. - dec7104
- A macro to construct 7104-bit signed
D7104
decimal from literals in compile time. - dec7168
- A macro to construct 7168-bit signed
D7168
decimal from literals in compile time. - dec7232
- A macro to construct 7232-bit signed
D7232
decimal from literals in compile time. - dec7296
- A macro to construct 7296-bit signed
D7296
decimal from literals in compile time. - dec7360
- A macro to construct 7360-bit signed
D7360
decimal from literals in compile time. - dec7424
- A macro to construct 7424-bit signed
D7424
decimal from literals in compile time. - dec7488
- A macro to construct 7488-bit signed
D7488
decimal from literals in compile time. - dec7552
- A macro to construct 7552-bit signed
D7552
decimal from literals in compile time. - dec7616
- A macro to construct 7616-bit signed
D7616
decimal from literals in compile time. - dec7680
- A macro to construct 7680-bit signed
D7680
decimal from literals in compile time. - dec7744
- A macro to construct 7744-bit signed
D7744
decimal from literals in compile time. - dec7808
- A macro to construct 7808-bit signed
D7808
decimal from literals in compile time. - dec7872
- A macro to construct 7872-bit signed
D7872
decimal from literals in compile time. - dec7936
- A macro to construct 7936-bit signed
D7936
decimal from literals in compile time. - dec8000
- A macro to construct 8000-bit signed
D8000
decimal from literals in compile time. - dec8064
- A macro to construct 8064-bit signed
D8064
decimal from literals in compile time. - dec8128
- A macro to construct 8128-bit signed
D8128
decimal from literals in compile time. - dec8192
- A macro to construct 8192-bit signed
D8192
decimal from literals in compile time. - i64
- A macro to construct
I64
(64-bit signed integer) from literals. - i128
- A macro to construct
I128
(128-bit signed integer) from literals. - i192
- A macro to construct
I192
(192-bit signed integer) from literals. - i256
- A macro to construct
I256
(256-bit signed integer) from literals. - i320
- A macro to construct
I320
(320-bit signed integer) from literals. - i384
- A macro to construct
I384
(384-bit signed integer) from literals. - i448
- A macro to construct
I448
(448-bit signed integer) from literals. - i512
- A macro to construct
I512
(512-bit signed integer) from literals. - i576
- A macro to construct
I576
(576-bit signed integer) from literals. - i640
- A macro to construct
I640
(640-bit signed integer) from literals. - i704
- A macro to construct
I704
(704-bit signed integer) from literals. - i768
- A macro to construct
I768
(768-bit signed integer) from literals. - i832
- A macro to construct
I832
(832-bit signed integer) from literals. - i896
- A macro to construct
I896
(896-bit signed integer) from literals. - i960
- A macro to construct
I960
(960-bit signed integer) from literals. - i1024
- A macro to construct
I1024
(1024-bit signed integer) from literals. - i1088
- A macro to construct
I1088
(1088-bit signed integer) from literals. - i1152
- A macro to construct
I1152
(1152-bit signed integer) from literals. - i1216
- A macro to construct
I1216
(1216-bit signed integer) from literals. - i1280
- A macro to construct
I1280
(1280-bit signed integer) from literals. - i1344
- A macro to construct
I1344
(1344-bit signed integer) from literals. - i1408
- A macro to construct
I1408
(1408-bit signed integer) from literals. - i1472
- A macro to construct
I1472
(1472-bit signed integer) from literals. - i1536
- A macro to construct
I1536
(1536-bit signed integer) from literals. - i1600
- A macro to construct
I1600
(1600-bit signed integer) from literals. - i1664
- A macro to construct
I1664
(1664-bit signed integer) from literals. - i1728
- A macro to construct
I1728
(1728-bit signed integer) from literals. - i1792
- A macro to construct
I1792
(1792-bit signed integer) from literals. - i1856
- A macro to construct
I1856
(1856-bit signed integer) from literals. - i1920
- A macro to construct
I1920
(1920-bit signed integer) from literals. - i1984
- A macro to construct
I1984
(1984-bit signed integer) from literals. - i2048
- A macro to construct
I2048
(2048-bit signed integer) from literals. - i2112
- A macro to construct
I2112
(2112-bit signed integer) from literals. - i2176
- A macro to construct
I2176
(2176-bit signed integer) from literals. - i2240
- A macro to construct
I2240
(2240-bit signed integer) from literals. - i2304
- A macro to construct
I2304
(2304-bit signed integer) from literals. - i2368
- A macro to construct
I2368
(2368-bit signed integer) from literals. - i2432
- A macro to construct
I2432
(2432-bit signed integer) from literals. - i2496
- A macro to construct
I2496
(2496-bit signed integer) from literals. - i2560
- A macro to construct
I2560
(2560-bit signed integer) from literals. - i2624
- A macro to construct
I2624
(2624-bit signed integer) from literals. - i2688
- A macro to construct
I2688
(2688-bit signed integer) from literals. - i2752
- A macro to construct
I2752
(2752-bit signed integer) from literals. - i2816
- A macro to construct
I2816
(2816-bit signed integer) from literals. - i2880
- A macro to construct
I2880
(2880-bit signed integer) from literals. - i2944
- A macro to construct
I2944
(2944-bit signed integer) from literals. - i3008
- A macro to construct
I3008
(3008-bit signed integer) from literals. - i3072
- A macro to construct
I3072
(3072-bit signed integer) from literals. - i3136
- A macro to construct
I3136
(3136-bit signed integer) from literals. - i3200
- A macro to construct
I3200
(3200-bit signed integer) from literals. - i3264
- A macro to construct
I3264
(3264-bit signed integer) from literals. - i3328
- A macro to construct
I3328
(3328-bit signed integer) from literals. - i3392
- A macro to construct
I3392
(3392-bit signed integer) from literals. - i3456
- A macro to construct
I3456
(3456-bit signed integer) from literals. - i3520
- A macro to construct
I3520
(3520-bit signed integer) from literals. - i3584
- A macro to construct
I3584
(3584-bit signed integer) from literals. - i3648
- A macro to construct
I3648
(3648-bit signed integer) from literals. - i3712
- A macro to construct
I3712
(3712-bit signed integer) from literals. - i3776
- A macro to construct
I3776
(3776-bit signed integer) from literals. - i3840
- A macro to construct
I3840
(3840-bit signed integer) from literals. - i3904
- A macro to construct
I3904
(3904-bit signed integer) from literals. - i3968
- A macro to construct
I3968
(3968-bit signed integer) from literals. - i4032
- A macro to construct
I4032
(4032-bit signed integer) from literals. - i4096
- A macro to construct
I4096
(4096-bit signed integer) from literals. - i4160
- A macro to construct
I4160
(4160-bit signed integer) from literals. - i4224
- A macro to construct
I4224
(4224-bit signed integer) from literals. - i4288
- A macro to construct
I4288
(4288-bit signed integer) from literals. - i4352
- A macro to construct
I4352
(4352-bit signed integer) from literals. - i4416
- A macro to construct
I4416
(4416-bit signed integer) from literals. - i4480
- A macro to construct
I4480
(4480-bit signed integer) from literals. - i4544
- A macro to construct
I4544
(4544-bit signed integer) from literals. - i4608
- A macro to construct
I4608
(4608-bit signed integer) from literals. - i4672
- A macro to construct
I4672
(4672-bit signed integer) from literals. - i4736
- A macro to construct
I4736
(4736-bit signed integer) from literals. - i4800
- A macro to construct
I4800
(4800-bit signed integer) from literals. - i4864
- A macro to construct
I4864
(4864-bit signed integer) from literals. - i4928
- A macro to construct
I4928
(4928-bit signed integer) from literals. - i4992
- A macro to construct
I4992
(4992-bit signed integer) from literals. - i5056
- A macro to construct
I5056
(5056-bit signed integer) from literals. - i5120
- A macro to construct
I5120
(5120-bit signed integer) from literals. - i5184
- A macro to construct
I5184
(5184-bit signed integer) from literals. - i5248
- A macro to construct
I5248
(5248-bit signed integer) from literals. - i5312
- A macro to construct
I5312
(5312-bit signed integer) from literals. - i5376
- A macro to construct
I5376
(5376-bit signed integer) from literals. - i5440
- A macro to construct
I5440
(5440-bit signed integer) from literals. - i5504
- A macro to construct
I5504
(5504-bit signed integer) from literals. - i5568
- A macro to construct
I5568
(5568-bit signed integer) from literals. - i5632
- A macro to construct
I5632
(5632-bit signed integer) from literals. - i5696
- A macro to construct
I5696
(5696-bit signed integer) from literals. - i5760
- A macro to construct
I5760
(5760-bit signed integer) from literals. - i5824
- A macro to construct
I5824
(5824-bit signed integer) from literals. - i5888
- A macro to construct
I5888
(5888-bit signed integer) from literals. - i5952
- A macro to construct
I5952
(5952-bit signed integer) from literals. - i6016
- A macro to construct
I6016
(6016-bit signed integer) from literals. - i6080
- A macro to construct
I6080
(6080-bit signed integer) from literals. - i6144
- A macro to construct
I6144
(6144-bit signed integer) from literals. - i6208
- A macro to construct
I6208
(6208-bit signed integer) from literals. - i6272
- A macro to construct
I6272
(6272-bit signed integer) from literals. - i6336
- A macro to construct
I6336
(6336-bit signed integer) from literals. - i6400
- A macro to construct
I6400
(6400-bit signed integer) from literals. - i6464
- A macro to construct
I6464
(6464-bit signed integer) from literals. - i6528
- A macro to construct
I6528
(6528-bit signed integer) from literals. - i6592
- A macro to construct
I6592
(6592-bit signed integer) from literals. - i6656
- A macro to construct
I6656
(6656-bit signed integer) from literals. - i6720
- A macro to construct
I6720
(6720-bit signed integer) from literals. - i6784
- A macro to construct
I6784
(6784-bit signed integer) from literals. - i6848
- A macro to construct
I6848
(6848-bit signed integer) from literals. - i6912
- A macro to construct
I6912
(6912-bit signed integer) from literals. - i6976
- A macro to construct
I6976
(6976-bit signed integer) from literals. - i7040
- A macro to construct
I7040
(7040-bit signed integer) from literals. - i7104
- A macro to construct
I7104
(7104-bit signed integer) from literals. - i7168
- A macro to construct
I7168
(7168-bit signed integer) from literals. - i7232
- A macro to construct
I7232
(7232-bit signed integer) from literals. - i7296
- A macro to construct
I7296
(7296-bit signed integer) from literals. - i7360
- A macro to construct
I7360
(7360-bit signed integer) from literals. - i7424
- A macro to construct
I7424
(7424-bit signed integer) from literals. - i7488
- A macro to construct
I7488
(7488-bit signed integer) from literals. - i7552
- A macro to construct
I7552
(7552-bit signed integer) from literals. - i7616
- A macro to construct
I7616
(7616-bit signed integer) from literals. - i7680
- A macro to construct
I7680
(7680-bit signed integer) from literals. - i7744
- A macro to construct
I7744
(7744-bit signed integer) from literals. - i7808
- A macro to construct
I7808
(7808-bit signed integer) from literals. - i7872
- A macro to construct
I7872
(7872-bit signed integer) from literals. - i7936
- A macro to construct
I7936
(7936-bit signed integer) from literals. - i8000
- A macro to construct
I8000
(8000-bit signed integer) from literals. - i8064
- A macro to construct
I8064
(8064-bit signed integer) from literals. - i8128
- A macro to construct
I8128
(8128-bit signed integer) from literals. - i8192
- A macro to construct
I8192
(8192-bit signed integer) from literals. - signals
- Macro helper for fast initializing of signals set.
- u64
- A macro to construct
U64
(64-bit unsigned integer) from literals. - u128
- A macro to construct
U128
(128-bit unsigned integer) from literals. - u192
- A macro to construct
U192
(192-bit unsigned integer) from literals. - u256
- A macro to construct
U256
(256-bit unsigned integer) from literals. - u320
- A macro to construct
U320
(320-bit unsigned integer) from literals. - u384
- A macro to construct
U384
(384-bit unsigned integer) from literals. - u448
- A macro to construct
U448
(448-bit unsigned integer) from literals. - u512
- A macro to construct
U512
(512-bit unsigned integer) from literals. - u576
- A macro to construct
U576
(576-bit unsigned integer) from literals. - u640
- A macro to construct
U640
(640-bit unsigned integer) from literals. - u704
- A macro to construct
U704
(704-bit unsigned integer) from literals. - u768
- A macro to construct
U768
(768-bit unsigned integer) from literals. - u832
- A macro to construct
U832
(832-bit unsigned integer) from literals. - u896
- A macro to construct
U896
(896-bit unsigned integer) from literals. - u960
- A macro to construct
U960
(960-bit unsigned integer) from literals. - u1024
- A macro to construct
U1024
(1024-bit unsigned integer) from literals. - u1088
- A macro to construct
U1088
(1088-bit unsigned integer) from literals. - u1152
- A macro to construct
U1152
(1152-bit unsigned integer) from literals. - u1216
- A macro to construct
U1216
(1216-bit unsigned integer) from literals. - u1280
- A macro to construct
U1280
(1280-bit unsigned integer) from literals. - u1344
- A macro to construct
U1344
(1344-bit unsigned integer) from literals. - u1408
- A macro to construct
U1408
(1408-bit unsigned integer) from literals. - u1472
- A macro to construct
U1472
(1472-bit unsigned integer) from literals. - u1536
- A macro to construct
U1536
(1536-bit unsigned integer) from literals. - u1600
- A macro to construct
U1600
(1600-bit unsigned integer) from literals. - u1664
- A macro to construct
U1664
(1664-bit unsigned integer) from literals. - u1728
- A macro to construct
U1728
(1728-bit unsigned integer) from literals. - u1792
- A macro to construct
U1792
(1792-bit unsigned integer) from literals. - u1856
- A macro to construct
U1856
(1856-bit unsigned integer) from literals. - u1920
- A macro to construct
U1920
(1920-bit unsigned integer) from literals. - u1984
- A macro to construct
U1984
(1984-bit unsigned integer) from literals. - u2048
- A macro to construct
U2048
(2048-bit unsigned integer) from literals. - u2112
- A macro to construct
U2112
(2112-bit unsigned integer) from literals. - u2176
- A macro to construct
U2176
(2176-bit unsigned integer) from literals. - u2240
- A macro to construct
U2240
(2240-bit unsigned integer) from literals. - u2304
- A macro to construct
U2304
(2304-bit unsigned integer) from literals. - u2368
- A macro to construct
U2368
(2368-bit unsigned integer) from literals. - u2432
- A macro to construct
U2432
(2432-bit unsigned integer) from literals. - u2496
- A macro to construct
U2496
(2496-bit unsigned integer) from literals. - u2560
- A macro to construct
U2560
(2560-bit unsigned integer) from literals. - u2624
- A macro to construct
U2624
(2624-bit unsigned integer) from literals. - u2688
- A macro to construct
U2688
(2688-bit unsigned integer) from literals. - u2752
- A macro to construct
U2752
(2752-bit unsigned integer) from literals. - u2816
- A macro to construct
U2816
(2816-bit unsigned integer) from literals. - u2880
- A macro to construct
U2880
(2880-bit unsigned integer) from literals. - u2944
- A macro to construct
U2944
(2944-bit unsigned integer) from literals. - u3008
- A macro to construct
U3008
(3008-bit unsigned integer) from literals. - u3072
- A macro to construct
U3072
(3072-bit unsigned integer) from literals. - u3136
- A macro to construct
U3136
(3136-bit unsigned integer) from literals. - u3200
- A macro to construct
U3200
(3200-bit unsigned integer) from literals. - u3264
- A macro to construct
U3264
(3264-bit unsigned integer) from literals. - u3328
- A macro to construct
U3328
(3328-bit unsigned integer) from literals. - u3392
- A macro to construct
U3392
(3392-bit unsigned integer) from literals. - u3456
- A macro to construct
U3456
(3456-bit unsigned integer) from literals. - u3520
- A macro to construct
U3520
(3520-bit unsigned integer) from literals. - u3584
- A macro to construct
U3584
(3584-bit unsigned integer) from literals. - u3648
- A macro to construct
U3648
(3648-bit unsigned integer) from literals. - u3712
- A macro to construct
U3712
(3712-bit unsigned integer) from literals. - u3776
- A macro to construct
U3776
(3776-bit unsigned integer) from literals. - u3840
- A macro to construct
U3840
(3840-bit unsigned integer) from literals. - u3904
- A macro to construct
U3904
(3904-bit unsigned integer) from literals. - u3968
- A macro to construct
U3968
(3968-bit unsigned integer) from literals. - u4032
- A macro to construct
U4032
(4032-bit unsigned integer) from literals. - u4096
- A macro to construct
U4096
(4096-bit unsigned integer) from literals. - u4160
- A macro to construct
U4160
(4160-bit unsigned integer) from literals. - u4224
- A macro to construct
U4224
(4224-bit unsigned integer) from literals. - u4288
- A macro to construct
U4288
(4288-bit unsigned integer) from literals. - u4352
- A macro to construct
U4352
(4352-bit unsigned integer) from literals. - u4416
- A macro to construct
U4416
(4416-bit unsigned integer) from literals. - u4480
- A macro to construct
U4480
(4480-bit unsigned integer) from literals. - u4544
- A macro to construct
U4544
(4544-bit unsigned integer) from literals. - u4608
- A macro to construct
U4608
(4608-bit unsigned integer) from literals. - u4672
- A macro to construct
U4672
(4672-bit unsigned integer) from literals. - u4736
- A macro to construct
U4736
(4736-bit unsigned integer) from literals. - u4800
- A macro to construct
U4800
(4800-bit unsigned integer) from literals. - u4864
- A macro to construct
U4864
(4864-bit unsigned integer) from literals. - u4928
- A macro to construct
U4928
(4928-bit unsigned integer) from literals. - u4992
- A macro to construct
U4992
(4992-bit unsigned integer) from literals. - u5056
- A macro to construct
U5056
(5056-bit unsigned integer) from literals. - u5120
- A macro to construct
U5120
(5120-bit unsigned integer) from literals. - u5184
- A macro to construct
U5184
(5184-bit unsigned integer) from literals. - u5248
- A macro to construct
U5248
(5248-bit unsigned integer) from literals. - u5312
- A macro to construct
U5312
(5312-bit unsigned integer) from literals. - u5376
- A macro to construct
U5376
(5376-bit unsigned integer) from literals. - u5440
- A macro to construct
U5440
(5440-bit unsigned integer) from literals. - u5504
- A macro to construct
U5504
(5504-bit unsigned integer) from literals. - u5568
- A macro to construct
U5568
(5568-bit unsigned integer) from literals. - u5632
- A macro to construct
U5632
(5632-bit unsigned integer) from literals. - u5696
- A macro to construct
U5696
(5696-bit unsigned integer) from literals. - u5760
- A macro to construct
U5760
(5760-bit unsigned integer) from literals. - u5824
- A macro to construct
U5824
(5824-bit unsigned integer) from literals. - u5888
- A macro to construct
U5888
(5888-bit unsigned integer) from literals. - u5952
- A macro to construct
U5952
(5952-bit unsigned integer) from literals. - u6016
- A macro to construct
U6016
(6016-bit unsigned integer) from literals. - u6080
- A macro to construct
U6080
(6080-bit unsigned integer) from literals. - u6144
- A macro to construct
U6144
(6144-bit unsigned integer) from literals. - u6208
- A macro to construct
U6208
(6208-bit unsigned integer) from literals. - u6272
- A macro to construct
U6272
(6272-bit unsigned integer) from literals. - u6336
- A macro to construct
U6336
(6336-bit unsigned integer) from literals. - u6400
- A macro to construct
U6400
(6400-bit unsigned integer) from literals. - u6464
- A macro to construct
U6464
(6464-bit unsigned integer) from literals. - u6528
- A macro to construct
U6528
(6528-bit unsigned integer) from literals. - u6592
- A macro to construct
U6592
(6592-bit unsigned integer) from literals. - u6656
- A macro to construct
U6656
(6656-bit unsigned integer) from literals. - u6720
- A macro to construct
U6720
(6720-bit unsigned integer) from literals. - u6784
- A macro to construct
U6784
(6784-bit unsigned integer) from literals. - u6848
- A macro to construct
U6848
(6848-bit unsigned integer) from literals. - u6912
- A macro to construct
U6912
(6912-bit unsigned integer) from literals. - u6976
- A macro to construct
U6976
(6976-bit unsigned integer) from literals. - u7040
- A macro to construct
U7040
(7040-bit unsigned integer) from literals. - u7104
- A macro to construct
U7104
(7104-bit unsigned integer) from literals. - u7168
- A macro to construct
U7168
(7168-bit unsigned integer) from literals. - u7232
- A macro to construct
U7232
(7232-bit unsigned integer) from literals. - u7296
- A macro to construct
U7296
(7296-bit unsigned integer) from literals. - u7360
- A macro to construct
U7360
(7360-bit unsigned integer) from literals. - u7424
- A macro to construct
U7424
(7424-bit unsigned integer) from literals. - u7488
- A macro to construct
U7488
(7488-bit unsigned integer) from literals. - u7552
- A macro to construct
U7552
(7552-bit unsigned integer) from literals. - u7616
- A macro to construct
U7616
(7616-bit unsigned integer) from literals. - u7680
- A macro to construct
U7680
(7680-bit unsigned integer) from literals. - u7744
- A macro to construct
U7744
(7744-bit unsigned integer) from literals. - u7808
- A macro to construct
U7808
(7808-bit unsigned integer) from literals. - u7872
- A macro to construct
U7872
(7872-bit unsigned integer) from literals. - u7936
- A macro to construct
U7936
(7936-bit unsigned integer) from literals. - u8000
- A macro to construct
U8000
(8000-bit unsigned integer) from literals. - u8064
- A macro to construct
U8064
(8064-bit unsigned integer) from literals. - u8128
- A macro to construct
U8128
(8128-bit unsigned integer) from literals. - u8192
- A macro to construct
U8192
(8192-bit unsigned integer) from literals. - udec64
- A macro to construct 64-bit unsigned
UD64
decimal from literals in compile time. - udec128
- A macro to construct 128-bit unsigned
UD128
decimal from literals in compile time. - udec192
- A macro to construct 192-bit unsigned
UD192
decimal from literals in compile time. - udec256
- A macro to construct 256-bit unsigned
UD256
decimal from literals in compile time. - udec320
- A macro to construct 320-bit unsigned
UD320
decimal from literals in compile time. - udec384
- A macro to construct 384-bit unsigned
UD384
decimal from literals in compile time. - udec448
- A macro to construct 448-bit unsigned
UD448
decimal from literals in compile time. - udec512
- A macro to construct 512-bit unsigned
UD512
decimal from literals in compile time. - udec576
- A macro to construct 576-bit unsigned
UD576
decimal from literals in compile time. - udec640
- A macro to construct 640-bit unsigned
UD640
decimal from literals in compile time. - udec704
- A macro to construct 704-bit unsigned
UD704
decimal from literals in compile time. - udec768
- A macro to construct 768-bit unsigned
UD768
decimal from literals in compile time. - udec832
- A macro to construct 832-bit unsigned
UD832
decimal from literals in compile time. - udec896
- A macro to construct 896-bit unsigned
UD896
decimal from literals in compile time. - udec960
- A macro to construct 960-bit unsigned
UD960
decimal from literals in compile time. - udec1024
- A macro to construct 1024-bit unsigned
UD1024
decimal from literals in compile time. - udec1088
- A macro to construct 1088-bit unsigned
UD1088
decimal from literals in compile time. - udec1152
- A macro to construct 1152-bit unsigned
UD1152
decimal from literals in compile time. - udec1216
- A macro to construct 1216-bit unsigned
UD1216
decimal from literals in compile time. - udec1280
- A macro to construct 1280-bit unsigned
UD1280
decimal from literals in compile time. - udec1344
- A macro to construct 1344-bit unsigned
UD1344
decimal from literals in compile time. - udec1408
- A macro to construct 1408-bit unsigned
UD1408
decimal from literals in compile time. - udec1472
- A macro to construct 1472-bit unsigned
UD1472
decimal from literals in compile time. - udec1536
- A macro to construct 1536-bit unsigned
UD1536
decimal from literals in compile time. - udec1600
- A macro to construct 1600-bit unsigned
UD1600
decimal from literals in compile time. - udec1664
- A macro to construct 1664-bit unsigned
UD1664
decimal from literals in compile time. - udec1728
- A macro to construct 1728-bit unsigned
UD1728
decimal from literals in compile time. - udec1792
- A macro to construct 1792-bit unsigned
UD1792
decimal from literals in compile time. - udec1856
- A macro to construct 1856-bit unsigned
UD1856
decimal from literals in compile time. - udec1920
- A macro to construct 1920-bit unsigned
UD1920
decimal from literals in compile time. - udec1984
- A macro to construct 1984-bit unsigned
UD1984
decimal from literals in compile time. - udec2048
- A macro to construct 2048-bit unsigned
UD2048
decimal from literals in compile time. - udec2112
- A macro to construct 2112-bit unsigned
UD2112
decimal from literals in compile time. - udec2176
- A macro to construct 2176-bit unsigned
UD2176
decimal from literals in compile time. - udec2240
- A macro to construct 2240-bit unsigned
UD2240
decimal from literals in compile time. - udec2304
- A macro to construct 2304-bit unsigned
UD2304
decimal from literals in compile time. - udec2368
- A macro to construct 2368-bit unsigned
UD2368
decimal from literals in compile time. - udec2432
- A macro to construct 2432-bit unsigned
UD2432
decimal from literals in compile time. - udec2496
- A macro to construct 2496-bit unsigned
UD2496
decimal from literals in compile time. - udec2560
- A macro to construct 2560-bit unsigned
UD2560
decimal from literals in compile time. - udec2624
- A macro to construct 2624-bit unsigned
UD2624
decimal from literals in compile time. - udec2688
- A macro to construct 2688-bit unsigned
UD2688
decimal from literals in compile time. - udec2752
- A macro to construct 2752-bit unsigned
UD2752
decimal from literals in compile time. - udec2816
- A macro to construct 2816-bit unsigned
UD2816
decimal from literals in compile time. - udec2880
- A macro to construct 2880-bit unsigned
UD2880
decimal from literals in compile time. - udec2944
- A macro to construct 2944-bit unsigned
UD2944
decimal from literals in compile time. - udec3008
- A macro to construct 3008-bit unsigned
UD3008
decimal from literals in compile time. - udec3072
- A macro to construct 3072-bit unsigned
UD3072
decimal from literals in compile time. - udec3136
- A macro to construct 3136-bit unsigned
UD3136
decimal from literals in compile time. - udec3200
- A macro to construct 3200-bit unsigned
UD3200
decimal from literals in compile time. - udec3264
- A macro to construct 3264-bit unsigned
UD3264
decimal from literals in compile time. - udec3328
- A macro to construct 3328-bit unsigned
UD3328
decimal from literals in compile time. - udec3392
- A macro to construct 3392-bit unsigned
UD3392
decimal from literals in compile time. - udec3456
- A macro to construct 3456-bit unsigned
UD3456
decimal from literals in compile time. - udec3520
- A macro to construct 3520-bit unsigned
UD3520
decimal from literals in compile time. - udec3584
- A macro to construct 3584-bit unsigned
UD3584
decimal from literals in compile time. - udec3648
- A macro to construct 3648-bit unsigned
UD3648
decimal from literals in compile time. - udec3712
- A macro to construct 3712-bit unsigned
UD3712
decimal from literals in compile time. - udec3776
- A macro to construct 3776-bit unsigned
UD3776
decimal from literals in compile time. - udec3840
- A macro to construct 3840-bit unsigned
UD3840
decimal from literals in compile time. - udec3904
- A macro to construct 3904-bit unsigned
UD3904
decimal from literals in compile time. - udec3968
- A macro to construct 3968-bit unsigned
UD3968
decimal from literals in compile time. - udec4032
- A macro to construct 4032-bit unsigned
UD4032
decimal from literals in compile time. - udec4096
- A macro to construct 4096-bit unsigned
UD4096
decimal from literals in compile time. - udec4160
- A macro to construct 4160-bit unsigned
UD4160
decimal from literals in compile time. - udec4224
- A macro to construct 4224-bit unsigned
UD4224
decimal from literals in compile time. - udec4288
- A macro to construct 4288-bit unsigned
UD4288
decimal from literals in compile time. - udec4352
- A macro to construct 4352-bit unsigned
UD4352
decimal from literals in compile time. - udec4416
- A macro to construct 4416-bit unsigned
UD4416
decimal from literals in compile time. - udec4480
- A macro to construct 4480-bit unsigned
UD4480
decimal from literals in compile time. - udec4544
- A macro to construct 4544-bit unsigned
UD4544
decimal from literals in compile time. - udec4608
- A macro to construct 4608-bit unsigned
UD4608
decimal from literals in compile time. - udec4672
- A macro to construct 4672-bit unsigned
UD4672
decimal from literals in compile time. - udec4736
- A macro to construct 4736-bit unsigned
UD4736
decimal from literals in compile time. - udec4800
- A macro to construct 4800-bit unsigned
UD4800
decimal from literals in compile time. - udec4864
- A macro to construct 4864-bit unsigned
UD4864
decimal from literals in compile time. - udec4928
- A macro to construct 4928-bit unsigned
UD4928
decimal from literals in compile time. - udec4992
- A macro to construct 4992-bit unsigned
UD4992
decimal from literals in compile time. - udec5056
- A macro to construct 5056-bit unsigned
UD5056
decimal from literals in compile time. - udec5120
- A macro to construct 5120-bit unsigned
UD5120
decimal from literals in compile time. - udec5184
- A macro to construct 5184-bit unsigned
UD5184
decimal from literals in compile time. - udec5248
- A macro to construct 5248-bit unsigned
UD5248
decimal from literals in compile time. - udec5312
- A macro to construct 5312-bit unsigned
UD5312
decimal from literals in compile time. - udec5376
- A macro to construct 5376-bit unsigned
UD5376
decimal from literals in compile time. - udec5440
- A macro to construct 5440-bit unsigned
UD5440
decimal from literals in compile time. - udec5504
- A macro to construct 5504-bit unsigned
UD5504
decimal from literals in compile time. - udec5568
- A macro to construct 5568-bit unsigned
UD5568
decimal from literals in compile time. - udec5632
- A macro to construct 5632-bit unsigned
UD5632
decimal from literals in compile time. - udec5696
- A macro to construct 5696-bit unsigned
UD5696
decimal from literals in compile time. - udec5760
- A macro to construct 5760-bit unsigned
UD5760
decimal from literals in compile time. - udec5824
- A macro to construct 5824-bit unsigned
UD5824
decimal from literals in compile time. - udec5888
- A macro to construct 5888-bit unsigned
UD5888
decimal from literals in compile time. - udec5952
- A macro to construct 5952-bit unsigned
UD5952
decimal from literals in compile time. - udec6016
- A macro to construct 6016-bit unsigned
UD6016
decimal from literals in compile time. - udec6080
- A macro to construct 6080-bit unsigned
UD6080
decimal from literals in compile time. - udec6144
- A macro to construct 6144-bit unsigned
UD6144
decimal from literals in compile time. - udec6208
- A macro to construct 6208-bit unsigned
UD6208
decimal from literals in compile time. - udec6272
- A macro to construct 6272-bit unsigned
UD6272
decimal from literals in compile time. - udec6336
- A macro to construct 6336-bit unsigned
UD6336
decimal from literals in compile time. - udec6400
- A macro to construct 6400-bit unsigned
UD6400
decimal from literals in compile time. - udec6464
- A macro to construct 6464-bit unsigned
UD6464
decimal from literals in compile time. - udec6528
- A macro to construct 6528-bit unsigned
UD6528
decimal from literals in compile time. - udec6592
- A macro to construct 6592-bit unsigned
UD6592
decimal from literals in compile time. - udec6656
- A macro to construct 6656-bit unsigned
UD6656
decimal from literals in compile time. - udec6720
- A macro to construct 6720-bit unsigned
UD6720
decimal from literals in compile time. - udec6784
- A macro to construct 6784-bit unsigned
UD6784
decimal from literals in compile time. - udec6848
- A macro to construct 6848-bit unsigned
UD6848
decimal from literals in compile time. - udec6912
- A macro to construct 6912-bit unsigned
UD6912
decimal from literals in compile time. - udec6976
- A macro to construct 6976-bit unsigned
UD6976
decimal from literals in compile time. - udec7040
- A macro to construct 7040-bit unsigned
UD7040
decimal from literals in compile time. - udec7104
- A macro to construct 7104-bit unsigned
UD7104
decimal from literals in compile time. - udec7168
- A macro to construct 7168-bit unsigned
UD7168
decimal from literals in compile time. - udec7232
- A macro to construct 7232-bit unsigned
UD7232
decimal from literals in compile time. - udec7296
- A macro to construct 7296-bit unsigned
UD7296
decimal from literals in compile time. - udec7360
- A macro to construct 7360-bit unsigned
UD7360
decimal from literals in compile time. - udec7424
- A macro to construct 7424-bit unsigned
UD7424
decimal from literals in compile time. - udec7488
- A macro to construct 7488-bit unsigned
UD7488
decimal from literals in compile time. - udec7552
- A macro to construct 7552-bit unsigned
UD7552
decimal from literals in compile time. - udec7616
- A macro to construct 7616-bit unsigned
UD7616
decimal from literals in compile time. - udec7680
- A macro to construct 7680-bit unsigned
UD7680
decimal from literals in compile time. - udec7744
- A macro to construct 7744-bit unsigned
UD7744
decimal from literals in compile time. - udec7808
- A macro to construct 7808-bit unsigned
UD7808
decimal from literals in compile time. - udec7872
- A macro to construct 7872-bit unsigned
UD7872
decimal from literals in compile time. - udec7936
- A macro to construct 7936-bit unsigned
UD7936
decimal from literals in compile time. - udec8000
- A macro to construct 8000-bit unsigned
UD8000
decimal from literals in compile time. - udec8064
- A macro to construct 8064-bit unsigned
UD8064
decimal from literals in compile time. - udec8128
- A macro to construct 8128-bit unsigned
UD8128
decimal from literals in compile time. - udec8192
- A macro to construct 8192-bit unsigned
UD8192
decimal from literals in compile time.