[LISPWORKS][Common Lisp HyperSpec (TM)] [Previous][Up][Next]


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-9. The second sequence may not consist entirely of zeros. Examples of ratios are in the next figure.

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  

Figure 2-13. Examples of Ratios

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


[Starting Points][Contents][Index][Symbols][Glossary][Issues]
Copyright 1996-2005, LispWorks Ltd. All rights reserved.