On Thu, Jul 11, 2013, David Chisnall wrote: > +static __inline int > +__inline_isnan(double __x) > +{ > + > + return (__x != __x); > +} > + > +static __inline int > +__inline_isnanf(float __x) > +{ > + > + return (__x != __x); > +} > + > +static __inline int > +__inline_isnanl(long double __x) > +{ > + > + return (__x != __x); > +}
This has already been covered at greater length, but I believe this part is incorrect. Relational operators can raise an invalid exception when one of the arguments is a NaN -- even a quiet NaN. Raising an exception is optional in C99 (7.12.14) and required in IEEE-754... in practice, it tends to be platform- and compiler- specific. That is the whole reason the is* macros are defined by the standard in the first place, and also why we didn't use the trivial implementation above. The is* macros are required to not raise an exception. P.S. It would be great if clang implemented the FENV_ACCESS pragma and provided an intrinsic that produced a fast inline isnan() when the pragma is off, and the full, correct one when the pragma is on. _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"