#!./perl
print "1..50\n";
# First test whether the number stringification works okay.
$a = 1; "$a";
$a = -1; "$a";
$a = 1.; "$a";
$a = -1.; "$a";
$a = 0.1; "$a";
$a = -0.1; "$a";
$a = .1; "$a";
$a = -.1; "$a";
$a = 10.01; "$a";
$a = 0100; "$a";
$a = 0x100; "$a";
$a = 1000; "$a";
# Okay, now test the numerics.
# We may be assuming too much, given the painfully well-known floating
# point sloppiness, but the following are still quite reasonable
# assumptions which if not working would confuse people quite badly.
$a = 1; "$a"; # Keep the stringification as a potential troublemaker.
print $a + 1 == 2 ? "ok 16\n" : "not ok 16 #" . $a + 1 . "\n";
# Don't know how useful printing the stringification of $a + 1 really is.
$a = -1; "$a";
print $a + 1 == 0 ? "ok 17\n" : "not ok 17 #" . $a + 1 . "\n";
$a = 1.; "$a";
print $a + 1 == 2 ? "ok 18\n" : "not ok 18 #" . $a + 1 . "\n";
$a = -1.; "$a";
print $a + 1 == 0 ? "ok 19\n" : "not ok 19 #" . $a + 1 . "\n";
my ($a, $b, $c) = @_;
}
$a = 0.1; "$a";
$a = -0.1; "$a";
$a = .1; "$a";
$a = -.1; "$a";
$a = 10.01; "$a";
print $a + 1 == 1001 ? "ok 25\n" : "not ok 25 #" . $a + 1 . "\n";
print $a + 1 == 10011 ? "ok 26\n" : "not ok 26 #" . $a + 1 . "\n";
$a = 0100; "$a";
print $a + 1 == 0101 ? "ok 28\n" : "not ok 28 #" . $a + 1 . "\n";
$a = 0x100; "$a";
print $a + 1 == 0x101 ? "ok 29\n" : "not ok 29 #" . $a + 1 . "\n";
$a = 1000; "$a";
print $a + 1 == 1001 ? "ok 30\n" : "not ok 30 #" . $a + 1 . "\n";
# back to some basic stringify tests
# we expect NV stringification to work according to C sprintf %.*g rules
$a = 0.01; "$a";
$a = 0.001; "$a";
$a = 0.0001; "$a";
} else {
$a = 0.01; "$a";
$a = 0.001; "$a";
$a = 0.0001; "$a";
}
$a = 0.00009; "$a";
$a = 1.1; "$a";
$a = 1.01; "$a";
$a = 1.001; "$a";
$a = 1.0001; "$a";
$a = 1.00001; "$a";
$a = 1.000001; "$a";
$a = 0.; "$a";
$a = 100000.; "$a";
$a = -100000.; "$a";
$a = 123.456; "$a";
else
{ print "ok 45 # skipped on $^O\n"; }
# see bug #15073
$a = 0.00049999999999999999999999999999999999999;
$b = 0.0005000000000000000104;
print $a <= $b ? "ok 46\n" : "not ok 46\n";
# Ultrix enters looong nirvana over this. VMS blows up when configured with
# D_FLOAT (but with G_FLOAT or IEEE works fine). The test should probably
# make the number of 0's a function of NV_DIG, but that's not in Config and
# we probably don't want to suck Config into a base test anyway.
print "ok 47\n";
} else {
$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";
$a = 57.295779513082320876798154814169;
"not ok 50 # $a\n";