develooper Front page | perl.perl5.porters | Postings from February 2015

SNAN/QNAN constants

From:
ilmari
Date:
February 4, 2015 14:30
Subject:
SNAN/QNAN constants
Message ID:
d8jbnl921hb.fsf@dalvik.ping.uio.no
I noticed an obvious typo in this commit:

commit 533686c97e2bcc046e9f800c5a5501785c800c62
Author: Jarkko Hietaniemi <jhi@iki.fi>
Date:   2015-02-01 12:16:59 -0500

    infnan: define NV_QNAN and NV_SNAN if feasible

[perl.h]
 #if !defined(NV_NAN) && defined(DBL_SNAN)
 #  define NV_NAN (NV)DBL_SNAN
+#  define NV_SNAN DBL_QNAN
 #endif

Surely that should be DBL_SNAN, not QNAN.

Another thing I noticed is that NV_QNAN and NV_SNAN only get set if none
of the NAN forms checked before them are defined, but they don't get set
if plain SNAN or QNAN are the chosen NAN form:

#if !defined(NV_NAN) && defined(QNAN)
#  define NV_NAN (NV)QNAN
#endif
#if !defined(NV_NAN) && defined(SNAN)
#  define NV_NAN (NV)SNAN
#endif

I don't know which platforms provide those constants, and what
combinations they exist in, but if NV_QNAN and NV_SNAN are to be useful
at all, they should be defined whenever the platform provides explicit
quiet and signalling NaNs, regardless of which one NV_NAN ends up being.

-- 
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About