2

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?

Q-bertsuit
  • 3,223
  • 6
  • 30
  • 55
  • 5
    Could the difference be not in the memory representation but in how the values are handled? I.e. more of a speed-optimisation config than of a memory content config? – Yunnosch Aug 09 '17 at 09:06
  • What if you add `100` to `tt.hello`? Strict IEE-754 32bit should give you `100.0012359619140625` as a result. – YSC Aug 09 '17 at 09:12
  • ISTM that @Yunnosch is right. The representation doesn't have t be different, but I guess the algorithms handling (emulating) the math are different. Probably, one is more accurate and 100% IEEE compliant, the other is faster but cuts some corners and is therefore slightly less accurate than IEEE conformity requires. – Rudy Velthuis Aug 09 '17 at 09:56
  • Thanks for your input guys. You are probably right! – Q-bertsuit Aug 09 '17 at 09:58
  • @YSC I think IEEE-754 can represent 100 exactly? Try here: https://www.h-schmidt.net/FloatConverter/IEEE754.html – Q-bertsuit Aug 09 '17 at 09:59
  • @Q-bertsuit: It can (only needs 7 bits). The problem is `0.00123456789` which needs an infinite number of bits. – MSalters Aug 09 '17 at 10:05
  • @Q-bertsuit but not 100 + 0.00123456789 ;) – YSC Aug 09 '17 at 10:59
  • Sorry, didn't see *Add* 100 ;-) – Q-bertsuit Aug 09 '17 at 12:20

1 Answers1

4

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.

Rudy Velthuis
  • 28,387
  • 5
  • 46
  • 94
MSalters
  • 173,980
  • 10
  • 155
  • 350