std.math.pow
Saaa
empty at needmail.com
Sun Oct 26 05:47:21 PDT 2008
"Johan Granberg" <lijat.meREM at OVEgmail.com> wrote in message
news:ge1lob$1b2i$1 at digitalmars.com...
> Saaa wrote:
>
>> ?
>> main.d(118): function std.math.pow called with argument types:
>> (double,uint)
>> matches both:
>> std.math.pow(real,uint)
>> and:
>> std.math.pow(real,real)
>>
>> Also, I use pow(x,2U). Is this the correct function to use or is there a
>> dedicated x*x function?
>
> you can solve that by casting x into real before the call
> pow(cast(real)x,2U);
Yes, but why is this necessary?
Isn't there a preference to more matching arguments if all arguments could
be implicitly converted?
> but in this case why not just simply write x*x? personally I think thats
> both clearer and more efficient.
Well, x is a lot bigger than just x :)
More information about the Digitalmars-d-learn
mailing list