use Config;
-plan(tests => 109);
+plan(tests => 112);
# Test hexfloat literals.
is(0x1p-16445, 3.6451995318824746e-4951);
}
+# [perl #131894] parsing long binaryish floating point literals used to
+# perform illegal bit shifts
+SKIP: {
+ skip("non-64-bit NVs", 1)
+ unless $Config{nvsize} == 8 && $Config{d_double_style_ieee};
+ is sprintf("%a", eval("0x030000000000000.1p0")), "0x1.8p+53";
+ is sprintf("%a", eval("01400000000000000000.1p0")), "0x1.8p+54";
+ is sprintf("%a", eval("0b110000000000000000000000000000000000000000000000000000000.1p0")), "0x1.8p+56";
+}
+
# sprintf %a/%A testing is done in sprintf2.t,
# trickier than necessary because of long doubles,
# and because looseness of the spec.
hexfp_uquad <<= shift;
hexfp_uquad |= b;
hexfp_frac_bits += shift;
- } else {
+ } else if (significant_bits - shift < NV_MANT_DIG) {
/* We are at a hexdigit either at,
* or straddling, the edge of mantissa.
* We will try grabbing as many as