|
Boost : |
From: Stephen Nutt (snutt_at_[hidden])
Date: 2003-09-19 07:23:48
I've uploaded a new version. Changes are
1) Uses enums rather than BOOST_STATIC_CONSTANT. (Many thanks Daniel Frey
for the suggestion)
2) This allowed me to more cleanly process 256 possible factors per template
instansiation rather than 20
3) So lower memory and cpu requirements
4) Changed the order the factors are checked from high first to low first.
Should speed up the detection of non prime numbers. (Thanks David Bakin)
5) Minor change to root to handle unsigned numbers than cannot be expressed
as an integer.
Thanks for all the great feedback. I'm still usig the brute for approach,
but this weekend I hope to do some research into one of the other algorithms
mentioned here. (Suggestions from Reid Sweatman, Geoff Leyland & Lucas
Galfaso)
The current algorithm allows me to handle any 32bit unsigned numbers in a
reasonable time (under 5 seconds). Smaller numbers (0-24 bits) do not cause
any noticeable compiler slowdown.
Stephen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk