[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comments and some bugs

This page is part of the web mail archives of SRFI 54 from before July 7th, 2015. The new archives for SRFI 54 contain all messages, not just those from before July 7th, 2015.



soo wrote:

 * From: Jens Axel Søgaard <jensaxel@xxxxxxxxxxxx>

 > (fmt -5.0 0 #\space 10 + 'e)
 | . fmt: exact number cannot have a decimal point
 | 10 depth (and depth (eq? exactness (quote e)))    ; Why not?

 > (fmt -5 0 #\space 10 + 'e)
 | . fmt: exact number cannot have a decimal point 10 depth (and depth (eq? exactness (quote e)))

R5RS says: If the written representation of a number has no exactness prefix,
the constant may be either inexact or exact.  It is inexact if it contains a
decimal point, an exponent, or a "#" character in the place of a digit,
otherwise it is exact.

Yes?

What the above says is that if the reader sees a number *without exactness prefix*
such as "-5.0" then it by default shall read it as inexact if there is decimal dot.

If there is an exactness prefix the above rule doesn't apply since, it is obvious
whether the number read is exact or inexact.

Example:

  > (exact? #e-5.0)
  #t

  > (exact? -5.0)
  #f

--
Jens Axel Søgaard