Float value Division gives irrational results php 5.2.5
am 10.02.2008 04:55:58 von INDIANNIC-HOSTING
hi
can somebody help me on this please.
Description:
------------
Basic division of one float value by another gives irrational results in php
5.2.5
os : windows 2000, iis 5 upto date with will microsoft patches
we have two independent websites each using two versions of php on the
same server
same sample php code (as given below) placed on each website
http://maptelltrack.com/divide.php (php 4.3.10 gives wrong results)
http://maptell.com/divide.php (php 5.2.6 gives correct results)
php 4.3.10 gives correct results and php5.2.5 gives Wrong results for
the same php code on the web server
php info file for each website
http://maptelltrack.com/info.php (php 5.2.5) using php-cgi.exe
(we have tried all versions upto php5.2-win32-latest)
http://maptell.com/info.php (php 4.3.10) using php.exe
Please do not try the same with command line since the results are
different.
Sample code:
---------------
$test = var_dump (46985.532 / 3600) ;
echo($test);
?>
Expected result:
----------------
float(13.0515366667)
Actual result:
--------------
float(10)
thanks
rajesh
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Float value Division gives irrational results php 5.2.5
am 11.02.2008 02:11:29 von Niel Archer
> hi
>
> can somebody help me on this please.
>
> Description:
> ------------
>
> Basic division of one float value by another gives irrational results in php
> 5.2.5
>
> os : windows 2000, iis 5 upto date with will microsoft patches
> we have two independent websites each using two versions of php on the
> same server
>
> same sample php code (as given below) placed on each website
> http://maptelltrack.com/divide.php (php 4.3.10 gives wrong results)
> http://maptell.com/divide.php (php 5.2.6 gives correct results)
>
> php 4.3.10 gives correct results and php5.2.5 gives Wrong results for
> the same php code on the web server
Hi
> php info file for each website
>
> http://maptelltrack.com/info.php (php 5.2.5) using php-cgi.exe
> (we have tried all versions upto php5.2-win32-latest)
>
> http://maptell.com/info.php (php 4.3.10) using php.exe
>
> Please do not try the same with command line since the results are
> different.
>
> Sample code:
> ---------------
>
> $test = var_dump (46985.532 / 3600) ;
> echo($test);
> ?>
>
> Expected result:
> ----------------
> float(13.0515366667)
>
> Actual result:
> --------------
> float(10)
>
> thanks
> rajesh
I tried this on my installation (Win2K3 64 bit, Apache, PHP 5.2.3) the
calculation worked as expected. I also took the time to upgrade to
5.2.5 (which was harder than it should of been, I had to repair the
installation before Apache could run with the dlls). Having got it
running, the calculation once again produced the expected result..
Incidentally, your use of var_dump is incorrect. It doesn't return a
value, but sends output directly
--
Niel Archer
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php