In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/b4a3b1adcef1001d81018aed8b7d1b26d223601a?hp=f6807ef7d323c1a8bd2c4e2bb6a34c434ab13eca>

- Log -----------------------------------------------------------------
commit b4a3b1adcef1001d81018aed8b7d1b26d223601a
Author: Jarkko Hietaniemi <[email protected]>
Date:   Sat Sep 6 14:12:05 2014 -0400

    Long double might have INFINITYL or NANL.

M       perl.h

commit 29b9baacc932a0194ba6d2ff297ac42925e98707
Author: Jarkko Hietaniemi <[email protected]>
Date:   Sat Sep 6 14:08:20 2014 -0400

    The .i target should depend at least on perl.h and config.h.
    
    While at it, do the same for the .s target.

M       Makefile.SH

commit 67aa9fabcf116a0e9b3c2f88f6a9103cc7e18c52
Author: Jarkko Hietaniemi <[email protected]>
Date:   Sat Sep 6 14:05:33 2014 -0400

    NV_INF/NV_NAN fallback where int32 is coerced to IEEE754 float.
    
    This is the second-to-last fallback.  The last one uses explicit
    1/0.0 and 0/0.0 which may cause consternation with some compilers.

M       perl.h

commit 36467c3a119e77960ac9ab7c5a82cbbedbca8efd
Author: Jarkko Hietaniemi <[email protected]>
Date:   Sat Sep 6 07:49:03 2014 -0400

    POSIX math: Add the opengroup URL for math.h

M       ext/POSIX/POSIX.xs
-----------------------------------------------------------------------

Summary of changes:
 Makefile.SH        |  4 ++--
 ext/POSIX/POSIX.xs |  3 +++
 perl.h             | 52 ++++++++++++++++++++++++++++++++++++++++++++++------
 3 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/Makefile.SH b/Makefile.SH
index 6a4ddbb..4488f4a 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -555,11 +555,11 @@ splintfiles = $(c1)
        @echo `$(CCCMD)` $(PLDLFLAGS) $*.c
        @`$(CCCMD)` $(PLDLFLAGS) $*.c
 
-.c.i: 
+.c.i:  perl.h config.h
        @echo `$(CCCMDSRC)` -E $*.c \> $*.i
        @`$(CCCMDSRC)` -E $*.c > $*.i
 
-.c.s:
+.c.s:  perl.h config.h
        @echo `$(CCCMDSRC)` -S $*.c
        @`$(CCCMDSRC)` -S $*.c
 
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 34596ec..24ff9d1 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -147,6 +147,9 @@
    log1p log2 logb lrint nan nearbyint nextafter nexttoward remainder
    remquo rint round scalbn signbit tgamma trunc
 
+   See:
+   http://pubs.opengroup.org/onlinepubs/009695399/basedefs/math.h.html
+
  * Berkeley/SVID extensions:
 
    j0 j1 jn y0 y1 yn
diff --git a/perl.h b/perl.h
index 933262a..f3ae3eb 100644
--- a/perl.h
+++ b/perl.h
@@ -4128,8 +4128,13 @@ END_EXTERN_C
  * and the math functions might be just generating DBL_MAX, or even
  * zero.  */
 
-#if !defined(NV_INF) && defined(USE_LONG_DOUBLE) && defined(LDBL_INFINITY)
-#  define NV_INF LDBL_INFINITY
+#if !defined(NV_INF) && defined(USE_LONG_DOUBLE)
+#  if !defined(NV_INF) && defined(LDBL_INFINITY)
+#    define NV_INF LDBL_INFINITY
+#  endif
+#  if !defined(NV_INF) && defined(INFINITYL)
+#    define NV_INF INFINITYL
+#  endif
 #endif
 #if !defined(NV_INF) && defined(DBL_INFINITY)
 #  define NV_INF (NV)DBL_INFINITY
@@ -4141,6 +4146,29 @@ END_EXTERN_C
 #  define NV_INF (NV)INF
 #endif
 #if !defined(NV_INF)
+#  if INTSIZE == 4
+/* At this point we assume the IEEE 754 floating point (and of course,
+ * we also assume a floating point format that can encode an infinity).
+ * We will coerce an int32 (which will encode the infinity) into
+ * a 32-bit float, which will then be cast into NV.
+ *
+ * Note that we intentionally use a float and 32-bit int, instead of
+ * shifting a small integer into a full IV, and from that into a full
+ * NV, because:
+ *
+ * (1) an IV might not be wide enough to cover all the bits of an NV.
+ * (2) the exponent part (including the infinity and nan bits) of a NV
+ *     might be wider than just 16 bits.
+ *
+ * Below the NV_NAN logic has similar __PL_nan_u fallback, the only
+ * difference being the int32 constant being coerced. */
+#    define __PL_inf_float_int32 0x7F800000
+static const union { unsigned int __i; float __f; } __PL_inf_u =
+    { __PL_inf_float_int32 };
+#    define NV_INF ((NV)(__PL_inf_u.__f))
+#  endif
+#endif
+#if !defined(NV_INF)
 #  define NV_INF ((NV)1.0/0.0) /* Some compilers will warn. */
 #endif
 
@@ -4148,6 +4176,9 @@ END_EXTERN_C
 #   if !defined(NV_NAN) && defined(LDBL_NAN)
 #       define NV_NAN LDBL_NAN
 #   endif
+#   if !defined(NV_NAN) && defined(NANL)
+#       define NV_NAN NANL
+#   endif
 #   if !defined(NV_NAN) && defined(LDBL_QNAN)
 #       define NV_NAN LDBL_QNAN
 #   endif
@@ -4164,16 +4195,25 @@ END_EXTERN_C
 #if !defined(NV_NAN) && defined(DBL_SNAN)
 #  define NV_NAN (NV)DBL_SNAN
 #endif
-#if !defined(NV_NAN) && defined(QNAN)
-#  define NV_NAN (NV)QNAN
-#endif
 #if !defined(NV_NAN) && defined(NAN)
 #  define NV_NAN (NV)NAN
 #endif
+#if !defined(NV_NAN) && defined(QNAN)
+#  define NV_NAN (NV)QNAN
+#endif
 #if !defined(NV_NAN) && defined(SNAN)
 #  define NV_NAN (NV)SNAN
 #endif
-#if !defined(NV_NAN) && defined(NV_INF)
+#if !defined(NV_NAN)
+#  if INTSIZE == 4
+/* See the discussion near __PL_inf_u. */
+#    define __PL_nan_float_int32 0x7FC00000
+static const union { unsigned int __i; float __f; } __PL_nan_u =
+    { __PL_nan_float_int32 };
+#    define NV_NAN ((NV)(__PL_nan_u.__f))
+#  endif
+#endif
+#if !defined(NV_NAN)
 #  define NV_NAN ((NV)0.0/0.0) /* Some compilers will warn. */
 #endif
 

--
Perl5 Master Repository

Reply via email to