| fcmp | Function (ROM Call 0xBB)

timath.h

long fcmp (float x, float y);

Floating point comparation.

fcmp compares floating point arguments x and y, and returns a value which is

- < 0 if x is less than y
- == 0 if x is the same as y
- > 0 if x is greater than y

This function may be useful as a comparison function for qsort function from stdlib.html. All relation operators applied to floating point types are implemented through implicite calls of this function. At the fundamental level, fcmp is exactly the same routine as bcdcmp.
Note: All kind of zeros are equal from the aspect of comparation. Transfinite values are incomparable, and the result of fcmp is unpredictable (usually 1, but this is not guarantee) if any argument is transfinite. See ZERO, UNSIGNED_ZERO, POSITIVE_ZERO, NEGATIVE_ZERO, UNSIGNED_INF, POSITIVE_INF, NEGATIVE_INF and NAN for more details.

Uses: _bcd_math
Used by: bcdcmp