#[repr(C)]pub struct IOUNumber(pub [u8; 8]);Expand description
The 8-byte value field of an XRPL fungible token (IOU) amount.
This is the leading 8 bytes of a serialized IOU STAmount (the value, without the trailing
currency and issuer). It is not an STAmount, and it is a different encoding from the
12-byte STNumber used for host arithmetic.
The format is [Type:1][Sign:1][Exponent:8][Mantissa:54] bits, big-endian.
§Important
This type is a read-only wire representation. Arithmetic MUST be performed through the host’s
Number (STNumber) type, which uses rippled’s Number class to stay consensus-exact. The
accessors below expose the raw encoded fields for inspection only.
§Format Details
- Type bit (bit 63): Always 1 for fungible tokens
- Sign bit (bit 62): 1 = positive, 0 = negative
- Exponent (bits 61-54): 8 bits, biased by 97 (real exponent range -96 to +80)
- Mantissa (bits 53-0): 54 bits providing ~16 decimal digits precision
§Special Values
- Zero:
0x8000000000000000(mantissa is 0) - Maximum: ~9.999999999999999 × 10^80
- Minimum positive: ~1.0 × 10^-81
§Derived Traits
PartialEq, Eq: Enable comparisons (bitwise comparison only)Debug, Clone: Standard traits for development and consistency
Note: PartialEq and Eq perform bitwise comparison only. For semantic comparison of
amounts (e.g., handling different representations of zero), convert to Number and compare
there.
Tuple Fields§
§0: [u8; 8]Implementations§
Source§impl IOUNumber
impl IOUNumber
Sourcepub fn is_positive(&self) -> bool
pub fn is_positive(&self) -> bool
Returns true if the sign bit marks this value as positive.
Note the sign bit is meaningless for zero; prefer IOUNumber::is_zero to test for zero.