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

Re: Nitpick with FLOOR etc.



 | Date: Sat, 16 Jul 2005 04:38:16 -0400
 | From: Paul Schlie <schlie@xxxxxxxxxxx>
 | 
 | > If the stipulation that inexacts args produce inexacts results takes
 | > priority over finding the closest integer, then only inexact integers
 | > are eligible.  For an implementation having IEEE-754 64.bit flonum
 | > inexacts:
 | > 
 | > procedure  #i-/0   #i+/0
 | > =========  =====   =====
 | > 
 | > floor   error  179.76931348623157e306
 | > 
 | > ceiling  -179.76931348623157e306  error
 | > 
 | > truncate -179.76931348623157e306 179.76931348623157e306
 | > 
 | > round  -179.76931348623157e306 179.76931348623157e306
 | 
 | - are you proposing that a run-time error must be signaled; or more
 |   reasonably only that it may, and/or alternatively return -1/0 +1/0 ?
 |   [which I tend to view as being equivalent to #i-/0, #i+/0]

My chart proposed no change to R5RS.  These large magnitude numbers
are simply those IEEE-754 numbers satisfying the R5RS descriptions of
these procedures.

Oops! -- (floor #i-/0) and (ceiling #i+/0) are not automatically
allowed to be errors by R5RS because these procedures are expected to
return inexacts for inexact arguments.

I will add to the description:

  For an inexact argument x, it is an error if there is no inexact
  integer which satisfies the procedure description; for example
  calling `(floor -/0.)' or `(ceiling +/0.)' in an implementation
  having IEEE-754 64.bit flonum inexacts.

 |   - what about -0/1, +0/1 ?

All four functions return zero for an argument of zero.
There are no infinitesimals in SRFI-70.

 |   - should (= (floor x) (/ (ceiling (/ x))) [or reasonable approximation] ?

(let ((x -5)) (= (floor x) (/ (ceiling (/ x)))))  ==>  #f