[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    Re: [PHP-DEV] Floats and apache 1.3b6
From:       Zeev Suraski <bourbon () netvision ! net ! il>
Date:       1998-04-30 17:37:03
[Download RAW message or body]

At 15:01 30/04/98 +0200, Andreas Karajannis wrote:
>It seems that floats (e.g from database queries) get randomly rounded
>on output. I've seen this on Solaris/apache 1.3b6/oracle and have 
>a report for Linux/apache 1.3b6/adabas. 
>On my Linux box, with apache 1.2.6 I can't reproduce this "behaviour",
>so it seems to be apache related, maybe some *printf function?
>
>Sample Output:  values stored in table:
>100.010002 		100.01
>200.020004		200.02
>300.029999		300.03
>400.040009		400.04
>500.049988		500.05

Floating point numbers are not accurate, this is a typical behavior.  If
you want to maintain full accuracy, keep these values as strings, and
manipulate them using the BC math library.

Zeev
--
Zeev Suraski   <zeev@php.net>
For a PGP public key, finger bourbon@netvision.net.il

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic