[phobos] phobos commit, revision 1833

Benjamin Shropshire benjamin at precisionsoftware.us
Thu Aug 12 06:48:33 PDT 2010


Daniel Murphy wrote:
> Do we really want the sqrt of a integer to return a real?
> I would expect it to return floor(sqrt(n)), in the same way that 
> integer division does.
> What do other people think/expect?
>
> Daniel.
>

I don't think x86 has an int sqrt op so under the covers, int->int is 
going to end up being "cast(int)sqrt(cast(real)a)" Asking the user to 
tack in the first cast should have no perf issues and I expect would be 
what people want more often than the reverse.


More information about the phobos mailing list