Sha256: 89802e7d968cb9caae9d386afb9ed9b0b8ed84c08b27261b17615bff4e40da39

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

$LOAD_PATH.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

1 entries across 1 versions & 1 rubygems

Version Path
distribution-0.8.0 benchmark/factorial_method.rb