Hello,
is there a way to initialize a floating point constant (code memory) with a raw binary value? Because we use a few special NAN flags and I cant initialize them using the CX51 compilier. With the IAR compilier I used a union and specified if the value should be interpreted as integer or floating point but with the CX51 compilier this is not possible for constant values because the compilier does not support this kind of initialization. It is part of C99 Standard but CX51 is C90. Maybe there is another way to do this.
Best regards
I mean I have for initialize the union with both float and integer.
For example:
union hack { uint32_t i; float f; }; const union hack[3] = { .i = 0x7FC00008U, .f = 1000.0, .i = 0x7FC00001U };
Then you're going to have to take my approach to find out what the required bit pattern is.
yes you are right. I convert the float to an integer in a prebuild step.
However it would be great if Cx51 would support C99 in an upcoming version. The competition is better here.
I rather doubt that C51 is a priority for Keil - an ARM company - these days ...
;)