Bug #14014 closed
Added by marcandre (Marc-Andre Lafortune) about 7 years ago.
Updated almost 7 years ago.
Description
Ruby gives contradictory answers for NaN:
> (0/0.0).finite?
=> false
> Complex(0/0.0, 0).finite?
=> true
Note that (0/0.0).infinite?
returns nil
, so the float answer of false
looks even more wrong.
The two solutions I see are either changing Float#finite?
to return true
for NaN, or to raise in both cases.
I'd lean towards raising in both cases, as NaN can not be said to be finite or infinite
Status changed from Open to Rejected
NaN is not a (either infinite or finite) number, definitely.
Also it is not positive nor negative, so its signedness is nonsense too.
Complex(0/0.0, 0).finite?
returns false
in the trunk already.
Has this been backported to the 2.4 branch? I think it should.
What commit fixed it?
Thanks, sorry I should have tested trunk.
Should this be marked as closed rather than rejected and a test be added for NaN for the backport to be performed then?
Status changed from Rejected to Closed
Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN to 2.3: DONTNEED, 2.4: REQUIRED
Backport changed from 2.3: DONTNEED, 2.4: REQUIRED to 2.3: DONTNEED, 2.4: DONE
ruby_2_4 r62173 merged revision(s) 60040,60188.
Also available in: Atom
PDF
Like 0
Like 0 Like 0 Like 0 Like 0 Like 0 Like 0 Like 0