no use strict, no use warning and, last, and in this case, the important 
one ;-> 
no 
use bigint;

You're overflowing integers. You also are quoting numbers, which makes 
them strings, leave that to perl:
#!/usr/bin/perl -w
use strict;
use bigint;
my $var1=-123456789012.34;
my $var2=-45.9999;
my $var3=0.03;
my $var4=-0.03;
my $var5=123456789012.34;
my $var6=45.9999;
my $tsum=0;
$tsum=$var1+$var2+$var3+$var4+$var5+$var6;
print "Total sum: $tsum\n";
...

gets:
Total sum: 0
*********
Running total: -123456789012 += -123456789012 = -123456789012
Running total: -123456789057 += -45 = -123456789057
Running total: -123456789057 += 0 = -123456789057
Running total: -123456789057 += 0 = -123456789057
Running total: -45 += 123456789012 = -45
Running total: 0 += 45 = 0
*************
Value: -123456789012
Value: -45
Value: 0
Value: 0
Value: 123456789012
Value: 45
Sorted total: 0

(perl 5.8.1)  There's also Math::BigInt which is a more extensive big 
integer module. 

a

Andy Bach, Sys. Mangler
Internet: [EMAIL PROTECTED] 
VOICE: (608) 261-5738  FAX 264-5030

" ... even if you're mediocre/decent at perl [the cmecf] code is pretty 
confusing in certain areas ..." CB
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to