C++ Logo


Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 07 Jun 2019 08:49:20 -0700
On Thursday, 6 June 2019 17:57:28 PDT Myria via Std-Discussion wrote:
> Also, I should look up IEEE 754 rules. C++ says floating-point divide by
> zero is undefined behavior, but IEEE 754 defines it. Do implementations
> that claim support IEEE 754 in is_iec559 have to define floating-point
> operations that IEEE 754 defines but C++ itself does not?

No, because CPUs/fpUs can trap that and deliver as an exception, causing the
program to terminate, instead of delivering ħInf. That's definitely UB.

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

Received on 2019-06-07 10:51:09