FloatingPointComparisonDivideRoundTripIsLessOrEqual Method |
Divides a dividend by a divisor such that if the quotient is later multiplied by the
divisor the result is less than or equal to the dividend.
Namespace:
AGI.Foundation
Assembly:
AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.2.419.0 (24.2.419.0)
Syntax public static double DivideRoundTripIsLessOrEqual(
double dividend,
double divisor
)
Public Shared Function DivideRoundTripIsLessOrEqual (
dividend As Double,
divisor As Double
) As Double
public:
static double DivideRoundTripIsLessOrEqual(
double dividend,
double divisor
)
static member DivideRoundTripIsLessOrEqual :
dividend : float *
divisor : float -> float
Parameters
- dividend
- Type: SystemDouble
The dividend. - divisor
- Type: SystemDouble
The divisor.
Return Value
Type:
DoubleThe quotient.
Remarks
If floating point numbers were infinitely precise, this method would be unnecessary.
Since they're not, this method allows you to have control over how the error falls.
For example, imagine that you have a floating point number that represents the maximum
value allowed as input to a function. You want to express that maximum value in a
different set of units such that the user can pass the maximum value to the function in
that different set of units. By using this method to do the conversion to the alternate
set of units, you guarantee that upon converting that value back to the original set
of units the value will be less than or equal to the original maximum value. Using a
normal division might cause the value to actually be greater than the maximum upon doing the
round-trip conversion, which would likely cause the function to fail.
See Also