gazever Posted January 12, 2010 Share Posted January 12, 2010 Hi I'm getting an unexpeted result from the following, <?php echo 1481.00-1480.99; ?> output = 0.00999999999999 Does anyone understand why this is happening? Quote Link to comment Share on other sites More sharing options...
fooDigi Posted January 12, 2010 Share Posted January 12, 2010 i was confused by this also... similar issues. take a look at my post http://www.phpfreaks.com/forums/index.php/topic,278344.msg1317542.html particularly the warning on this page ... http://www.php.net/manual/en/language.types.float.php Quote Link to comment Share on other sites More sharing options...
gazever Posted January 12, 2010 Author Share Posted January 12, 2010 Hi foodigi, Thanks Did you resolve your issue by rounding? Quote Link to comment Share on other sites More sharing options...
gazever Posted January 12, 2010 Author Share Posted January 12, 2010 OK, fixed it using bcsub (1481.00,1480.99,2) How weird. Quote Link to comment Share on other sites More sharing options...
fooDigi Posted January 12, 2010 Share Posted January 12, 2010 yeah, that worked fine for me. not to say that it's a proper solution, but i get accurate results. Quote Link to comment Share on other sites More sharing options...
umarrana Posted January 12, 2010 Share Posted January 12, 2010 use bccus($number) it will work for you thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.