New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dealing with degenerate case for polymod. #3742
Comments
From @grondiluHello, While writing a version of the Van der Corput sequence in I suggest the attached patch in order to have polymod return zero |
From @grondilu0001-dealing-with-degenerate-case-for-polymod.patchFrom 75f1b01e951270173dc3a6d04dad18c4de9c99ac Mon Sep 17 00:00:00 2001
From: "L. Grondin" <grondilu@yahoo.fr>
Date: Wed, 18 Mar 2015 08:16:59 +0100
Subject: [PATCH] dealing with degenerate case for polymod
---
src/core/Int.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/core/Int.pm b/src/core/Int.pm
index f79330d..723c646 100644
--- a/src/core/Int.pm
+++ b/src/core/Int.pm
@@ -64,6 +64,7 @@ my class Int does Real { # declared in BOOTSTRAP
# If self is Int, we assume mods are Ints also. (div fails otherwise.)
# If do-not-want, user should cast invocant to proper domain.
method polymod(Int:D: *@mods) {
+ return 0 if self == 0;
my $more = self;
my $inf = @mods.elems == Inf;
fail X::OutOfRange.new(what => 'invocant to polymod', got => $more, range => "0..*") if $more < 0;
--
2.1.4
|
From @cokeSorry for the delay in responding. This patch no long applies cleanly. If you would still like to pursue this issue, please submit a PR to the rakudo github project, which will make it easier to review and apply. -- |
The RT System itself - Status changed from 'new' to 'open' |
@coke - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#124104 (status was 'rejected')
Searchable as RT124104$
The text was updated successfully, but these errors were encountered: