C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: Out-of-range floating-point conversion behavior
From: Thiago Macieira (thiago_at_[hidden])
Date: 2019-06-07 10:49:20


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

STD-DISCUSSION list run by herb.sutter at gmail.com

Older Archives on Google Groups