Skip to content

Commit

Permalink
math.functions: fix divisor? to work with mixed numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Jan 7, 2024
1 parent ba8d61e commit af8e25b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions basis/math/functions/functions-tests.factor
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ CONSTANT: log10-factorial-1000 0x1.40f3593ed6f8ep11
{ t } [ 42 -7 divisor? ] unit-test
{ t } [ 42 42 divisor? ] unit-test
{ f } [ 42 16 divisor? ] unit-test
{ t } [ 42.0 1 divisor? ] unit-test

{ 3 } [ 5 7 mod-inv ] unit-test
{ 78572682077 } [ 234829342 342389423843 mod-inv ] unit-test
Expand Down
3 changes: 1 addition & 2 deletions basis/math/functions/functions.factor
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ PRIVATE>

: nth-root ( n x -- y ) swap recip ^ ; inline

: divisor? ( m n -- ? )
mod 0 = ; inline
: divisor? ( m n -- ? ) mod zero? ; inline

ERROR: non-trivial-divisor n ;

Expand Down

0 comments on commit af8e25b

Please sign in to comment.