]> gitweb.factorcode.org Git - factor.git/commitdiff
math.extras: fix bernoulli.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 10 Apr 2013 16:29:21 +0000 (09:29 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 10 Apr 2013 16:29:21 +0000 (09:29 -0700)
extra/math/extras/extras-tests.factor
extra/math/extras/extras.factor

index cda7a9ee23b3930417d77510b84777299fc9a89a..7a71bae69d74cdb8f5ccffd43312ac0ecde19135 100644 (file)
@@ -6,6 +6,9 @@ tools.test ;
 
 IN: math.extras.test
 
+{ { 1 -1/2 1/6 0 -1/30 0 1/42 0 -1/30 0 } }
+[ 10 iota [ bernoulli ] map ] unit-test
+
 { -1 } [ -1 7 jacobi ] unit-test
 { 0 } [ 3 3 jacobi ] unit-test
 { -1 } [ 127 703 jacobi ] unit-test
index d26bbe6cd3c0845efcadfdc9ea19abd81172e994..d3b9515c7082536942734ca4026d283d7c02ac24 100644 (file)
@@ -28,10 +28,10 @@ MEMO: stirling ( n k -- x )
 :: ramanujan ( x -- y )
     pi sqrt x e / x ^ * x 8 * 4 + x * 1 + x * 1/30 + 1/6 ^ * ;
 
-<PRIVATE
-
 DEFER: bernoulli
 
+<PRIVATE
+
 : (bernoulli) ( p -- n )
     [ iota ] [ 1 + ] bi [
         0 [ [ nCk ] [ bernoulli * ] bi + ] with reduce