Skip to content
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

bug in epochArithmeticMod ? #49

Open
SteveAlexander opened this issue Dec 16, 2020 · 0 comments
Open

bug in epochArithmeticMod ? #49

SteveAlexander opened this issue Dec 16, 2020 · 0 comments

Comments

@SteveAlexander
Copy link
Collaborator

In epochArithmeticMod in utilities.dart, there is a repeated if statement. Is it meant to be y in the second one?

/// This returns a pattern consistent with epoch (or calendar) based times
/// [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
/// [ 1,  2,  0,  1,  2, 0, 1, 2, 0, 1, 2]
int epochArithmeticMod(num x, int y) {
  if (x >= 0) return x % y;
  if (x >= 0) return x % y;
  return -(y-x)%y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant