]> gitweb.factorcode.org Git - factor.git/commitdiff
Make next-odd public again as it's used elsewhere
authorAaron Schaefer <aaron@elasticdog.com>
Thu, 7 May 2009 22:33:55 +0000 (18:33 -0400)
committerAaron Schaefer <aaron@elasticdog.com>
Thu, 7 May 2009 22:33:55 +0000 (18:33 -0400)
basis/math/miller-rabin/miller-rabin.factor

index 9fd604a00378c3a1bc9d9f4facf8647ba6542ac9..cb1d3723b47b24bf107165be6256920ba3d51208 100755 (executable)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008 Doug Coleman.
+! Copyright (c) 2008-2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: combinators kernel locals math math.functions math.ranges
 random sequences sets combinators.short-circuit math.bitwise
@@ -13,8 +13,6 @@ IN: math.miller-rabin
 
 : next-even ( m -- n ) >even 2 + ;
 
-: next-odd ( m -- n ) dup even? [ 1 + ] [ 2 + ] if ;
-
 TUPLE: positive-even-expected n ;
 
 :: (miller-rabin) ( n trials -- ? )
@@ -29,12 +27,14 @@ TUPLE: positive-even-expected n ;
         ] [
             r iota [
                 2^ s * a swap n ^mod n - -1 =
-            ] any? not 
+            ] any? not
         ] if
     ] any? not ;
 
 PRIVATE>
 
+: next-odd ( m -- n ) dup even? [ 1 + ] [ 2 + ] if ;
+
 : miller-rabin* ( n numtrials -- ? )
     over {
         { [ dup 1 <= ] [ 3drop f ] }