It's amazing the things one can learn.
So yesterday I finally figured out the FLR in XML does not work exactly like floor() does in C++ and that is why one of my radio gauges was doing stupid things.
FLR is defined in the SDK as "Calculates nearest integer number which is less than the source number"
while floor(x) is defined as largest integer <= x
The tricky difference is the "less than" versus the "<=".
So in FSX XML "45.56 flr" returns 45 and "45.00 flr" returns 44 (technically 44 is the nearest integer less than 45)
While in C++ floor(45.56) returns 45 and floor (45.00) returns 45 (less than or equal to makes all the difference).
floor is great because it just gives you the integer part of the number you are checking.
flr is not so great because it gives you 1 less than you expected if the number has no decimal places.
The trick when using FSX XML flr is to add a small fraction (eg 0.0000001) to the number before you use flr.
I think it is about time that I stopped using XML gauges and went fully C++
So yesterday I finally figured out the FLR in XML does not work exactly like floor() does in C++ and that is why one of my radio gauges was doing stupid things.
FLR is defined in the SDK as "Calculates nearest integer number which is less than the source number"
while floor(x) is defined as largest integer <= x
The tricky difference is the "less than" versus the "<=".
So in FSX XML "45.56 flr" returns 45 and "45.00 flr" returns 44 (technically 44 is the nearest integer less than 45)
While in C++ floor(45.56) returns 45 and floor (45.00) returns 45 (less than or equal to makes all the difference).
floor is great because it just gives you the integer part of the number you are checking.
flr is not so great because it gives you 1 less than you expected if the number has no decimal places.
The trick when using FSX XML flr is to add a small fraction (eg 0.0000001) to the number before you use flr.
I think it is about time that I stopped using XML gauges and went fully C++



