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