ID: 18271 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: MSSQL related Operating System: Win2000 PHP Version: 4.3.0 New Comment:
It's just occurred to me that this also explains why 0.185 & 0.435 generate the same discrepancy, as do 0.36 and 0.485. Check this out 0.435 - 0.185 = 0.25 0.485 - 0.36 = 0.125 0.25 and 0.125 are both members of the x/(2^y) set (1/2^2 and 1/2^3 repsectively) that don't produce discrepancies. Coincidence? I think not! Previous Comments: ------------------------------------------------------------------------ [2003-02-12 00:10:18] [EMAIL PROTECTED] Okay, I've patched in the php_mssql.dll file from the latest archive, and it looks like we're getting closer. The numbers coming back are nearly correct. They are, however, all out by some incredibly small quantity. Some examples: The value on the left is what's actually in the cell, the value on the right is what PHP is returning. 0.17 0.170000001788 0.37 0.370000004768 0.185 0.185000002384 0.315 0.314999997616 0.435 0.435000002384 0.485 0.485000014305 19.04 19.0400009155 72.1438 72.1437988281 184.4263 184.426300049 Observations about the data: It is now deterministic ... meaning that a value of 0.17 always returns 0.170000001788, regardless of which cell it occurs in. This was not the case with the previous problem. The discrepancy can be positive or negative, and this doesn't appear to be a function of the data in any discernable way. The discrepancy does NOT correlate to the data value. Values of 0.185 and 0.435 both generate a discrepancy of +2.384e-9, and 0.36 & 0.485 both generate +1.4305e-8. If there is a mathematical pattern here, I can't see it. NB: Zero always returns correctly, and, in a bizarre exception, so does the value 0.375. All other values that I've looked at so far have these slight discrepancies. Okay, scratch that. I have just discovered something that might prove useful to you. Integers always come back correctly, and so do numbers where the fractional part is based on a power of 2 denominator. If that makes any sense. To put it another way - if the number is x / (2^y) where x and y are any integers (positive or negative), it will return correctly. Otherwise, it will not. I hope this helps you track down whatever's wrong with the extension. ------------------------------------------------------------------------ [2003-02-09 02:24:39] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-01-21 20:16:52] [EMAIL PROTECTED] I just looked up the manual page for MSSQL, and it mentions using the ntwdblib.dll file (which exists in the PHP archive under dlls/). I've never concerned myself with that file because when I originally installed PHP, the MSSQL connection worked as soon as I copied across php_mssql.dll. Do I need to replace ntwdblib.dll as well to test your fix? ------------------------------------------------------------------------ [2003-01-21 19:48:19] [EMAIL PROTECTED] I've tried replacing the extension file, but there was no change. You said "related dlls from the dlls/ folder", AFAIK nothing in the dlls/ folder is related to mssql. So all I did was copy extensions/php_mssql.dll into c:\php, restarted my browser session and observed that I'm still getting the same data from real columns. If I need to restart IIS to test this properly, tell me. ------------------------------------------------------------------------ [2003-01-20 00:32:18] [EMAIL PROTECTED] Yes, replace the php_mssql.dll and related dlls from the dlls/ folder. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/18271 -- Edit this bug report at http://bugs.php.net/?id=18271&edit=1