Class QuantityFunctions
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
QuantLib's free functions of quantity.hpp: the closeness of two quantities.
[Experimental("NQL0001")]
public static class QuantityFunctions
- Inheritance
-
QuantityFunctions
- Inherited Members
Methods
Close(Quantity, Quantity, EvaluationContext, int)
Whether two quantities are close within n ulps, as Close(double, double, int) compares their amounts, converting as the context's quantity settings say.
public static bool Close(Quantity q1, Quantity q2, EvaluationContext context, int n = 42)
Parameters
q1QuantityThe first quantity.
q2QuantityThe second quantity.
contextEvaluationContextThe evaluation context, whose quantity settings and unit conversions are read.
nintThe number of ulps.
Returns
- bool
Whether the amounts, once converted, are close.
Exceptions
- ArgumentNullException
contextis null.- NanoQLException
The units differ under NoConversion; no base unit is set; or a conversion can't be found.
CloseEnough(Quantity, Quantity, EvaluationContext, int)
Whether two quantities are close enough within n ulps, as
CloseEnough(double, double, int) compares their amounts, converting as the
context's quantity settings say.
public static bool CloseEnough(Quantity q1, Quantity q2, EvaluationContext context, int n = 42)
Parameters
q1QuantityThe first quantity.
q2QuantityThe second quantity.
contextEvaluationContextThe evaluation context, whose quantity settings and unit conversions are read.
nintThe number of ulps.
Returns
- bool
Whether the amounts, once converted, are close enough.
Exceptions
- ArgumentNullException
contextis null.- NanoQLException
The units differ under NoConversion; no base unit is set; or a conversion can't be found.