C++ Logo

std-discussion

Advanced search

Re: Out-of-range floating-point conversion behavior

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 04 Jun 2019 22:34:45 -0700
On Tuesday, 4 June 2019 12:59:33 PDT Myria via Std-Discussion wrote:
> But "the source value is between two adjacent destination values" is
> true; namely FLT_MAX and +infinity. With this interpretation of the
> wording, it seems like the result ought to be an
> implementation-defined choice between FLT_MAX and +infinity. (I would
> argue that because std::numeric_limits<float>::is_iec559() is true in
> this implementation, its "choice" must be what IEC 559 / IEEE 754
> mandates in this situation.)
>
> What is the correct interpretation here?

I don't read that as the correct interpretation. Infinite is not adjacent to
anything. Adjacency can only be seen between two finite numbers.

In particular, I read the wording specifically for this case: out of range. If
the number is bigger than the largest representable *finite* value or the
smallest one, then it's UB.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products

Received on 2019-06-05 00:36:34