Equality == comparisons with floating point numbers
Abdulhaq
alynch4047 at gmail.com
Sat Dec 7 00:29:39 PST 2013
On Friday, 6 December 2013 at 14:58:31 UTC, Joseph Rushton
Wakeling wrote:
> On 06/12/13 15:02, Ali Çehreli wrote:
>> Are they identical when printed with %a?
>
> Yes. You can see some of the results here (for the 32-bit
> systems where I was getting failures):
> https://d.puremagic.com/test-results/pull.ghtml?projectid=1&runid=811923&logid=6
> https://d.puremagic.com/test-results/pull.ghtml?projectid=1&runid=811924&logid=6
> https://d.puremagic.com/test-results/pull.ghtml?projectid=1&runid=811927&logid=6
> https://d.puremagic.com/test-results/pull.ghtml?projectid=1&runid=811930&logid=6
>
> So, as I said, it's baffling why the equality operator is not
> returning true.
Some time ago in a test I had written (C++) apparently identical
floating point operations were returning different answers (in
the 17th/18th sign fig), when re-running the same code with the
same data. The paper described how the result could change if the
numbers remained in the FPU (which had a few bits extra precision
over the normal register size) during the course of the
calculation as a opposed to being swapped in and out of the main
registers. Depending on when numbers could get flushed out of the
FPU (task swapping I suppose) you would get slightly different
answers.
Could this be a factor?
Abdulhaq
More information about the Digitalmars-d-learn
mailing list