Hello,
I have a quick question: How do I get an easy solution for finding out wheather a float number is NaN?
I am using the MSP430F5529 and I do store some values in the internal InfoFlash segments. Now when erased or when writing to a completly new one the Flash segments are always 0XFFFF so 1s everywhere, this translates into NaN when I read out the flash and put it into my float variable.
f32_x = 0.0;
f32_x /= f32_x;
if (f32_x != f32_x ){
f32_x = 1;
}
This is my minimal code as I found out in the world wide web, this should result in NaN when compared to itself, but it does not work for me.
Anyone got ideas why this doesnt work or how it works properly.
If noone helps I think I have to do the workaround of not filling a float but rather fill a long variable and compare with a hex number, this will work, but I dont wanna do it like that since it is even more complicated for me I want to do it the nice elegant way.
Best wishes,
Seb