Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-12-01 Thread Jason Merrill via Gcc-patches
On Tue, Sep 21, 2021 at 5:19 PM Jason Merrill wrote: > On Tue, Sep 21, 2021 at 4:30 PM Joseph Myers > wrote: > >> On Tue, 21 Sep 2021, Jakub Jelinek via Gcc-patches wrote: >> >> > On Tue, Sep 21, 2021 at 02:15:59PM +0100, Roger Sayle wrote: >> > > Can you double check? Integer division by zero

Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Marc Glisse
On Tue, 21 Sep 2021, Jason Merrill via Gcc-patches wrote: On Tue, Sep 21, 2021 at 4:30 PM Joseph Myers wrote: On Tue, 21 Sep 2021, Jakub Jelinek via Gcc-patches wrote: On Tue, Sep 21, 2021 at 02:15:59PM +0100, Roger Sayle wrote: Can you double check? Integer division by zero is undefined,

Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Jason Merrill via Gcc-patches
On Tue, Sep 21, 2021 at 4:30 PM Joseph Myers wrote: > On Tue, 21 Sep 2021, Jakub Jelinek via Gcc-patches wrote: > > > On Tue, Sep 21, 2021 at 02:15:59PM +0100, Roger Sayle wrote: > > > Can you double check? Integer division by zero is undefined, but > isn't floating point > > > division by zero

Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Joseph Myers
On Tue, 21 Sep 2021, Jakub Jelinek via Gcc-patches wrote: > On Tue, Sep 21, 2021 at 02:15:59PM +0100, Roger Sayle wrote: > > Can you double check? Integer division by zero is undefined, but isn't > > floating point > > division by zero defined by the appropriate IEEE standards? > > https://eel.

RE: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Roger Sayle
t: 21 September 2021 14:22 To: Roger Sayle ; Jason Merrill ; Jonathan Wakely Cc: 'Xi Ruoyao' ; 'GCC Patches' Subject: Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions. On Tue, Sep 21, 2021 at 02:15:59PM +0100, Roger Sayle wrote: > Can you double check? Integer

Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Xi Ruoyao via Gcc-patches
On Tue, 2021-09-21 at 21:38 +0800, Xi Ruoyao via Gcc-patches wrote: > BTW the "correct" way to get a NaN in C++ seems: > > #include > constexpr double my_nan = std::numeric_limits::quiet_NaN(); Sorry, we were discussing inf, not NaN... Then constexpr double my_inf = std::numeric_limits::infin

Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Xi Ruoyao via Gcc-patches
On Tue, 2021-09-21 at 14:15 +0100, Roger Sayle wrote: > > Can you double check?  Integer division by zero is undefined, but isn't > floating point > division by zero defined by the appropriate IEEE standards? It's an undefined behavior in C++ standard. Even if we assume C++ *was* IEEE-754 confor

Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Richard Biener via Gcc-patches
On Tue, Sep 21, 2021 at 3:07 PM Xi Ruoyao via Gcc-patches wrote: > > On Tue, 2021-09-21 at 12:41 +0100, Roger Sayle wrote: > > > > I was wondering if I may ask the C++ language experts for their > > opinion > > on whether (potential) floating point exceptions/traps can be ignored > > in constant e

Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Jakub Jelinek via Gcc-patches
On Tue, Sep 21, 2021 at 02:15:59PM +0100, Roger Sayle wrote: > Can you double check? Integer division by zero is undefined, but isn't > floating point > division by zero defined by the appropriate IEEE standards? https://eel.is/c++draft/expr.mul#4 doesn't make the division by zero behavior condi

RE: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Roger Sayle
: [RFC/PATCH] C++ constexpr vs. floating point exceptions. On Tue, 2021-09-21 at 12:41 +0100, Roger Sayle wrote: > > I was wondering if I may ask the C++ language experts for their > opinion on whether (potential) floating point exceptions/traps can be > ignored in constant expressio

Re: [RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Xi Ruoyao via Gcc-patches
On Tue, 2021-09-21 at 12:41 +0100, Roger Sayle wrote: > > I was wondering if I may ask the C++ language experts for their > opinion > on whether (potential) floating point exceptions/traps can be ignored > in constant expressions; this is related to PR c++/96862.  I think my > question boils down

[RFC/PATCH] C++ constexpr vs. floating point exceptions.

2021-09-21 Thread Roger Sayle
I was wondering if I may ask the C++ language experts for their opinion on whether (potential) floating point exceptions/traps can be ignored in constant expressions; this is related to PR c++/96862. I think my question boils down to whether (or not) the following is valid C++: constexpr float m