[D-runtime] FPU in core.time
Brad Roberts
braddr at puremagic.com
Sun Jan 15 22:56:30 PST 2012
One of the checkins today made this a real problem. Looking at the pull tester, many many of the failures are due to
this. The most recent linux 32/64 trunk build also failed with a time related failure.
On 1/15/2012 9:00 PM, 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);
> }
>
>
> core.time(1523):
> {
> enum unitsPerSec = convert!("seconds", units)(1);
>
> if(ticksPerSec >= unitsPerSec)
> return TickDuration(cast(long)(length * (ticksPerSec / cast(real)unitsPerSec)));
> else
> return TickDuration(cast(long)(length / (unitsPerSec / cast(real)ticksPerSec)));
> }
>
> This fails it's unittest on my Windows machine due to limited precision from the double division.
> The separate branches were originally used with integer arithmetic but it seems to me that they
> are no longer needed since the calculation is done in floating point now.
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime
More information about the D-runtime
mailing list