11706 vs ([lno] Canonical iv creation)

Paolo Carlini pcarlini@suse.de
Sat Mar 13 22:21:00 GMT 2004


Gabriel Dos Reis wrote:

>pow(double, int) is a standard mandated function.  There are other
>versions of pow() that are templates.
>  
>
What do you mean, exactly? Currently we have, simply:

  using ::pow;

  inline float
  pow(float __x, float __y)
  { return __builtin_powf(__x, __y); }

  inline long double
  pow(long double __x, long double __y)
  { return __builtin_powl(__x, __y); }

  inline double
  pow(double __x, int __i)
  { return __pow_helper(__x, __i); }

  inline float
  pow(float __x, int __n)
  { return __pow_helper(__x, __n); }

  inline long double
  pow(long double __x, int __n)
  { return __pow_helper(__x, __n); }

Therefore, exactly three overloads, which are using __pow_helper. Why 
can't each one call the corresponding __builtin_pow?

By the way, the seemingly trivial clean up that we have discussed:

  inline double
  pow(double __x, double __y)
  { return __builtin_pow(__x, __y); }

doesn't work as is: for some reason, pow ends up calling itself :(

Perhaps Roger can help here?

Paolo.



More information about the Libstdc++ mailing list