home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gumby!yale!yale.edu!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.lisp
- Subject: Re: Ambiguous numbers
- Date: 11 Nov 1992 19:03:25 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 22
- Message-ID: <1drldtINNggi@early-bird.think.com>
- References: <RICHARD.92Nov11115905@CLYDE.ttt.kth.se>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <RICHARD.92Nov11115905@CLYDE.ttt.kth.se> RICHARD@ttt.kth.se writes:
- >when *read-base* is something like 16, some numbers are of ambiguous type.
- >
- >For example, 0E0 could be read as an integer 224, or as the single-float 0.0
- >
- >What I want to know is, which type SHOULD take precedence in such a case?
-
- From p.520 of CLtL2:
-
- The ambiguity is resolved in accordance with the general principle that
- interpretation as a digit is preferred to interpretation as a number
- marker. The consequence in this case is that if a token can be
- interpreted as either an integer or a floating-point number, then it is
- taken to be an integer.
-
- You can resolve the ambiguity by adding a decimal point. 0.E0 is always a
- float.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-