Re: PHP 5.4.11 tests: floating point diff

From: Date: Mon, 04 Feb 2013 21:16:48 +0000
Subject: Re: PHP 5.4.11 tests: floating point diff
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-65652@lists.php.net to get a copy of this message
On Mon, 04 Feb 2013 21:50:23 +0100, Levi Morrison <levim@php.net> wrote:

I have been compiling PHP under various compilers trying to figure out what flags I need for each compiler to pass all tests excluding XFAILs. With Intel 13.0.1 I'm down to two failing tests: ===================================================================== FAILED TEST SUMMARY --------------------------------------------------------------------- Test fmod() - basic function test fmod() [ext/standard/tests/math/fmod_basic.phpt] Test fmod function : 64bit long tests [ext/standard/tests/math/fmod_basiclong_64bit.phpt] ===================================================================== The only differences are between -0 and 0 (exact diffs at end of message). My understanding of floating point calculations is that -0 and 0 are equivalent, so I can safely ignore the failures. I wanted to first check to make sure that is actually true.
No, they are not the same thing for several purposes. For instance, they have different serializations. See also: $ php <?php $nz = fmod(-2,2); var_dump(atan2(0., $nz), atan2($nz, $nz)); float(3.1415926535898) float(-3.1415926535898) So I think you should investigate the cause of the problem (different results), rather than ignoring the differences. Possibly the difference lies in the Intel math library; in that case, you can either separate the tests in two or just ignore the test when compiling with the Intel compiler.
Assuming that the above is correct, I wanted to patch the phpt files for the tests to pass. However, I'm not very familiar with that format. How would you suggest altering the tests to make this pass?
Check these: http://qa.php.net/write-test.php http://qa.php.net/phpt_details.php You can also inspect the file run-tests.php if you have any doubt. -- Gustavo Lopes

Thread (6 messages)

« previous php.internals (#65652) next »