Skip to content

Commit ef2a93b

Browse files
committed
Clarify eqv with zero-denominator Rationals
Rakudo impl: rakudo/rakudo@c91bcc2afc Spec: Raku/roast@9b69d9787c
1 parent 9b9b757 commit ef2a93b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/Language/operators.pod6

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,13 @@ if only one C<Iterable> is lazy.
16411641
(try say (1…∞) eqv (1…∞)) # Both lazy and of the same type. Cannot compare; throws.
16421642
orelse say $!.^name; # OUTPUT: «X::Cannot::Lazy␤»
16431643
1644+
Zero-denominator L<Rationals|/type/Rational>, such as L<Rat> and L<FatRat> types
1645+
are considered equivalent if their L<numerators|/routine/numerator>
1646+
are both C<0> or are of the same sign:
1647+
1648+
say 1/0 eqv 42/0; # OUTPUT: «True␤»
1649+
say -1/0 eqv 42/0; # OUTPUT: «False␤»
1650+
16441651
The default C<eqv> operator even works with arbitrary objects. E.g., C<eqv>
16451652
will consider two instances of the same object as being structurally
16461653
equivalent:

0 commit comments

Comments
 (0)