[phobos] Bug 4455: Taking sqrt of an integer

David Simcha dsimcha at gmail.com
Thu Jul 15 19:16:10 PDT 2010


On 7/15/2010 9:22 PM, Don Clugston wrote:
> On 16 July 2010 01:04, David Simcha<dsimcha at gmail.com>  wrote:
>    
>> So is everyone on board for this?  If not, please say something.  Otherwise
>> I'll make the changes.
>>      
> It won't work. sqrt is a compiler intrinsic, and can't be changed to a
> template without modifying the compiler.
>
>    
(Smacks hand against forehead.)  I realized that right after I sent that 
message.  I guess the options are, then:

1.  Modify the compiler.  I guess the easiest way would be to rename the 
sqrt() intrinsic to sqrtImpl() and have a function called sqrt() in 
std.math that forwards to sqrtImpl().

2.  Live with it for now.  It's an extremely annoying bug in that 
math-heavy code runs into it constantly, but it's an easy bug to work 
around.

3.  Get rid of sqrt(float).  Walter, or whoever put it there in the 
first place:  Why is it there?  Do we really need it?

4.  Make explicit overloads for every single numeric type.  This is ugly 
but do-able and would definitely be a 100% solution.


More information about the phobos mailing list