Edit report at http://bugs.php.net/bug.php?id=51396&edit=1
ID: 51396 Updated by: ras...@php.net Reported by: codeslinger at compsalot dot com Summary: Math is Unreliable Status: Feedback Type: Bug Package: Math related Operating System: any PHP Version: Irrelevant New Comment: Bad memory perhaps? But why consistently a ':' ? Previous Comments: ------------------------------------------------------------------------ [2010-03-26 16:57:15] ahar...@php.net JFTR, I was also unable to reproduce the failure case from any of the data files on both 32-bit and 64-bit Linux builds and a 32-bit Windows build. I've got a couple of boxen crunching away generating random doubles and converting them to strings in what seems to be the sort of range that causes problems (one 32-bit Linux, one 64-bit Linux): nothing yet after a couple of billion iterations. In short, I don't have a clue what it could be either, but I'll keep the random double generation going a while longer just in case it hits paydirt. ------------------------------------------------------------------------ [2010-03-26 16:39:33] paj...@php.net Rasmus, he is not the only person. There are two other reports about it. However he is the first one to experience it on non windows platform. ------------------------------------------------------------------------ [2010-03-26 16:26:05] ras...@php.net I ran your simplefail.php on all 4 data files. Never saw the failure case. Then I took just the huge rawpairs.txt file (had to increase the memory_limit) and modified your program slightly to do: for($i=0;$i<100000;$i++) ConvertData($data); and ran that, which took quite a while. Still no failures. You are still the only person who has ever reported these weird ":" characters showing up, and you have yet to produce any sort of code that reproduces it for someone else. We'll keep trying, but something that happens for 1 person out of millions is suspicious. ------------------------------------------------------------------------ [2010-03-26 15:28:16] codeslinger at compsalot dot com it's still not 20 lines... it never will be.... but I found one surprising thing, if I save the array to disk and read it back in I still get the same failure. so essentially the snowflake is a Psudo-RNG and that's why trying to simplify it does not work, because it has to be able to generate all of those different numbers. but once we have the set of numbers the generator becomes irrelevant. Try this program: http://www.compsalot.com/phpbug/kochsnowflake/simplefail/ weirdly, every failure is a -0.1 but there are two things that I'm concerned about. 1) It seems unlikely that the billing program was only failing on that amount, it is a pretty unusual amount. Not one I'd normally expect to see and there were a lot of failures. 2) I'm concerned about the limitations of the detection method. I am only finding bad values because they have a colon in the string. I am not currently checking for mathematical correctness. We may not be seeing the whole story, there could be a lot more bad values that just are not blatant enough to be observed. But at least this should give you the starting point that you are asking for. The program is reduced to reading a file from disk and checking each number to see if it's valid. can't get any simpler than that. Of course if the corruption is happening when the value is created, looking at them after the fact may still not help much. But when I look at these values in the eclipse zend debugger, they look normal enough despite the fact that they can't be properly converted. ------------------------------ The data files are as follows: rawpairs.txt is a 6.5meg file and contains both good and bad values, you don't need this file unless you are trying to validate the serialization. This is from a single run of the snowflake, $Nest = 3; $Depth = 5; The following were extracted from the raw data. onepair.txt contains a single failure item selectpairs.txt contains 8 failures which were from a single run of snowflake manypairs.txt contains about 40 failures which are the result of multiple runs of the snowflake using different Nest & Depth parameters. ------------------------------------------------------------------------ [2010-03-26 11:14:13] paj...@php.net Does it happen always? Can you try to make a script with only this function call with the values causing this effect? ------------------------------------------------------------------------ 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/bug.php?id=51396 -- Edit this bug report at http://bugs.php.net/bug.php?id=51396&edit=1