add benchmarks to cacluate e using decimals, ratios
parent
d6851f5832
commit
5e9de85aac
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1,14 @@
|
||||||
|
! Copyright (C) 2009 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: decimals kernel locals math math.combinatorics math.ranges
|
||||||
|
sequences ;
|
||||||
|
IN: benchmark.e-decimals
|
||||||
|
|
||||||
|
:: calculate-e-decimals ( n -- e )
|
||||||
|
n [1,b] [ factorial 0 <decimal> D: 1 swap n D/ ] map
|
||||||
|
D: 1 [ D+ ] reduce ;
|
||||||
|
|
||||||
|
: calculate-e-decimals-benchmark ( -- )
|
||||||
|
5 [ 800 calculate-e-decimals drop ] times ;
|
||||||
|
|
||||||
|
MAIN: calculate-e-decimals-benchmark
|
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1,12 @@
|
||||||
|
! Copyright (C) 2009 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: kernel math math.combinatorics math.ranges sequences ;
|
||||||
|
IN: benchmark.e-ratios
|
||||||
|
|
||||||
|
: calculate-e-ratios ( n -- e )
|
||||||
|
iota [ factorial recip ] sigma ;
|
||||||
|
|
||||||
|
: calculate-e-ratios-benchmark ( -- )
|
||||||
|
5 [ 300 calculate-e-ratios drop ] times ;
|
||||||
|
|
||||||
|
MAIN: calculate-e-ratios-benchmark
|
Loading…
Reference in New Issue