note 95541 added to gmp.examples
| From: | Nitrogen at osu1 dot php dot net | Date: | Fri, 08 Jan 2010 02:01:26 +0000 |
| Subject: | note 95541 added to gmp.examples | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164769@lists.php.net to get a copy of this message | ||
The comment below is correct..
Also, for this factorial business.. I believe it's pretty much the fastest way to making
factorials.
Here's some benchmarkings with the provided example code..
1M! in about 40 minutes.
5M! in about 15 hours, 30 minutes.
10M! in about 2 days, 7 hours.
Note: (n)M! = n millionth factorial.. computed on a 2.5GHz x64 processor.
And unfortunately, the GMP functions aren't multithreaded.
Here's some speed comparisons for making factorials:
gmp_fact():
0.01114893 secs
fact() manpage example code (in document above):
0.08637404 secs
BC Math bcmul():
7.85198307 secs
gmp_fact will be the fastest way to produce nice lengthy factorials.. it produced 100,000! in
exactly 10 seconds.. but obviously as the numbers get bigger, the slower it'll become.
I hope this information provides nice insight to these functions.
----
Server IP: 92.48.74.199
Probable Submitter: 86.132.124.100
----
Manual Page -- http://www.php.net/manual/en/gmp.examples.php
Edit -- https://master.php.net/note/edit/95541
Del: integrated -- https://master.php.net/note/delete/95541/integrated
Del: useless -- https://master.php.net/note/delete/95541/useless
Del: bad code -- https://master.php.net/note/delete/95541/bad+code
Del: spam -- https://master.php.net/note/delete/95541/spam
Del: non-english -- https://master.php.net/note/delete/95541/non-english
Del: in docs -- https://master.php.net/note/delete/95541/in+docs
Del: other reasons-- https://master.php.net/note/delete/95541
Reject -- https://master.php.net/note/reject/95541
Search -- https://master.php.net/manage/user-notes.php