View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Greg Lovern Greg Lovern is offline
external usenet poster
 
Posts: 224
Default Frustrated with Factorials

what I am attempting to do is write a procedure for a certain range
of
"large" numbers in my example I would multiply 364 by 363 and store

the
results then multiply the stored results by 362 and store the results
then multiply the stored results by 361 etc.


Someone who's been following this string asked me how long xlPrecision
would take to calculate 364!. I thought some others might be
interested, so here's my reply:

---------------------------------------------------
On a worksheet, on my creaky old Athlon 800 (no money to upgrade..),
it took about 4 seconds to calculating 364! down a column.

In Excel VBA it took about 3 seconds:

========================================
Dim xlp As xlPrecision.cls_xlPrecision
Dim strRet As String
Dim i As Integer
Dim iStart As Double, iEnd As Double

Set xlp = CreateObject("xlPrecision.cls_xlPrecision")
strRet = 1

iStart = Time
For i = 1 To 364
strRet = xlp.xlpMULTIPLY(strRet, i)
Next i
iEnd = Time
Debug.Print Format(iEnd - iStart, "ss")
Workbooks(1).Worksheets(1).Cells(1).Value = strRet
---------------------------------------------------

I checked the answer against Charles Douglas Wehner's answer posted
2003-07-15 10:27:00 PST, and they are the same.

With xlPrecision's 32,767 significant digits, the largest factorial it
can calculate is 10,958!.

I guess I should add a xlpFACTORIAL function to xlPrecision. I've been
working on adding xlpROOT and xlpPOWER.


Take care,

Greg Lovern
http://PrecisionCalc.com
Get Your Numbers Right
================================================== =====