Date: Sat, 9 Mar 2024 00:05:56 +0000
Why not just define your own:
template <floating_point T>
constexpr T infinity_v<T> = std::numeric_limits<floating_point>::infinity();
?
-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Phil Endecott via Std-Proposals
Sent: Friday, March 8, 2024 8:06 PM
To: std-proposals_at_lists.isocpp.org
Cc: Phil Endecott <std_proposals_list_at_chezphil.org>
Subject: [std-proposals] Shorter spelling for std::numeric_limits<float>::infinity()
Dear All,
I find the current spelling for "infinity" rather long:
std::numeric_limits<float>::infinity()
That's especially true when compared to the very concise way to check for infinity:
std::isinf(v)
(Have I missed some more concise spelling, apart from INFINITY ?)
Why not have an infinity constant in the style of pi, e, etc.
in <numbers>:
template <floating_point T>
inline constexpr T infinity_v<T> = ...;
inline constexpr double infinity = infinity_v<double>;
Regards, Phil.
--
Std-Proposals mailing list
Std-Proposals_at_lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
template <floating_point T>
constexpr T infinity_v<T> = std::numeric_limits<floating_point>::infinity();
?
-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Phil Endecott via Std-Proposals
Sent: Friday, March 8, 2024 8:06 PM
To: std-proposals_at_lists.isocpp.org
Cc: Phil Endecott <std_proposals_list_at_chezphil.org>
Subject: [std-proposals] Shorter spelling for std::numeric_limits<float>::infinity()
Dear All,
I find the current spelling for "infinity" rather long:
std::numeric_limits<float>::infinity()
That's especially true when compared to the very concise way to check for infinity:
std::isinf(v)
(Have I missed some more concise spelling, apart from INFINITY ?)
Why not have an infinity constant in the style of pi, e, etc.
in <numbers>:
template <floating_point T>
inline constexpr T infinity_v<T> = ...;
inline constexpr double infinity = infinity_v<double>;
Regards, Phil.
--
Std-Proposals mailing list
Std-Proposals_at_lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2024-03-09 00:05:59