Compare two double values and see if they are equal or not.
BOOL is_equal( double x, double y, int nCode = '=' )
Return true if equal when testing equality or unequal when testing inequality, else false.
EX1
void is_equal_ex1() { double a = 1.; // add 1.e-17: a += 1.e-17; // Compare with 1.: if (is_equal(a, 1.)) { // If @ND still has the default value, which is 1.e-16, this will be true. out_str("a is 1."); } else { out_str("a is not 1."); } // add 1.e-14 a += 1.e-14; if (is_equal(a, 1.)) { // If @ND still has the default value, which is 1.e-16, this will be false. out_str("a is 1."); } else { out_str("a is not 1."); } }
compare two double values and see if they are equal or not equal in the same sense as in LabTalk.
This function uses the LabTalk system variable @ND to test if (abs(x)-abs(y))/((abs(x)+abs(y)) is less then @ND or not. If @ND = 0, it does standard arithmetic comparison x == y.
origin.h