On 24.02.2017 13:03, Zoffix Znet via RT wrote:
toolforger: p6: say Inf cmp Inf
camelia: rakudo-moar 320c2f: OUTPUT: «Same»
I.e. Inf compares equal to itself - is this intentional?
Yes, and we didn't invent this concept.
Heh. That's what you'd expect before reading IEEE.
After understanding all details of the IEEE standard, it's where you
return (but only for infinities, not for NaNs) :-)
> This area is governed by IEEE 2008-753 standard, section 6.1 of which
has this to say on infinities:
"The behavior of infinity in floating-point arithmetic is derived from the
limiting cases of real arithmetic
with operands of arbitrarily large magnitude, when such a limit exists.
Infinities shall be interpreted in
the affine sense, that is: −∞ < {every finite number} < +∞"
While that paragraph does not define how Inf relates to Inf, I see
elsewhere that IEEE indeed defines Inf == Inf (and -Inf == -Inf).
I thought infinities were just a slightly tamed version of NaNs, but
that was a misconception on my side.
It's not the only departure from mathematical result for the sake more
practically useful results.
I know :-)
Good thing that we have === so we can compare at the representational level.