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
high(float) & low(float) #5039
Comments
What that be? Floats support +-INF. When is this useful? |
Sorry, didn't know about that. I was using it along with this random proc: http://nim-lang.org/docs/random.html#random,float |
Wouldn't it make sense for |
And what would that accomplish? Which use cases does this cover? Why did we get away without for years? |
It would save me time googling why |
I think that might be an okay idea. It's logical if people think there is a |
You can save my time now and tell me why you wrote high(float) in the first place. |
"My non-sensical expression didn't compile" is NOT a gotcha. |
Interesting... Rust's f32::MAX gives the highest finite value https://doc.rust-lang.org/stable/std/f32/ |
@tmerr why it can be useful though? |
@Yardanico no idea. It seems like c++'s float max does the same thing: http://www.cplusplus.com/reference/limits/numeric_limits/ . It would be good to understand the motivation for this before making a decision in nim |
It might be useful for generic code, imo. |
The only thing that would make sense to me is to return the highest/lowest safely representable value. But i'm finding hard to find a real-world use-case for this... The numerical limit constants are probably enough for all practical purposes. |
Just for fun, i was playing around with floats. If somebody is interested in some of the special floats, please take a look at: https://play.nim-lang.org/?gist=6dca0bb2f6b2fb99fa4fbb9e8af3d74a |
Can be closed now that #6570 is merged. |
There exists
high(int)
andlow(int)
, but when I tried to dohigh(float)
, the compiler gave me anError: invalid argument for 'high'
Is it possible to add
high()
andlow()
procs for thefloat
type?The text was updated successfully, but these errors were encountered: