std.conv.to vs. casting

monarch_dodra monarchdodra at gmail.com
Thu Jul 4 03:22:50 PDT 2013


On Thursday, 4 July 2013 at 10:15:22 UTC, Joseph Rushton Wakeling 
wrote:
> 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

I'm trying to read the bug entry, but I don't get it. Maybe a 
reduced case to explain?

In any case, I don't think int to double ever throws so that 
wouldn't help...


More information about the Digitalmars-d-learn mailing list