Does P2020 conforms to the IEEE 754?

Showing results for 
Search instead for 
Did you mean: 

Does P2020 conforms to the IEEE 754?

Contributor I

In one of my applications, I verify that the double-precision value is not a NAN value. 

According to the IEEE 754, NAN == NAN is false. But the code that GCC generates for this condition:

             efdcmpeq  cr7,r10,r9

sets cr7 to 4 (cr7 gt) when r10 and r9 are set to NAN. In the end, it produces true as result of the comparison.

So who is wrong: GCC, P2020, or I do something wrong?

Tags (1)
0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport

Embedded floating-point operations largely comply with the IEEE-754 floating-point standard.

Software exception handling is required to achieve full IEEE 754-compliance because the IEEE floating-point exception model is not fully implemented in hardware.

Please refer to the PowerPC e500 Core Family Reference Manual, efdcmpeq Floating-Point Double-Precision Compare Equal:

"If the contents of rA or rB are Infinity, Denorm, or NaN, SPEFSCR[FINV] is set, and the FGH FXH, FG and FX bits are cleared. If floating-point invalid input exceptions are enabled, an interrupt is taken and the condition register is not updated. Otherwise, the comparison proceeds after treating NaNs, Infinities, and Denorms as normalized numbers, using their values of ‘e’ and ‘f’ directly."

0 Kudos