C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [isocpp-lib-ext] P3935R0 Rebasing <cmath> on C23

From: Jan Schultke <janschultke_at_[hidden]>
Date: Tue, 25 Nov 2025 19:26:18 +0100
> Thanks for working on this. My comments so far regarding the proposed
> templates and overloads for the "narrow rounding functions"...
>
> C's tgmath.h does not require the arguments to have the same type, but the
> templates do have such a requirement when the F type is not explicitly
> specified.
>
> Also, C's tgmath.h allows for
> f*op*(0., 0.L); // calls the underlying math.h f*op*l function
>
> but the proposed overload sets in C++ each have an ambiguity between the
> `double` and `long double` overloads for the above case (whereas the
> overload set for `pow` in C++ does not have this problem because of
> the "sufficient overloads" provision of https://wg21.link/cmath.syn#3 for
> *floating-point-type*).
>

Hmm okay, I thought we just don't support that, but we do, apparently. I
guess the provision will have to be expanded. This also means that I'll
need to relax the constraints on the function templates somewhat.

Aside:
> We seem to be missing an Annex C entry documenting the inability to
> suppress <tgmath.h>-like behaviour by suppressing macro replacement (e.g.,
> via use of parentheses around the "function" name).
>

That seems like a general problem that an LWG issue could address at any
time.

Thanks for the review!

Received on 2025-11-25 18:26:37