[r6rs-discuss] [Formal] It is not clear what negating 0.0 (corrected)

From: Paul Schlie <schlie>
Date: Fri Dec 22 21:27:16 2006

> Felix Klock writes:
> I do not believe there is an obviously correct choice between 0.0 and
> -0.0. In support of this statement, here is an informal tally of
> Scheme system behaviors (a * means that particular scheme
> implementation does not yield negative infinity from (/ 1.0 (* -1.0
> 0.0)), and therefore there may be no way to actually observe a -0.0):

Personally, I'd expect that implementations which differentiate between
-inf.0 and +inf.0, must correspondingly compute and propagate the correct
algebraic sign throughout all computations; (/ (/ (- 0.0))) => -0.0 and

  (< -inf.0 +inf.0) => #t and (/ (* 0.0 -1.0)) :: (/ -0.0) => -inf.0

or alternatively, implementations which choose not to differentiate
between -0.0 and +0.0 and consider them strictly equivalent, must
correspondingly not differentiate between -inf.0 and +inf.0 and consider
them equivalent and unordered (ambiguous sign); (/ (/ (- 0.0))) => 0.0

  (< -inf.0 +inf.0) => #f and (/ (* 0.0 -1.0)) :: (/ 0.0) => inf.0

Anything otherwise simply implements inconsistent algebraic semantics,
and should not be sanctioned (as regardless of the behavior of existing
implementations, the existence of such inconsistencies should not be
considered prima-facie evidence of their legitimacy)

Personally I like the requirement that:

   (/ (/ (- x))) :: (/ (/ (* -1 x))) => -x
Received on Fri Dec 22 2006 - 21:26:40 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC