> 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?
Because "floating point" representation is basically scientic notation: 68288455.49 = 6.828845549 X 10^7 ^^^^^^^^^^^ ^^^^ Mantasia Exponenent And there often isn't a direct mapping between the binary representation used and our decimal system. This leads to minor errors, which you need to remember - especially when comparing equality (which you should NEVER do with floating point). The behaviour isn't strange, unless you weren't expecting it. The correct thing to do is to remake the number into a pure integer, and here is one way to do it: $number =~ s/\.//; #removes the dot! as long as you always have two digits. Work always in integers if errors matter. Jonathan Paton ===== $_=q|.,&@$$. ,.@$&@$. .&$$@. ,,$ ....!$_=$p.'&$@.',y'&$@' .,';for(/\S+/g){ !|.q| .$ .,@, ,$, .,.. @, ,$ ,,@ .,,.!++$.<22?${'y'.$_}=chr$.+64:[$$=${'y' !|.q| ,@$@&.,. $$$&, ..@&&$,,, $., ..!.$_},$y.=($.=~/22\|26\|3(3\|7)/x?' ' !|.q|. @ ., ,.&,,, , .$..&. .,$ .,,!.$$:"\l$$")]};$y=~/ (.*)/;warn"$1\n" !|.q|. $ .,. .,$$&&$...&., @.,.&@$@ .|,map{-$|--?$r:$p.=$_}split'!';eval$r __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]