From af8e25b9e821067a02a9c6e551ce01363e67110f Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sat, 6 Jan 2024 17:52:36 -0800 Subject: [PATCH] math.functions: fix divisor? to work with mixed numbers --- basis/math/functions/functions-tests.factor | 1 + basis/math/functions/functions.factor | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/math/functions/functions-tests.factor b/basis/math/functions/functions-tests.factor index 906264e5e2..c7fe48545b 100644 --- a/basis/math/functions/functions-tests.factor +++ b/basis/math/functions/functions-tests.factor @@ -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 diff --git a/basis/math/functions/functions.factor b/basis/math/functions/functions.factor index c9cb435197..d691fb9f74 100644 --- a/basis/math/functions/functions.factor +++ b/basis/math/functions/functions.factor @@ -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 ; -- 2.34.1