summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-08-15 15:18:06 -0600
committerKarl Williamson <khw@cpan.org>2018-08-20 09:50:29 -0600
commit7e659d181665d5c61b402279e99da3381e2af78e (patch)
tree0bc426eeb491b87db069581181c512696581e577 /lib
parent9d890beed61e079102335ef5859d652b4e2c32ac (diff)
downloadperl-7e659d181665d5c61b402279e99da3381e2af78e.tar.gz
mktables: Handle platforms with 3 digit exponents
C99 says there shouldn't be more than 2 digits in an exponent unless needed. But Windows uses three. This messes some stuff up that is expecting two. Change to remove leading zeros so that only two digits are used. This allows mktables to properly operate on Windows.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicore/mktables5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/unicore/mktables b/lib/unicore/mktables
index 38f5c9fa3e..da5a919f8e 100644
--- a/lib/unicore/mktables
+++ b/lib/unicore/mktables
@@ -12968,6 +12968,11 @@ sub register_fraction($) {
my $float = eval $rational;
$float = sprintf "%.*e", $E_FLOAT_PRECISION, $float;
+
+ # Strip off any leading zeros beyond 2 digits to make it C99 compliant.
+ # (Windows has 3 digit exponents, contrary to C99)
+ $float =~ s/ ( .* e [-+] ) 0* ( \d{2,}? ) /$1$2/x;
+
if ( defined $nv_floating_to_rational{$float}
&& $nv_floating_to_rational{$float} ne $rational)
{