File: numdom.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 (31 lines) | stat: -rw-r--r-- 674 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
\DOC numdom

\TYPE {numdom : num -> num * num}

\SYNOPSIS
Returns numerator and denominator of normalized fraction.

\DESCRIBE
Given a rational number as supported by the {Num} library, {numdom} returns a 
numerator-denominator pair corresponding to that rational number cancelled down 
to its reduced form, $p/q$ where $q > 0$ and $p$ and $q$ have no common factor.

\FAILURE
Never fails.

\EXAMPLE
{
  # numdom(Int 22 // Int 7);;
  val it : num * num = (22, 7)
  # numdom(Int 0);;
  val it : num * num = (0, 1)
  # numdom(Int 100);;
  val it : num * num = (100, 1)
  # numdom(Int 4 // Int(-2));;
  val it : num * num = (-2, 1)
}

\SEEALSO
denominator, numerator.

\ENDDOC