zlacker

[parent] [thread] 3 comments
1. jmnico+(OP)[view] [source] 2021-10-27 20:19:29
I don't think there's Infinity in my language, what do you use it for except maths?
replies(2): >>dpryde+ag >>eloisi+Lj
2. dpryde+ag[view] [source] 2021-10-27 21:54:51
>>jmnico+(OP)
If you are using floating point numbers implemented in hardware, then infinity is absolutely a valid value and one that your code will encounter. This is true regardless of language, as long as the language requires or allows IEEE-754 semantics.

I am not aware of any language (outside of intentionally-minimalist esolangs) that doesn't support floating point numbers. In some languages (like JavaScript) that's the only kind of number you get.

replies(1): >>jmnico+Wl1
3. eloisi+Lj[view] [source] 2021-10-27 22:22:30
>>jmnico+(OP)
If you are seeking a minimum value within some complicated iteration, it’s easier to start your min accumulator as Inf than null with extra null checks.
◧◩
4. jmnico+Wl1[view] [source] [discussion] 2021-10-28 08:41:37
>>dpryde+ag
You're right, there's double.PositiveInfinity and double.NegativeInfinity in C#.

Never encountered it before (and I'm ashamed to say C# is my main language since 2009).

[go to top]