Re: NaN divided by zero should yield NaN

2020-07-20 Thread Tom Lane
Dean Rasheed writes: > On Thu, 16 Jul 2020 at 20:29, Tom Lane wrote: >> One thing that's not very clear to me is which of these spellings >> is preferable: >> if (unlikely(val2 == 0.0) && !isnan(val1)) >> if (unlikely(val2 == 0.0 && !isnan(val1))) > My guess is that the first would be

Re: NaN divided by zero should yield NaN

2020-07-17 Thread Dean Rasheed
On Thu, 16 Jul 2020 at 20:29, Tom Lane wrote: > > Dean Rasheed questioned this longstanding behavior: > > regression=# SELECT 'nan'::float8 / '0'::float8; > ERROR: division by zero > > After a bit of research I think he's right: per IEEE 754 this should > yield NaN, not an error. Accordingly I p