Class NumberContext
The rules an XrplNumber operation follows: the mantissa scale and the rounding mode. rippled keeps both in thread-local state switched by guards; here they are an explicit argument, so a result never depends on what another piece of code set before.
Inheritance
object
NumberContext
Namespace: Xrpl.BinaryCodec.Numbers
Assembly: Xrpl.BinaryCodec.dll
Syntax
public sealed class NumberContext
Properties
| Edit this page View SourceDefault
The newest rules - Large330 - rounding to nearest.
Declaration
public static NumberContext Default { get; }
Property Value
| Type | Description |
|---|---|
| NumberContext |
Rounding
The rounding mode.
Declaration
public NumberRounding Rounding { get; }
Property Value
| Type | Description |
|---|---|
| NumberRounding |
Scale
The mantissa scale.
Declaration
public NumberMantissaScale Scale { get; }
Property Value
| Type | Description |
|---|---|
| NumberMantissaScale |
Methods
| Edit this page View SourceCreate(NumberMantissaScale, NumberRounding)
Creates a context for a scale and a rounding mode.
Declaration
public static NumberContext Create(NumberMantissaScale scale, NumberRounding rounding = NumberRounding.ToNearest)
Parameters
| Type | Name | Description |
|---|---|---|
| NumberMantissaScale | scale | |
| NumberRounding | rounding |
Returns
| Type | Description |
|---|---|
| NumberContext |
ForAmendments(bool, bool, bool)
The context rippled uses for a ledger with these amendments, rounding to nearest.
Declaration
public static NumberContext ForAmendments(bool largeNumbers, bool fixCleanup320, bool fixCleanup330)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | largeNumbers | Whether SingleAssetVault or LendingProtocol is enabled. |
| bool | fixCleanup320 | Whether |
| bool | fixCleanup330 | Whether |
Returns
| Type | Description |
|---|---|
| NumberContext |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
object.ToString()
|
Edit this page
View Source
WithRounding(NumberRounding)
The same scale with another rounding mode.
Declaration
public NumberContext WithRounding(NumberRounding rounding)
Parameters
| Type | Name | Description |
|---|---|---|
| NumberRounding | rounding |
Returns
| Type | Description |
|---|---|
| NumberContext |