Robert, when you do yours, it's performing the same function on two different variable types and has to do a conversion before the function works. He was doing a numeric function on a string which might be giving the funky results. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Robert Cummings wrote: > On Tue, 2008-08-12 at 14:59 -0700, Jim Lucas wrote: > >> Jay Blanchard wrote: >> >>> abs($balanceTest) = 15.22 >>> abs($oldLineArray[16]) = 15.22 >>> >>> $diff = abs($balanceTest) - abs($oldLineArray[16]); >>> echo abs($diff) . "\n"; >>> >>> 1.7763568394E-15 >>> >>> WTF? This should be a big fat 0 >>> >>> >> I do not see how it makes any difference if $balanceTest and $oldLineArray[16] >> are strings in the beginning. In line that does the subtraction, they would >> have been converted to floats automagically by abs(). If you look at the >> manual for this function, you will see that the returned value is either a >> float or integer bases on the input type. Float would return a float. >> Anything else would return a integer. >> >> BTW - if I setup the following: >> >> <?php >> >> $balanceTest = '15.22'; # A string >> $oldLineArray[16] = 15.22; # A float >> >> $diff = abs($balanceTest) - abs($oldLineArray[16]); >> echo abs($diff) . "\n"; >> echo gettype(abs($diff)) . "\n"; >> >> # 1.7763568394E-15 >> >> ?> >> >> I get 0 and 'double' >> > > Yeah, I was probably thinking abs( $balanceTest - $oldLineArray[16] ) > versus what was actually present. But either way, I get 0 doing the > above also when I set up the values... so I have no idea how it's not > working for Jay. > > Cheers, > Rob. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php