summaryrefslogtreecommitdiff
path: root/t/base
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2002-08-17 00:31:07 +0100
committerhv <hv@crypt.org>2002-08-18 18:27:28 +0000
commit8194bf885900463241631dc78b51b65378478827 (patch)
treefba9ae1b2617aca986e4b013659f936d43f6171a /t/base
parent0b17b39ba5d75cadbeee8e3e069ab9986688c352 (diff)
downloadperl-8194bf885900463241631dc78b51b65378478827.tar.gz
Re: 5.8.0 sprintf (?) problem with floats?
Message-id: <20020816233107.E9388@fdgroup.com> p4raw-id: //depot/perl@17736
Diffstat (limited to 't/base')
-rw-r--r--t/base/num.t19
1 files changed, 17 insertions, 2 deletions
diff --git a/t/base/num.t b/t/base/num.t
index 97fa312893..714881e977 100644
--- a/t/base/num.t
+++ b/t/base/num.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..45\n";
+print "1..49\n";
# First test whether the number stringification works okay.
# (Testing with == would exercize the IV/NV part, not the PV.)
@@ -69,7 +69,7 @@ $a = -1.; "$a";
print $a + 1 == 0 ? "ok 19\n" : "not ok 19 #" . $a + 1 . "\n";
sub ok { # Can't assume too much of floating point numbers.
- my ($a, $b, $c);
+ my ($a, $b, $c) = @_;
abs($a - $b) <= $c;
}
@@ -164,3 +164,18 @@ print $a eq "123.456" ? "ok 44\n" : "not ok 44 # $a\n";
$a = 1e34; "$a";
print $a eq "1e+34" || $a eq "1e+034" ? "ok 45\n" : "not ok 45 $a\n";
+
+# see bug #15073
+
+$a = 0.00049999999999999999999999999999999999999;
+$b = 0.0005000000000000000104;
+print $a <= $b ? "ok 46\n" : "not ok 46\n";
+
+$a = 0.00000000000000000000000000000000000000000000000000000000000000000001;
+print $a > 0 ? "ok 47\n" : "not ok 47\n";
+
+$a = 80000.0000000000000000000000000;
+print $a == 80000.0 ? "ok 48\n" : "not ok 48\n";
+
+$a = 1.0000000000000000000000000000000000000000000000000000000000000000000e1;
+print $a == 10.0 ? "ok 49\n" : "not ok 49\n";