On Thu, 11 Mar 2004 at 16:18 GMT, firebird wrote:
I am trying to execute the following Arithmetic operation
$perdiff = ($diff/$initval) *100.0;
This gives me a wrong value of $perdiff. For example, if,
$diff = 0.000
$initval = 0.010
Then perl returns $perdiff = 1.3 .
Any ideas why this inconsistency?
-fb-
Really!? Are you sure!? I'm glad my system is not affected!
#/usr/bin/perl
use strict;
use warnings;
my $diff = 0.000;
my $initval = 0.010;
my $perdiff = ($diff/$initval) * 100.0;
print $perdiff;
# luckily prints 0 at my system.
PS: You are encouraged to use comp.lang.perl.misc instead of
this defunct group