C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::isfinite for complex numbers, and other functionality

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Sat, 12 Feb 2022 00:41:57 +0100
On 09/02/2022 16.55, Licht Martin Werner via Std-Proposals wrote:
> Dear all,
>
> It seems that `std::isfinite` is not implemented for C++ complex number
> types, and I haven't found any obvious substitute in the standard library.
>
> Intuitively, a complex number is finite if both components are finite.
> That seems to be convention in C, though apparently it's not used in the
> C library:
> https://en.cppreference.com/w/c/numeric/complex
>
> More generally, a number of floating-point specific features such as
> `isinf` aren't implemented in C or C++. It seems reasonable that more
> floating-point functionality like this should be available to complex
> numbers as well.
>
> I'd appreciate any feedback on
> 1. making `std::isfinite` available to complex numbers,
> 2. getting floating-point complex numbers generally up to par with
> ordinary floating-point numbers.
>
> Any proposal addressing this would probably affect C as well, since C's
> library lacks those functions too.

C++ inherits those functions from C (for the real floating-point types).

If you can convince C to add "complex" support for some of the functions
you mentioned, a C++ paper desiring to align C++ to C in that regard will
have a much easier time.

Jens

Received on 2022-02-11 23:42:03