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

isNumber #626

Closed
davidhesselbom opened this issue Oct 28, 2015 · 3 comments
Closed

isNumber #626

davidhesselbom opened this issue Oct 28, 2015 · 3 comments
Assignees
Milestone

Comments

@davidhesselbom
Copy link
Contributor

Sometimes, we want to check that a floating point number isn't NaN. We do this by comparing the number to itself: if value != value, then value is NaN.

A property can be defined make this a little prettier:
isNumber ::= this == this

With it, the following program

value := 0.0f
value isNumber toString() println()
value /= value
value isNumber toString() println()

prints

true
false

But where should the function be added?

  • To Numbers.ooc (where it will always be available), or
  • to math.ooc (which will require anyone who wants to use it to import math)?
@davidpiuva
Copy link
Contributor

Both ways works for me.

@niklasborwell
Copy link
Contributor

@marcusnaslund Are we doing this?

@marcusnaslund
Copy link
Contributor

Yes, I think this is a good idea.

@marcusnaslund marcusnaslund self-assigned this Dec 10, 2015
@marcusnaslund marcusnaslund added this to the Cleanup milestone Dec 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants