std.conv.to vs. casting

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


On 07/04/2013 12:08 PM, monarch_dodra wrote:
> I didn't go into the details, but in your bug report, it seems like it is more
> of an implementation error ? In that case, an ERROR would be better.

The cast should be safe, as it's a size_t to a double.  It's just that having
to!double() would have identified a problem, and if the speed hit would be
avoided with the use of -release -noboundscheck I'd have assumed it would be
worth it.

But you're right, the simplest thing to do is to fix the implementation error.

Related note -- what would you anticipate about the speed hit of isNan(x) versus
if(booleanValue) ... ?  Yes, I'll benchmark. :-P


More information about the Digitalmars-d-learn mailing list