std.math.pow
Jarrett Billingsley
jarrett.billingsley at gmail.com
Sun Oct 26 07:52:46 PDT 2008
On Sun, Oct 26, 2008 at 8:47 AM, Saaa <empty at needmail.com> wrote:
>> 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?
No. See the section on function overloading on this page:
http://www.digitalmars.com/d/1.0/function.html
So for pow(x, 2u), where x is a double, the match level for both
(real, uint) and (real, real) is "match with implicit conversions."
Therefore, it's an error.
More information about the Digitalmars-d-learn
mailing list