Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichDouble(_).isFinite is missing #11531

otto-dev opened this issue May 15, 2019 · 0 comments


None yet
2 participants
Copy link

commented May 15, 2019

Scala's RichDouble does not provide .isFinite. If you want to make sure that a Double is finite, you either have to write your own implementation by combining the negatives of .isNaN and .isInfinity, or fall back on java.lang.Double.isFinite(_)


  • is on the same (or similar) level of abstraction as .isNaN and .isInfinity,
  • is neither the inverse of .isNaN nor .isInfinity (it's something else),
  • provides at least the same utility as .isNaN nor .isInfinity

Lastly at least in my judgement it's more common to ensure that a number is finite, than to ensure that a number is Infinity/NaN. In most cases Infinity/NaN is what you want a number not to be, and you end up using those methods for filtering purposes, where .isFinite would provide the greater utility and readability. Using java.lang.Double is ugly and reinventing the wheel (writing your own implementation) is unnecessary.

For the above reasons I propose to add .isFinite to RichDouble.

@SethTisue SethTisue added the library label May 16, 2019

@SethTisue SethTisue added this to the Backlog milestone May 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.