Re: More math fun
| From: | Jim Lucas | Date: | Wed, 13 Aug 2008 14:47:47 +0000 |
| Subject: | Re: More math fun | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278032@lists.php.net to get a copy of this message | ||
Jay Blanchard wrote:
[snip]What is your precision in your php.ini file set to? Default is 14. If it is set to 16 or greater, then it would display the reseults you are seeing. Mine is set to 14, so it would automatically round it to 0. I think. I will test, brb...... hmmm weird, if I set my precision to 20 and restart, I still get 0 for the value. Odd, I would have thought it would have then shown me the expected value. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare1.7763568394E-15 is 0. The computer just had a rounding errorsomewhere. Wehad this discussion a few weeks ago, the solution being to decide towhataccuracy you want the answer. Upto 14 decimal places will give you 0here!! I thought we had a different discussion a couple of weeks ago about floating point storage precision. How come only Jay is getting *this* rounding error? [/snip] Perhaps it is the PHP version? I have tried this on three separate PHP installations (all the same configs) and got the same results. I will look to see if there is an upgraded version. When applying round to the numbers everything works out as expected, but makes me uncomfortable.