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

Error with the modulo operator #51

Closed
Ecoral360 opened this issue Nov 4, 2021 · 7 comments
Closed

Error with the modulo operator #51

Ecoral360 opened this issue Nov 4, 2021 · 7 comments
Assignees
Labels
bug Something isn't working solved This issue is solved

Comments

@Ecoral360
Copy link
Collaborator

If you take the modulo of a variable while in a for loop (the variable must be the one used by the for loop (i in the example)), it yields a tuple where the first element is the floor division and the second element is the actual modulo
Ex:

for i in range(100)
    print(i % 2) # yields (i // 2, i % 2)
@ALavallee ALavallee self-assigned this Nov 4, 2021
@ALavallee ALavallee added the bug Something isn't working label Nov 4, 2021
@ALavallee
Copy link
Contributor

Thank you so much for findings these bugs ! :D

I'll take a look at this right now !

@Ecoral360
Copy link
Collaborator Author

I'm trying to test the speed of the compiler against Cython by comparing their speed for finding prime numbers (that's how I ran into those bugs :D)

@ALavallee
Copy link
Contributor

ALavallee commented Nov 4, 2021

Love that =) ! <3
Keep up the good work !

@ALavallee
Copy link
Contributor

If you're doing benchmark I just want to note that the for each loop with integers optimization is not in yet. You're going to see a HUGE difference when it will be.

@Ecoral360
Copy link
Collaborator Author

Perfect! I'll keep that in mind!

@ALavallee
Copy link
Contributor

Done in 4e83c84:

@ALavallee
Copy link
Contributor

ALavallee commented Nov 4, 2021

Should be good. Because of wrong ID it was actually calling the divmod binary func instead of the remainder one.

Thank you again ! :D

@ALavallee ALavallee added the solved This issue is solved label Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working solved This issue is solved
Projects
None yet
Development

No branches or pull requests

2 participants