- Title
- Sufficient Additional Special Math Overloads
- Status
- new
- Section
- [cmath.syn]
- Submitter
- Casey Carter

Created on **2019-07-11.00:00:00**,
last changed **2019-07-11.00:00:00**.

Date: 2019-07-12.17:56:59

The "sufficient additional overloads" wording in [cmath.syn] paragraph 2 does not apply to the special math functions, since they are not "overloaded functions". The lack of "sufficient additional overloads" doesn't agree with N3060 (the final draft of ISO/IEC 29124 which standardized the mathematical special functions) [sf.cmath] paragraphs 3 and 4:

-3- Each of the functions specified above that has one or more

doubleparameters (thedoubleversion) shall have two additional overloads:

a version with each

doubleparameter replaced with afloatparameter (thefloatversion), anda version with each

doubleparameter replaced with along doubleparameter (thelong doubleversion).The return type of each such

floatversion shall befloat, and the return type of each suchlong doubleversion shall belong double.-4- Moreover, each

doubleversion shall have sufficient additional overloads to determine which of the above three versions to actually call, by the following ordered set of rules:

First, if any argument corresponding to a

doubleparameter in thedoubleversion has typelong double, thelong doubleversion is called.Otherwise, if any argument corresponding to a

doubleparameter in thedoubleversion has typedoubleor has an integer type, thedoubleversion is called.Otherwise, the

floatversion is called.

P226R1 "Mathematical Special Functions for C++17" notably
states: "At the level of and following [c.math], create a new subclause with heading and initial
content the same as IS 29124:2010's clause [sf.cmath], 'Additions to header `<cmath>`,'
renumbering as appropriate to the new context." which suggests the change between 29124 and C++17
was an oversight and not intentional.

Notably there is implementation divergence: MSVC implements precisely the wording in C++17, whereas
libstdc++ provides additional overloads as specified in 29124, so they disagree
e.g. on whether `std::sph_neumann({}, {})` is
well-formed.

History | |||
---|---|---|---|

Date | User | Action | Args |

2019-07-11 00:00:00 | admin | create |