TickDuration UFCS "to" was broken for float #1234
Conversation
f04d75d
to
ba03017
Compare
@@ -1703,7 +1702,7 @@ T to(string units, T, D)(D td) @safe pure nothrow @nogc | |||
{ | |||
enum unitsPerSec = convert!("seconds", units)(1); | |||
|
|||
return this.to!("seconds", T)() * unitsPerSec; | |||
return (td.length / cast(T)TickDuration.ticksPerSec) * unitsPerSec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after cast(T)
this needs a fair amount of work |
You can't right now, because that would be a breaking change. The benchmarking code in std.datetime would mostly work as-is with |
42b225f
to
2007a8d
Compare
linux_32_64
not sure what is the cause of this, but the core.time tests pass |
dlang#1190 was not tested throughout, it has a missing "this". TickDuration t; auto tf = to!("nsecs",float)(t); unittest fix for win and freebsd based somehow is(F : float) is true for uint args better debugging another try another test another bug dies size_t another try review work this is becoming sad ... .... ..... merge
2007a8d
to
8b49926
Compare
Thanks for really digging into this - my original PR was extremely simple and just hoisted |
assert(t4f - (cast(F)(t1v - t2v)) < 0.0001); | ||
} | ||
else | ||
foreach (F; _TypeTuple!(int,uint,long,ulong,float,double,real)) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's usually better to turn those foreach into a function literal to mitigate the expensive O(N^2) optimizations of the backend.
Auto-merge toggled on |
thanks |
TickDuration UFCS "to" was broken for float
#1190 was not tested throughout, it has a missing "this".
TickDuration t;
auto tf = to!("nsecs",float)(t);
Update:
found this while making the plotting for my benchmark module better
Update2:
best PR number ever :-)