Skip to content

float_compare

Floating Point Numbers (XFL)
  • Evaluate a comparison of two XFL floating point numbers
  • Return the result of the comparison as a boolean encoded in an int64_t.
int64_t float_compare (
int64_t float1,
int64_t float2,
uint32_t mode
);
if (float_compare(pusd_to_send, 0, COMPARE_LESS) == 1)
{
// pusd_to_send is less than 0
}
NameTypeDescription
float1int64_tAn XFL floating point enclosing number representing the first operand to the comparison
float2int64_tAn XFL floating point enclosing number representing the second operand to the comparison
modeuint32_tA bit-flag field consisting of any of (or any logically valid combination of) the following flags:
COMPARE_LESS
COMPARE_EQUAL
COMPARE_GREATER

Valid combinations are:
COMPARE_LESS
TypeDescription
int64_t0 if the comparison was logically false.
1 if the comparison was logically true.

If negative, an error:
INVALID_FLOAT
- one of the supplied parameters was not a valid XFL enclosing number

INVALID_ARGUMENT
- invalid combination of supplied comparison flags.