File: gcd_num.doc

package info (click to toggle)
hol-light 20170109-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 36,568 kB
  • ctags: 8,549
  • sloc: ml: 540,018; cpp: 439; lisp: 286; java: 279; makefile: 262; sh: 229; yacc: 108; perl: 78; ansic: 57; sed: 39
file content (32 lines) | stat: -rw-r--r-- 675 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
\DOC gcd_num

\TYPE {gcd_num : num -> num -> num}

\SYNOPSIS
Computes greatest common divisor of two unlimited-precision integers.

\DESCRIBE
The call {gcd_num m n} for two unlimited-precision (type {num}) integers {m}
and {n} returns the (positive) greatest common divisor of {m} and {n}. If 
both {m} and {n} are zero, it returns zero.

\FAILURE
Fails if either number is not an integer (the type {num} supports arbitrary 
rationals).

\EXAMPLE
{
  # gcd_num (Int 35) (Int(-77));;
  val it : num = 7
  
  # gcd_num (Int 11) (Int 0);;
  val it : num = 11
  
  # gcd_num (Int 22 // Int 7) (Int 2);;
  Exception: Failure "big_int_of_ratio".
}

\SEEALSO
gcd, lcm_num.

\ENDDOC