Table of Contents

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

q1 Quantity

The first quantity.

q2 Quantity

The second quantity.

context EvaluationContext

The evaluation context, whose quantity settings and unit conversions are read.

n int

The number of ulps.

Returns

bool

Whether the amounts, once converted, are close.

Exceptions

ArgumentNullException

context is 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

q1 Quantity

The first quantity.

q2 Quantity

The second quantity.

context EvaluationContext

The evaluation context, whose quantity settings and unit conversions are read.

n int

The number of ulps.

Returns

bool

Whether the amounts, once converted, are close enough.

Exceptions

ArgumentNullException

context is null.

NanoQLException

The units differ under NoConversion; no base unit is set; or a conversion can't be found.