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

Re: Nitpick with FLOOR etc.



> From: Aubrey Jaffer <agj@xxxxxxxxxxxx>
> procedure        #i-/0            #i+/0
> =========        =====            =====
>
> floor            error           179.76931348623157e306
>
> ceiling  -179.76931348623157e306  error
>
> truncate -179.76931348623157e306 179.76931348623157e306
>
> round    -179.76931348623157e306 179.76931348623157e306

- it's not clear this is necessarily desirable?

As upon further thought it seems most reasonable that infinities
return infinities, or optionally throw an exception, for all such
scenarios to be most consistent? (As otherwise the marginal error
resulting from the conversion may be infinite itself which seems
inconsistent with the expectations of the conversion.)

If so, and correspondingly that: (= (floor x) (/ (ceiling (/ x)))),
then (= #i-/0 (/ #i-0)), (= #i+/0 (/ #i+0)), (= 0 (/ 0)); again
seemingly implying the necessity of something along the lines of:

 -1.0 -10. -1/0   +1/0 +10. +1.0
 -------------- 0 --------------
 -1.0 -0.1 -0/1   +0/1 +0.1 +1.0

[it would seem? although won't try to sell the thought any further.]