Table of Contents

Class PrecisionMismatchException

Namespace
Virtufin.Core.Position
Assembly
Virtufin.Core.dll

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

leftBase int

Left operand base.

leftPrecision int

Left operand precision.

rightBase int

Right operand base.

rightPrecision int

Right operand precision.

Properties

LeftBase

Base of the left-hand operand.

public int LeftBase { get; }

Property Value

int

LeftPrecision

Precision of the left-hand operand.

public int LeftPrecision { get; }

Property Value

int

RightBase

Base of the right-hand operand.

public int RightBase { get; }

Property Value

int

RightPrecision

Precision of the right-hand operand.

public int RightPrecision { get; }

Property Value

int