Re: More math fun

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



--
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 Shakespeare


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux