-
Notifications
You must be signed in to change notification settings - Fork 4
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
Curiousness at 1200! (factorial)... ? #16
Comments
Cross posted as rust-num/num#429 |
We do have a different implementation of the factorial algorithm since |
Of course, the computation of |
1200 is one of the limits for crossing over implementations, so presumably we are making a mistake there. |
Tagging in @marcantoinem, who contributed the original implementation; but otherwise I need to dig into the code to and find out what is going on. |
Good point... my use is pretty simple... can probably implement this and also take advantage of intermediate values... 🤔 |
I've pushed some tests based on your example, something fishy is also definitely going on at around 37! |
I'm investigating this issue and it seem that all odds factorial that I calculated were wrong after 37 (it's were the first implementation of the prime swing is used with array) and all factorials with the other implementation over 1200 are wrong. |
I think I found the culprit, my prime swing function doesn't work as it should, I will take a bit of time to fix this. Please rollback to a version without the new implementation in the meantime. |
Confirm my quick test is now looking good following #17, #18, and upgrading to factorial 0.4.0. Thanks for the quick response @thomwiggers and @marcantoinem! diff --git a/Cargo.toml b/Cargo.toml
index b616e70..51e18fa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,5 +4,5 @@ version = "0.1.0"
edition = "2021"
[dependencies]
-factorial = "0.3.0"
+factorial = "0.4.0"
num = { version = "0.4.1", features = ["num-bigint"] }
|
This used to work just fine about a year ago (with num 0.4.0 and factorial 0.2.1) to calculate permutations:
Reference xpg/README.md and xpg/src/lib.rs: permutations() function and use.
Now working with num 0.4.1 (with or without num-bigint feature, doesn't seem to matter) and factorial 0.3.0 and otherwise same code says:
What? Any idea what could be going on here?
Dev'd a quick test...
Cargo.toml:
src/main.rs:
which prints:
So something weird going on around n = 1200...
Any help/pointers are greatly appreciated! Thanks!
The text was updated successfully, but these errors were encountered: