11706 vs ([lno] Canonical iv creation)
Paolo Carlini
pcarlini@suse.de
Sat Mar 13 23:32:00 GMT 2004
Gabriel Dos Reis wrote:
>Paolo Carlini <pcarlini@suse.de> writes:
>
>| Gabriel Dos Reis wrote:
>|
>| >__pow_helper() is for raising any arbitrary numeric type to an integer
>| > exponent. In particular it is used for complex<T> too.
>| Ah yes, I forgot about pow(z, n)! Thanks.
>| But, in that case, we can use it *only* for complex, not for cmath.
>
>After a replacement is figured out, you may move its definition to
><complex> if you must; but we're not there.
>
>
Ok.
>| Therefore, my plan would be: let's keep the overloads for double alone
>| (e.g., pow(double,
>| double)) but let's actually exploit ::pow, __builtin_powf,
>| __builtin_powl for implementing
>| pow(double, int), pow(float, int), pow(long double, int).
>|
>| Sounds reasonable?
>
>Let me make sure I understand.
>
> (1) don't overload for pow(double, double_, because it is the same as
> ::pow.
>
>
Ok.
> (2) Don't use ::pow in std_cmath.h.
>
>
Now I see what you mean ;) You mean, we can use it but only inside a
specialization
of __cmath_power<>(_Tp __x, unsigned int __n), basically, inside:
__cmath_power<>(float __x, unsigned int __n),
__cmath_power<>(double __x, unsigned int __n),
__cmath_power<>(long double __x, unsigned int __n).
(and all of this belong to cmath.tcc)
Agreed?
> (3) For raising to integer power, please consult
>
> http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00160.html
>
>
This is not completely clear to me. Since __builtin_pow* is actually
quite powerful (and
precise) in dealing with integral exponent, we can actually use it,
right? Not as ::pow, not
inside std_cmath.h, but we can?!?
Paolo.
More information about the Libstdc++
mailing list