File: rat_of_term.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 (27 lines) | stat: -rw-r--r-- 740 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
\DOC rat_of_term

\TYPE {rat_of_term : term -> num}

\SYNOPSIS
Converts a canonical rational literal of type {:real} to an OCaml number.

\DESCRIBE
The call {rat_of_term t} where term {t} is a canonical rational literal of type
{:real} returns the corresponding OCaml rational number (type {num}). The 
canonical literals are integer literals {&n} for numeral {n}, {-- &n} for a
nonzero numeral {n}, or ratios {&p / &q} or {-- &p / &q} where {p} is nonzero,
{q > 1} and {p} and {q} share no common factor.

\FAILURE
Fails when applied to a term that is not a canonical rational literal.

\EXAMPLE
{
  # rat_of_term `-- &22 / &7`;;
  val it : num = -22/7
}

\SEEALSO
is_ratconst, mk_realintconst, REAL_RAT_REDUCE_CONV, term_of_rat.

\ENDDOC