use sprintf to round off to the correct precision...see Perl cookbook.chapter 2 , recopies 2.3 for more details
-----Original Message----- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 23, 2002 12:00 PM To: 'Timothy Johnson'; '[EMAIL PROTECTED] '; '[EMAIL PROTECTED] ' Subject: RE: Strange total from adding 2 numbers No. I've just tried --- $a = 68288455.49; $b = 67947269.62; $c = $a - $b; print $c; --- and also get a result of 341185.86999999 Weird. John -----Original Message----- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: 23 May 2002 17:01 To: '[EMAIL PROTECTED] '; '[EMAIL PROTECTED] ' Subject: RE: Strange total from adding 2 numbers It looks like the negative number is being entered as a string. How are you entering the second Acct_Bal_Raw variable initially? -----Original Message----- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 5/23/02 8:47 AM Subject: Strange total from adding 2 numbers Why is the addition of the numbers -67947269.62 and 68288455.49, both with only 2 numbers after the decimal, resulting in 341185.86999996 where there are 8 numbers after the decimal. I would expect the number to simply be 341185.87. How can i avoid this strange behavior? Below are 2 examples, both are shown from the debugger. DB<10> x $funds_type_totals{$funds_type} 0 68288455.49 DB<11> x $Deposit_Acct_Bal_Raw 0 '-67947269.62' DB<12> s 161: $Deposit_Acct_Bal_Raw += $funds_type_totals{$funds_type}; DB<12> x $Deposit_Acct_Bal_Raw 0 341185.86999996 ======= DB<18> $l = 68288455.49 -67947269.62 DB<19> x $l 0 341185.86999999 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------Confidentiality--------------------------. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]