Re: More math fun
| From: | Robert Cummings | Date: | Wed, 13 Aug 2008 16:45:19 +0000 |
| Subject: | Re: More math fun | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278049@lists.php.net to get a copy of this message | ||
On Wed, 2008-08-13 at 07:47 -0700, Jim Lucas wrote:
> Jay Blanchard wrote:
> > [snip]
> >> 1.7763568394E-15 is 0. The computer just had a rounding error
> > somewhere. We
> >> had this discussion a few weeks ago, the solution being to decide to
> > what
> >> accuracy you want the answer. Upto 14 decimal places will give you 0
> > here!!
> >
> > 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.
> >
>
> 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.
I tried the highest precision setting that PHP appears to honour... 54.
I still get 0 :)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP