Sha256: 8ff3d43f1d3af175de60db4e15e68046beec7a5d41b86255762f29b6b7ced0ea
Contents?: true
Size: 539 Bytes
Versions: 1
Compression:
Stored size: 539 Bytes
Contents
require 'bench_press' require 'bigdecimal' extend BenchPress name 'Float vs Rational power' author 'Claudio Bustos' date '2011-02-02' summary " On ruby, the maximum size of a float is #{Float::MAX}. With Rational, we can raise to integer numbers and surpass Float maximum. What is the speed reduction using Rational?" reps 1000 # number of repetitions int = 10 rat = 10.quo(1) bd = BigDecimal('10') measure 'Using float pow' do int**307 end measure 'Using rational' do rat**307 end measure 'Using big decimal pow' do bd**307 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
distribution-0.8.0 | benchmark/power.rb |