]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/e-decimals/e-decimals.factor
move benchmarks from work to extra. wtf oops
[factor.git] / extra / benchmark / e-decimals / e-decimals.factor
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
4 sequences ;
5 IN: benchmark.e-decimals
6
7 :: calculate-e-decimals ( n -- e )
8     n [1,b] [ factorial 0 <decimal> D: 1 swap n D/ ] map
9     D: 1 [ D+ ] reduce ;
10
11 : calculate-e-decimals-benchmark ( -- )
12     5 [ 800 calculate-e-decimals drop ] times ;
13
14 MAIN: calculate-e-decimals-benchmark