Does OpenAT support floating point operations?


#1

OpenAT does support floating point operations to single precision with the
following limitation and works around.
This is not an issue with the ARM compiler.

Important remark about GCC compiler:
When using GCC compiler, due to internal standard C library architecture, it is strongly not recommended to use the “%f” mode in the wm_sprintf function
in order to convert a float variable to a string.
This leads to an ARM exception (product reset).

A way around for this conversion is:

float MyFloat; // float to display
ascii MyString [ 100 ]; // destination string
s16 d,f;
d = (s16) MyFloat * 1000; // Decimal precision: 3 digits
f = ( MyFLoat * 1000 ) - d; // Decimal precision: 3 digits
wm_sprintf ( MyString, “%d.%03d”, (s16)MyFloat, f ); // Decimal precision: 3 digits