|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-04 04:38 UTC] sander@php.net
[2002-07-04 05:25 UTC] cnovak at gmx dot net
[2002-07-04 07:17 UTC] cnovak at gmx dot net
[2002-07-04 12:42 UTC] sander@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
By default precision in php.ini is set to 14 significant digits. I would assume, that this is for printing float results only. Instead, the precision argument is used for storing values in databases too. Check the following code: 01 for ($x = 0; $x < 64; $x++) { 02 $group_bitfield = pow(2, $x); 03 print " $group_bitfield<br>"; 04 } The above yields precision errors at 2^48, 2^49, 2^51, 2^52, 2^54. If this is for output only, fine. But the issue is that these values are also _incorrectly_ stored in an INT(20) field on MySQL. Explicit type casting does not help either. Using arbitrary math is not an option for speed and availabilty at various ISP's. Configuration: WINNT Apache/1.3.26 (Win32) mod_ssl/2.8.10 OpenSSL/0.9.6d PHP version: 4.2.1