From: matz@... Date: 2015-12-29T07:28:42+00:00 Subject: [ruby-core:72586] [Ruby trunk - Feature #11918] [Feedback] Make #finite? consistent with #nonzero? Issue #11918 has been updated by Yukihiro Matsumoto. Status changed from Open to Feedback Forget about consistency with `nonzero?`, it has sorting use-cases. And tell me your use-case for `finite?` that returns `nil`. Your example seems artificial for me. Matz. ---------------------------------------- Feature #11918: Make #finite? consistent with #nonzero? https://bugs.ruby-lang.org/issues/11918#change-55838 * Author: Andrew Vit * Status: Feedback * Priority: Normal * Assignee: ---------------------------------------- Calling `.nonzero?` on a number returns itself (truthy) or nil, but calling `.finite?` on a float is just true or false. Floats can produce Infinity without errors and cause downstream errors if that result is unexpected. This would be nice to have: ~~~ top, bottom = 9.9, 0.0 (top / bottom).finite? or raise DivisionByZero (top / bottom).finite? || 0.0 (9.9 / 2.0).finite? #=> 0.5 (9.9 / 0.0).finite? #=> nil ~~~ These semantics would let the user handle the desired behaviour immediately in place. -- https://bugs.ruby-lang.org/ Unsubscribe: