C++ Logo

std-proposals

Advanced search

[std-proposals] Shorter spelling for std::numeric_limits<float>::infinity()

From: Phil Endecott <std_proposals_list_at_[hidden]>
Date: Fri, 08 Mar 2024 19:06:25 +0000
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.

Received on 2024-03-08 19:06:27