C++ Logo

std-proposals

Advanced search

Re: new approximately equal operators

From: Bo Persson <bo_at_[hidden]>
Date: Sun, 21 Jun 2020 12:33:22 +0200
On 2020-06-21 at 10:09, Andrew Tomazos via Std-Proposals wrote:
> If you're interested in working in this space, I'd start by publishing a
> survey of some popular existing C++ libraries that provide
> floating-point approximately equal functionality - and carefully
> analyzing and comparing how they do it and how they are used. Next step
> would be to propose this functionality into the standard library
> (std::approx_equal or similar), probably initially to the Numerics
> subgroup (SG6). Once the standard library has the functionality I can
> imagine a proposal to provide operators for it - but the latter is
> unlikely to be accepted because new C++ operators have to meet an
> insanely high threshold of interest for some reason. (Amusing to
> compare other languages like Scala or Perl 6 - where arbitrary new
> operators can be user-defined like functions)

Possibly because C++ already has a crazy 17 level operator precedence

https://en.cppreference.com/w/cpp/language/operator_precedence

Where would you insert a bunch of user defined ones? :-)


    Bo Persson



>
> On Tue, Jun 9, 2020 at 5:55 AM Vishal Oza via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> wrote:
>
> I was wondering if there is any interest in adding approximately
> equal to operators into the language. The main purpose is to compare
> floating point calculations with rounding error, however they could
> be used for similarity of objects or fixed point rounded values as well.
>

Received on 2020-06-21 05:36:41