ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  2 Syntax   2.3 Interpretation of Tokens   2.3.2 Constructing Numbers from Tokens   2.3.2.1 Syntax of a Rational

2.3.2.1.2 Syntax of a Ratio

Ratios can be written as an optional sign followed by two non-empty sequences of digits separated by a slash; see Figure 2.3.1 Numbers as Tokens. The second sequence may not consist entirely of zeros. Examples of ratios are in the next figure.

Examples of Ratios
2/3 ;This is in canonical form
4/6 ;A non-canonical form for 2/3
-17/23 ;A ratio preceded by a sign
-30517578125/32768 ;This is (-5/2)15
10/5 ;The canonical form for this is 2
#o-101/75 ;Octal notation for -65/61
#3r120/21 ;Ternary notation for 15/7
#Xbc/ad ;Hexadecimal notation for 188/173
#xFADED/FACADE ;Hexadecimal notation for 1027565/16435934

For information on how ratios are printed, see Section 22.1.3.1.2 Printing Ratios.


Home Previous Up Next Table of Contents Index
© Franz Inc. All Rights Reserved - File last updated 2022-07-25