C++ Logo


Advanced search

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

From: Tiago Freire <tmiguelf_at_[hidden]>
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:


That's especially true when compared to the very concise way to check for infinity:


(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

Received on 2024-03-09 00:05:59