| |
Overview
Declared in "futil.h"
futil namespace has eight functions for
floating-point operations.
namespace futil
{
// logical comparisons:
bool eq(double dLhs, double dRhs); // is dLhs == dRhs ?
bool neq(double dLhs, double dRhs); // is dLhs != dRhs ?
bool gt(double dLhs, double dRhs); // is dLhs > dRhs ?
bool gte(double dLhs, double dRhs); // is dLhs >= dRhs ?
bool lt(double dLhs, double dRhs); // is dLhs < dRhs ?
bool lte(double dLhs, double dRhs); // is dLhs <= dRhs ?
void round(double &dVal, int nDecimal); // round a value
int nsgn(double dVal); // sign of a value
}
Remarks
- round(dVal, nDecimal) is to round a value (dVal) to
a given number of decimal places (nDecimal).
- nsgn(dVal) determines the sign of a given value (dVal).
It returns 1 if the value is positive, -1 if negative, and 0 if value
is zero.
|