Search code examples
c++cfloating-pointieee-754blackfin

IEEE floating point and fast floating point representation in memory


The BFF-533 processor from Analog Devices does not offer native floating point support but does offer floating point emulation.

Using the IDE VisualDSP++, the user is allowed to select between High Performing floating point and strict IEEE compliance.

From what I understand, the difference between these two result in a different representation of a floating point value in memory, so I did the following test:

union TestType
{
    float hello;
    char test[4];   
};

TestType tt;
tt.hello = 0.00123456789;

I compiled and ran this with both options, expecting to see a different value in the test array, but I got the same each run:

enter image description here

Can someone explain why I'm seeing what appears to be the IEEE representation in both runs?


Solution

  • The document you reference discusses a User-Defined fastfloat16 type. You use the native float type here. I don't think they're equivalent, regardless of the VisualDSP settings.

    "Strict IEEE compliance" is usually interpreted as "even the edge cases are handled correctly". Edge cases for IEE754 are things like denormals, division by zero, infinities, Not-a-Number etc. One example, in IEEE754 NaN != NaN. This means you can't do a fast 32 bits comparison. Another example is that IEEE754 mandates that the basic math operations are exact to the last bit. There's a significant speedup achievable by using the IEEE754 float layout, but not IEEE754 math.