Just for something to do, I calculated 300,000 factorial.
' code (modules not shown) ---------------------------------------------------------------------------------- program fact use reg1001 use reg1008 use conversions use time implicit none type(reg1001type)::r1 type(reg1008type)::r8 integer::n real::et n=300000 print* call allocatereg01(r1,numfactorialdigits01(n)) call allocatereg08(r8,numfactorialdigits08(n)) call startclock() call factorial08(r8,n) call reg1008toreg1001(r8,r1) call stopclock() call elapsedtime(et) print* print'(a,f9.3,a)',"calculation time = ",et," seconds" print* print'(a,i7,a)',"300,000! has ",r1%maxpower+1," decimal digits." print* call deallocatereg01(r1) call deallocatereg08(r8) end program ' output ---------------------------------------------------------------------------------------------------- C:\Users\root\Desktop\fortran\cat\bin\Release>cat n! t (seconds) 010000 1.669 020000 7.410 030000 17.425 040000 32.261 050000 51.933 060000 76.596 070000 106.549 080000 141.462 090000 181.538 100000 226.903 110000 277.729 120000 334.373 130000 396.399 140000 463.557 150000 536.378 160000 615.112 170000 699.602 180000 789.443 190000 885.243 200000 986.550 210000 1093.614 220000 1206.590 230000 1325.260 240000 1449.795 250000 1579.822 260000 1715.808 270000 1857.863 280000 2005.190 290000 2158.305 300000 2316.662 calculation time = 2316.802 seconds 300,000! has 1512852 decimal digits. C:\Users\root\Desktop\fortran\cat\bin\Release>
Bookmarks