C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::sign

From: blacktea hamburger <greenteahamburger_at_[hidden]>
Date: Sat, 22 Oct 2022 16:01:41 +0800
I think I should propose it to WG14 first, any help?

On Sunday, October 16, 2022, blacktea hamburger <greenteahamburger_at_[hidden]>
wrote:
> See https://en.m.wikipedia.org/wiki/Sign_function.
>
> It is useful in certain situations, such as for rational numbers.
[ratio.ratio]/2.1:
>
> num shall have the value sign(N) * sign(D) * abs(N) / gcd.
>
> The signature of it should be:
>
> constexpr int sign(floating-point-type x);

Received on 2022-10-22 08:01:43