C++ Logo

std-proposals

Advanced search

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

From: Licht Martin Werner <martin.licht_at_[hidden]>
Date: Wed, 9 Feb 2022 16:55:06 +0100
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.

Best,
Martin Licht

Received on 2022-02-09 15:55:10