summaryrefslogtreecommitdiff
path: root/factors/score.go
AgeCommit message (Collapse)Author
2023-09-19factors.Score: Avoid overflow by using math/bigAdrien Hopkins
When using really large numbers, factors.Score could overflow, which would cause an incorrect result. Using arbitrary-precision arithmetic fixes this. I only do so above 2^28, since below then factor sums are guaranteed to not overflow, and normal arithmetic is faster.
2023-09-19factors: refactor code to improve readabilityAdrien Hopkins
2023-09-13factors: Remove most panicsAdrien Hopkins
Panics are not the best way of handling errors in Go. I've replaced panics with default values whenever a sensible one exists. Factors(0) does not have a sensible default value (as every number is a factor of zero), so it still panics.
2023-08-21Add 2345 Score to outputAdrien Hopkins
2023-08-21Add totative ratio and factor score to programAdrien Hopkins