>> 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.

Are the rules for double-precision floats the same in this regard?

I have confirmed that fmod(-2, 2) returns positive zero in icc. I have
asked on their forum if there is a flag or something I can enable to
fix this; it might be a bug.  Note that fmodf (for floats, not
doubles) correctly returns -0.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to