Output:print "print an example of negative zero\n"; @range = (-0.0000001, -0.000001, -0.00001, -0.0001); foreach $example (@range) { my $preround = sprintf ("%.5f",$example); my $tret = sprintf("rounded float:%7.5f \n",$preround); print "The Number $example is represented as $tret, here's the rou +nded num $preround\n"; }
print an example of negative zero The Number -1e-07 is represented as rounded float:-0.00000 , here's the rounded num -0.00000 The Number -1e-06 is represented as rounded float:-0.00000 , here's the rounded num -0.00000 The Number -1e-05 is represented as rounded float:-0.00001 , here's the rounded num -0.00001 The Number -0.0001 is represented as rounded float:-0.00010 , here's the rounded num -0.00010
In reply to Re^2: Negative zero? There's gotta be a sprintf that undoes that, right?
by rgiskard
in thread Negative zero? There's gotta be a sprintf that undoes that, right?
by rgiskard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |