Sha256: 0252b91cc161946474c1d7df6947c9750d6b201757c1f89f257edb717dfa16df

Contents?: true

Size: 632 Bytes

Versions: 8

Compression:

Stored size: 632 Bytes

Contents

$:.unshift(File.dirname(__FILE__)+"/../lib")
require 'distribution'
require 'bench_press'

extend BenchPress

name 'aprox vs exact factorization method'
author 'Claudio Bustos'
date '2011-01-27'
summary "
Factorization requires a lot of processing, so approximation method could be  required. But for greats value, bigdecimal are required and things start to get harder.
* Approximation (fast_factorial): Luschny f.3
* Exact (factorial): Luschny Swing Prime 
"

reps 10 #number of repetitions

x=200

measure "Math.factorial(#{x})" do
  Math.factorial(x)
end

measure "Math.fast_factorial(#{x})" do
  
  Math.fast_factorial(x)
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
distribution-0.7.3 benchmark/factorial_method.rb
distribution-0.7.2 benchmark/factorial_method.rb
distribution-0.7.1 benchmark/factorial_method.rb
distribution-0.7.0 benchmark/factorial_method.rb
distribution-0.6.0 benchmark/factorial_method.rb
distribution-0.5.0 benchmark/factorial_method.rb
distribution-0.4.0 benchmark/factorial_method.rb
distribution-0.3.0 benchmark/factorial_method.rb