1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: decimals kernel locals math math.combinatorics ranges
5 IN: benchmark.e-decimals
7 : D-factorial ( n -- D! )
8 <iota> DECIMAL: 1 [ 0 <decimal> DECIMAL: 1 D+ D* ] reduce ; inline
10 :: calculate-e-decimals ( n -- e )
12 [ D-factorial DECIMAL: 1 swap n D/ D+ ] reduce ;
14 : e-decimals-benchmark ( -- )
15 5 [ 800 calculate-e-decimals drop ] times ;
17 MAIN: e-decimals-benchmark