This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #128919] limited exponent range in hex fp literal with long double
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 13 Aug 2016 23:13:58 +0000 (19:13 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 14 Aug 2016 01:30:58 +0000 (21:30 -0400)
t/op/hexfp.t
toke.c

index 4b2a96d..d6c0482 100644 (file)
@@ -10,7 +10,7 @@ use strict;
 
 use Config;
 
-plan(tests => 105);
+plan(tests => 109);
 
 # Test hexfloat literals.
 
@@ -243,6 +243,16 @@ SKIP:
     }
 }
 
+# [perl #128919] limited exponent range in hex fp literal with long double
+SKIP: {
+    skip("nv_preserves_uv_bits is $Config{nv_preserves_uv_bits} not 64", 4)
+        unless ($Config{nv_preserves_uv_bits} == 64);
+    is(0x1p-1074,  4.94065645841246544e-324);
+    is(0x1p-1075,  2.47032822920623272e-324, '[perl #128919]');
+    is(0x1p-1076,  1.23516411460311636e-324);
+    is(0x1p-16445, 3.6451995318824746e-4951);
+}
+
 # sprintf %a/%A testing is done in sprintf2.t,
 # trickier than necessary because of long doubles,
 # and because looseness of the spec.
diff --git a/toke.c b/toke.c
index d714759..2c28146 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -10585,7 +10585,7 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
 #ifdef HEXFP_UQUAD
                         hexfp_exp -= hexfp_frac_bits;
 #endif
-                        hexfp_mult = pow(2.0, hexfp_exp);
+                        hexfp_mult = Perl_pow(2.0, hexfp_exp);
                         hexfp = TRUE;
                         goto decimal;
                     }