[D-runtime] FPU in core.time

Jonathan M Davis jmdavisProg at gmx.com
Sun Jan 15 23:52:06 PST 2012


On Monday, January 16, 2012 06:00:24 Martin Nowak wrote:
> There are some failing unittests in core.time.
> 
> core.time(1754):
>      unittest
>      {
>          immutable curr = TickDuration.currSystemTick;
>          TickDuration t1 = curr;
>          immutable t2 = curr + curr;
>          t1 *= 2;
>          assert(t1 == t2);
> 
>          t1 = curr;
>          t1 *= 2.0; //<- This relies on 80-bit arithmetic and might fail
> since it is done on SSE
>          assert(t1 == t2);
>      }

So, how far off can they be? Only by 1? Or can it be more? I'd think that it 
would just be 1 at the most, but given that it's a multiple of 2, I really 
would have thought that it would have been fine in the first place. So I don't 
know. But the normal trick of checking against something like 1e-5 doesn't 
make sense here, since TickDuration holds a long, not a floating point value.

- Jonath


More information about the D-runtime mailing list