This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

### 2079. Required `pow()` overloads

Section: 26.8 [c.math] Status: NAD Submitter: Steve Clamage Opened: 2011-08-29 Last modified: 2016-01-28

Priority: 3

View all other issues in [c.math].

View all issues with NAD status.

Discussion:

LWG issue 550 removed the functions:

>     float       pow(float, int);
>     double      pow(double, int);
>     long double pow(long double, int);

from header `<cmath>`. This change does not seem to be mentioned in Annex C, C.2.14.

Howard:

> N3290 26.8 [c.math]/p11 says:

> > Moreover, there shall be additional overloads sufficient to ensure:

> > 1. If any argument corresponding to a `double` parameter has type `long double`, then all arguments corresponding to `double` parameters are effectively cast to `long double`.
> > 2. Otherwise, if any argument corresponding to a `double` parameter has type `double` or an integer type, then all arguments corresponding to `double` parameters are effectively cast to `double`.
> > 3. Otherwise, all arguments corresponding to `double` parameters are effectively cast to `float`.

> From C99 7.12.7.4 we have:

> >     double pow(double, double);

> 26.8 [c.math]/p11/b2 says that if the client calls `pow(2.0f, 2)`, then the `int` for second argument causes the following effective call to be made:

> >     pow(static_cast<double>(2.0f), static_cast<double>(2)) -> double

> The first sentence of p11 implies that this is done by supplying the following additional overload:

> >     double pow(float, int);

> If the client calls `pow(2.0, 2)`, then the same reasoning (b2 again) implies the following additional overload:

> >     double pow(double, int);

> If the client calls `pow(2.0l, 2)`, then b1 implies the following additional overload:

> >     long double pow(long double, int);

> In all, p11 implies hundreds (perhaps thousands?) of extra overloads. All but one of which is a superset of the overloads required by C++98/03 (that one being `pow(float, int)` which had its return type changed from `float` to `double`).

> In practice, at least some vendors implement p11 by using templated overloads as opposed to ordinary overloads.

Steve Clamage:

> Thanks. I didn't see that those extra overloads were actually implied by p11, despite the first sentence. Without examples, the point is a bit subtle (at least for me).

[2015-05-05 Lenexa: Move to NAD]

Billy: I believe this is NAD.

STL: Oh, Steve himself agrees.

Wakely: The issue marked as NAD will be sufficient.

STL: Yes, we should get rid of this.

Billy: I don't see any minutes from Issaquah.

Marshall: Since Steve agrees, does anyone object to marking as NAD?

Nope.

Proposed resolution: