home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / lisp / 2852 < prev    next >
Encoding:
Internet Message Format  |  1992-11-11  |  1.2 KB

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