Sujet : Re: Making Lemonade (Floating-point format changes)
De : mitchalsup (at) *nospam* aol.com (MitchAlsup1)
Groupes : comp.archDate : 21. May 2024, 23:12:43
Autres entêtes
Organisation : Rocksolid Light
Message-ID : <b9f4eebe94e1f90810e82678d88df1bb@www.novabbs.org>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Rocksolid Light
BGB wrote:
Currently, FCMPEQ will be false on NaN, whereas FCMPGT ignores NaN's.
I guess possible could be to add an FCMPGE instruction, and then make both FCMPGT and FCMPGE be false on NaN (where the LT and LE cases can be
handled by flipping the arguments, so would still be false on NaN).
So, as-is:
if(!(a==a))
{
//NaN
}
But, as-is:
if(a>0)
{
//May still potentially get here with NaN
}
Not when the compare is true to IEEE 754. When there is a floating
point
compare and one of the operands is NaN, none of the 6 standard
comparison
forms are true and control transfers to the else-clause.
In your top example the ! (not) causes NaNs to go to the then-clause
In your bottom example, no NaN is allowed into the then-clause.