AnsweredAssumed Answered

SHARC 32 bit floating point

Question asked by MarcoK on Jul 2, 2015
Latest reply on Jul 2, 2015 by MarcoK

Hi,

 

When dealing with some small 32-bit floating point numbers I stumbled upon something unexpected.

 

What works as expected:

float a = 1e-30; // 1e-30

float b = 1 / a; // 1e+30

float c = sqrt(a); // 1e-15

 

But what surprised me:

float a = 1e-40; // 0.0

float b = 1 / a; // 1.#INF

float c = sqrt(a); // 0.0

 

I'm using a SHARC ADSP-21479 and CrossCore 1.1.1.0 and expected 32 bit floating point to be according to IEEE 754. But it seems the exponent cannot exceed 39?

 

Thanks in advance!

Outcomes