Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created September 23, 2018 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/08d6488f2b56ff10f0e9dc3d21fe28a8 to your computer and use it in GitHub Desktop.
Save zoffixznet/08d6488f2b56ff10f0e9dc3d21fe28a8 to your computer and use it in GitHub Desktop.
diff --git a/src/core/Rat.pm6 b/src/core/Rat.pm6
index 811bbca..ea60b97 100644
--- a/src/core/Rat.pm6
+++ b/src/core/Rat.pm6
@@ -207,7 +207,8 @@ multi sub infix:<**>(Rational:D \a, Int:D \b) {
multi sub infix:<==>(Rational:D \a, Rational:D \b) {
nqp::isfalse(a.denominator) || nqp::isfalse(b.denominator)
- ?? a.Num == b.Num
+ ?? a.numerator == b.numerator
+ && nqp::hllbool(nqp::istrue(a.numerator)) # NaN != NaN
!! a.numerator * b.denominator == b.numerator * a.denominator
}
multi sub infix:<==>(Rational:D \a, Int:D \b) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment