This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Add guard against Unicode breakage
[perl5.git] / lib / unicore / mktables
index 6d63c98..7c7dd6b 100644 (file)
@@ -12956,6 +12956,14 @@ sub register_fraction($) {
 
     my $float = eval $rational;
     $float = sprintf "%.*e", $E_FLOAT_PRECISION, $float;
+    if (   defined $nv_floating_to_rational{$float}
+        && $nv_floating_to_rational{$float} ne $rational)
+    {
+        die Carp::my_carp_bug("Both '$rational' and"
+                            . " '$nv_floating_to_rational{$float}' evaluate to"
+                            . " the same floating point number."
+                            . "  \$E_FLOAT_PRECISION must be increased");
+    }
     $nv_floating_to_rational{$float} = $rational;
     return;
 }