Class PrecisionMismatchException
Thrown when two IFixedPointAmount values are combined by an operation that requires a common scaling factor (equality, ordering, addition, subtraction) but their base and/or precision differ.
public sealed class PrecisionMismatchException : ArgumentException, ISerializable
- Inheritance
-
PrecisionMismatchException
- Implements
- Inherited Members
Remarks
The invariant is enforced at runtime because C# lacks dependent types: a fixed-point amount's base and precision cannot be encoded in its static type, so the compiler cannot reject a mismatched operation.
Constructors
PrecisionMismatchException(int, int, int, int)
Construct the exception for a pair of mismatched operands.
public PrecisionMismatchException(int leftBase, int leftPrecision, int rightBase, int rightPrecision)
Parameters
leftBaseintLeft operand base.
leftPrecisionintLeft operand precision.
rightBaseintRight operand base.
rightPrecisionintRight operand precision.
Properties
LeftBase
Base of the left-hand operand.
public int LeftBase { get; }
Property Value
LeftPrecision
Precision of the left-hand operand.
public int LeftPrecision { get; }
Property Value
RightBase
Base of the right-hand operand.
public int RightBase { get; }
Property Value
RightPrecision
Precision of the right-hand operand.
public int RightPrecision { get; }