News for hackers. Stuff that matters.
Re:1.5 is the midpoint between 0 and infinity in Ruby by recursive on Friday November 27, 2020 @11:05AM (#25229753)
This all makes sense. It seems like there would be some special edge cases around the finite/NaN boundary that would be rarely exercised. I wonder if/how those are handled.
Re:1.5 is the midpoint between 0 and infinity in Ruby by blm on Friday November 27, 2020 @11:18AM (#25229887)
From Python:

    >>> import numpy as np
    >>> 1 + np.Inf
    inf
    >>> (0 + np.Inf)/2
    inf
    >>>
Infinity is not a number it is a concept[1] My math teacher used to say think of infinity like a impossibly large number. An impossibly large number divided by two is still an impossibly large number

[1] http://mathforum.org/dr.math/faq/faq.large.numbers.html

Re:1.5 is the midpoint between 0 and infinity in Ruby by recursive on Friday November 27, 2020 @01:00PM (#25231020)
I'm not talking about math. I'm talking about computer numbers, specifically IEEE-754.

NaN is represented by a maximal (all ones) exponent, and at least one non-zero in the mantissa. Infinity has the same exponent but an all-zero mantissa. So with a naive comparison, NaN compares greater than infinity.

If you only believe output from programming languages, javascript claims that the type of infinity is "number".

    >>> typeof Number.POSITIVE_INFINITY
    "number"
Re:1.5 is the midpoint between 0 and infinity in Ruby by blm on Friday November 27, 2020 @07:22PM (#25233889)
I know you were talking about floating point. That is why I said what I said using python code. It seems to be a concrete representation of IEEE-754 math. Also from my reading and understanding numpy is written by scientists that understand IEEE-754 perhaps a little more than some others.

I was fully away of that stuff you say about how NaN is represented and was also aware of how Inf is represented. My statement and link to the concept of Infinity on mathforum was an effort to support the idea of why most math done with code involving Inf will also result in an answer of Inf.

The article that this whole discussion is about seems to think it is OK (ie not a bug) to convert a float like Inf to a integer do some math and convert back to a float and get 1.5 and that is OK. It seems like a bug to me.

Re:1.5 is the midpoint between 0 and infinity in Ruby by colejohnson66 on Friday November 27, 2020 @12:51PM (#25230892)
While you’re correct, you’re being downvoted probably because you’re taking this seriously. I’m sure most everyone here knows infinity isn’t a number, but a concept, but you never know.
Re:1.5 is the midpoint between 0 and infinity in Ruby by blm on Friday November 27, 2020 @07:14PM (#25233833)
I think any conversation that says there is halfway between inf and 0 is treating inf like it is a fixed point and therefore a number and not a concept

This is why participating on Hacker News conversations are problematic. I think you are talking about downvoting because a persons misunderstands me. Even in your statement you imply by saying "but you never know" that it is possible people aren't being aware of the point I was making