Class NumberType
XRPL Number type (serialized type code 9). Serialized as 12 bytes big-endian:
8 bytes — mantissa (signed int64, big-endian)
4 bytes — exponent (signed int32, big-endian)
For non-zero values, mantissa is normalized to [10^18, long.MaxValue (2^63-1)].
Zero is represented as mantissa=0, exponent=Int32.MinValue (-2147483648).
Exponent range: [-32768, 32768].
Used by Loan/LoanBroker fields (PrincipalRequested, DebtMaximum, etc.) per XLS-66.
Encoding matches rippled Number class (include/xrpl/basics/Number.h).
Inheritance
object
NumberType
Assembly: Xrpl.BinaryCodec.dll
Syntax
public class NumberType : ISerializedType
Constructors
|
Edit this page
View Source
NumberType(long, int)
Declaration
public NumberType(long mantissa, int exponent)
Parameters
| Type |
Name |
Description |
| long |
mantissa |
|
| int |
exponent |
|
Fields
|
Edit this page
View Source
Exponent
Declaration
public readonly int Exponent
Field Value
|
Edit this page
View Source
Mantissa
Declaration
public readonly long Mantissa
Field Value
Methods
|
Edit this page
View Source
FromJson(JsonNode)
Declaration
public static NumberType FromJson(JsonNode token)
Parameters
| Type |
Name |
Description |
| JsonNode |
token |
|
Returns
|
Edit this page
View Source
FromParser(BinaryParser, int?)
Declaration
public static NumberType FromParser(BinaryParser parser, int? hint = null)
Parameters
Returns
|
Edit this page
View Source
FromString(string)
Parse a decimal string (e.g. "10000000000000", "0", "-500", "1e-32000")
into the XRPL Number wire format.
Uses BigInteger-based parsing to handle the full XRPL exponent range (±32768)
which exceeds System.Decimal capacity.
Normalizes mantissa to [10^18, long.MaxValue] per rippled Number class.
Declaration
public static NumberType FromString(string str)
Parameters
| Type |
Name |
Description |
| string |
str |
|
Returns
|
Edit this page
View Source
ToBytes(IBytesSink)
Declaration
public void ToBytes(IBytesSink sink)
Parameters
| Type |
Name |
Description |
| IBytesSink |
sink |
bytes Sink container
|
|
Edit this page
View Source
ToJson()
Get the JSON representation of this type
Declaration
Returns
| Type |
Description |
| JsonNode |
|
|
Edit this page
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
object.ToString()
Implements
Extension Methods