std.conv.to vs. casting

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Jul 4 03:32:25 PDT 2013


On Thursday, 4 July 2013 at 10:23:22 UTC, monarch_dodra wrote:
> I'm trying to read the bug entry, but I don't get it. Maybe a 
> reduced case to explain?

Point is, the skip() function in std.random.RandomSample can be 
called with the floating-point variable _Vprime equal to nan, 
_if_ popFront() or index() are called before front().

If isNan(_Vprime) && !_algorithmA then skip() will generate 
incorrect results.

I was asking about the speed of isNan compared to if(boolean) 
because I was considering killing the bool _first and just using 
isNan(_Vprime) to check if the first sample point has already 
been generated.

I can prepare a reduced example but it's probably simpler for me 
to just prepare a bugfix and do some benchmarks.


More information about the Digitalmars-d-learn mailing list