Skip to content

Commit

Permalink
math: some docs tweaks for gcd and mod-inv
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Jan 31, 2024
1 parent 859077b commit dee2bf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion basis/math/functions/functions-docs.factor
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ HELP: divisor?

HELP: mod-inv
{ $values { "x" integer } { "n" integer } { "y" integer } }
{ $description "Outputs an integer " { $snippet "y" } " such that " { $snippet "xy = 1 (mod n)" } "." }
{ $description "Outputs an integer " { $snippet "y" } " such that " { $snippet "x*y = 1 (mod n)" } "." }
{ $errors "Throws an error if " { $snippet "n" } " is not invertible modulo " { $snippet "n" } "." }
{ $examples
{ $example "USING: math.functions prettyprint ;" "173 1119 mod-inv ." "815" }
Expand Down
6 changes: 5 additions & 1 deletion core/math/math-docs.factor
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ HELP: >rect
HELP: gcd
{ $values { "x" integer } { "y" integer } { "a" integer } { "d" integer } }
{ $description "Computes the positive greatest common divisor " { $snippet "d" } " of " { $snippet "x" } " and " { $snippet "y" } ", and another value " { $snippet "a" } " satisfying:" { $code "(a*x - d) mod y == 0" } }
{ $notes "If " { $snippet "d" } " is 1, then " { $snippet "a" } " is the inverse of " { $snippet "y" } " modulo " { $snippet "x" } "." } ;
{ $notes "If " { $snippet "d" } " is 1, then " { $snippet "a" } " is the inverse of " { $snippet "x" } " modulo " { $snippet "y" } "." }
{ $examples
{ $example "USING: kernel math prettyprint ;" "54 26 gcd [ . ] bi@" "1\n2" }
{ $example "USING: math prettyprint ;" "54 1 * 2 - 26 mod ." "0" }
} ;

HELP: lcm
{ $values { "a" integer } { "b" integer } { "c" integer } }
Expand Down

0 comments on commit dee2bf9

Please sign in to comment.