On Thu, 23 Feb 2017 22:01:25 -0800, j...@durchholz.org wrote: > Somewhat offtopic:
Feels like a bad place for offtopic discussions. You can ask questions in the same IRC channel you evaled your example. > 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. 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} < +∞" It's not the only departure from mathematical result for the sake more practically useful results. Division by zero has well-defined behaviour in floating point math, and Rationals in Num view preserve it: <Zoffix> m: say <1/0> == Inf <camelia> rakudo-moar 320c2f: OUTPUT: «True» <Zoffix> m: say <-1/0> == -Inf <camelia> rakudo-moar 320c2f: OUTPUT: «True» <Zoffix> m: say <0/0>.Num === NaN <camelia> rakudo-moar 320c2f: OUTPUT: «True» On Thu, 23 Feb 2017 22:22:22 -0800, dar...@darrenduncan.net wrote: > I would have a serious problem with any programming language where it > isn't the > case that asking "is $x the same thing as $x in every possible way" > doesn't > result in TRUE for all possible values of $x. Then I'd hate to tell you, but such a value exists in most languages: a NaN: <Zoffix> m: say NaN == NaN <camelia> rakudo-moar 320c2f: OUTPUT: «False»