C++ Logo

std-discussion

Advanced search

Re: [expr.arith.conv] and FP16 <=> int

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 14 Dec 2023 14:57:59 -0300
On Thursday, 14 December 2023 13:39:28 -03 Marc Mutz via Std-Discussion wrote:
> 1'000'000 <=> numeric_limits<std::float16_t>::infinity()
>
> is _not_ `less`, but `equivalent` (this behaviour, of course, is the
> same for the non-spaceship relational operators by way of
> https://eel.is/c++draft/expr.rel#3).
>
> That's because the wording requires that this be evaluated as
>
> std::float16_t(1'000'000) <=> numeric_limits<std::float16_t>::infinity()

This is intentional and thus, by definition, not a problem.

Did you find an implementation problem resulting in less instead of equivalent?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-12-14 17:58:04