Sometimes, when you get floating-point errors due to compound calculations or aggregating functions in SELECT - SQL, you need to check if two numbers are "close enough" to each other (i.e. within a certain tolerance), rather than exactly equal.
FUNCTION CloseEnough
LPARAMETERS ;
tnFirstNumber, ;
tnSecondNumber, ;
tnPercentTolerance
RETURN ;
tnFirstNumber / tnSecondNumber >= (1 - (tnPercentTolerance / 100)) ;
AND tnFirstNumber / tnSecondNumber <= (1 + (tnPercentTolerance / 100))
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up