**Section:** 28.7.1 [cmath.syn] **Status:** C++20
**Submitter:** Thomas Köppe **Opened:** 2018-01-23 **Last modified:** 2021-02-25 10:48:01 UTC

**Priority: **0

**View other** active issues in [cmath.syn].

**View all other** issues in [cmath.syn].

**View all issues with** C++20 status.

**Discussion:**

The paper P0175 was meant to be a purely editorial change to
spell out the synopses of the "C library" headers. However it contained the following inadvertent
normative change: The floating point classification functions `isinf`, `isfinite`,
`signbit`, etc. (but not `fpclassify`) used to be specified to return "`bool`"
in C++14. In C, those are macros, but in C++ they have always been functions. During the preparation
of P0175, I recreated the function signatures copying the return type "`int`" from C, but
failed to notice that we had already specified those functions differently, so the return type was
changed to "`int`".

To restore the intended specification, we should change the return types of all the `is...`
and `signbit` classification functions back to `bool`. Alternatively, we could decide
that the return type should actually be `int`, but that would be a larger discussion.

Proposed resolution for restoring the original wording: Replace return type "`int`" with
return type "`bool`" and for all the classification/comparison functions after
"*// classification/comparison functions*" in [cmath.syn] *except* the `fpclassify`
functions.

Related previous issue was LWG 1327 and the corresponding NB comment US-136 resolution.

*[
2018-01-29 Moved to Tentatively Ready after 8 positive votes on c++std-lib.
]*

*[2018-3-17 Adopted in Jacksonville]*

**Proposed resolution:**

This wording is relative to N4713.

Modify 28.7.1 [cmath.syn] as indicated:

[…] namespace std { […]

*// 28.7.5 [c.math.fpclass], classification / comparison functions*int fpclassify(float x); int fpclassify(double x); int fpclassify(long double x); bool~~int~~isfinite(float x); bool~~int~~isfinite(double x); bool~~int~~isfinite(long double x); bool~~int~~isinf(float x); bool~~int~~isinf(double x); bool~~int~~isinf(long double x); bool~~int~~isnan(float x); bool~~int~~isnan(double x); bool~~int~~isnan(long double x); bool~~int~~isnormal(float x); bool~~int~~isnormal(double x); bool~~int~~isnormal(long double x); bool~~int~~signbit(float x); bool~~int~~signbit(double x); bool~~int~~signbit(long double x); bool~~int~~isgreater(float x, float y); bool~~int~~isgreater(double x, double y); bool~~int~~isgreater(long double x, long double y); bool~~int~~isgreaterequal(float x, float y); bool~~int~~isgreaterequal(double x, double y); bool~~int~~isgreaterequal(long double x, long double y); bool~~int~~isless(float x, float y); bool~~int~~isless(double x, double y); bool~~int~~isless(long double x, long double y); bool~~int~~islessequal(float x, float y); bool~~int~~islessequal(double x, double y); bool~~int~~islessequal(long double x, long double y); bool~~int~~islessgreater(float x, float y); bool~~int~~islessgreater(double x, double y); bool~~int~~islessgreater(long double x, long double y); bool~~int~~isunordered(float x, float y); bool~~int~~isunordered(double x, double y); bool~~int~~isunordered(long double x, long double y); […] }