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

Munchausen timing for Julia is probably off #10

Open
mauro3 opened this issue Dec 14, 2020 · 1 comment
Open

Munchausen timing for Julia is probably off #10

mauro3 opened this issue Dec 14, 2020 · 1 comment

Comments

@mauro3
Copy link

mauro3 commented Dec 14, 2020

I ran the https://github.com/JulesKouatchou/basic_language_comparison/blob/master/Julia/test_munchausen.jl script on my laptop and got times of 7s to 5s for Julia 0.6.4, 1.0 and 1.5. Thus the 100s on a Xenon-node seem off.

@DNF2
Copy link

DNF2 commented Jan 7, 2021

In the Java code, there is an early bail-out when the intermediate sum exceeds the input number. This bailout does not occur in Julia, and not in some other languages either, and makes a big difference.

Furthermore

digit = thisnumber % 10
sumofpowers += power_of_digits[digit+1]
thisnumber ÷= 10

should use divrem instead of first doing rem and later div, which is redundant.

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

2 participants