add benchmarks to cacluate e using decimals, ratios

db4
Doug Coleman 2009-09-24 22:11:23 -05:00
parent d6851f5832
commit 5e9de85aac
4 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -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

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -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