Closed marcomaggi closed 11 years ago
The two following operations must return the same result:
(+ 1 -1.1-0.0i) => -0.10000000000000009+0.0i (- 1 +1.1+0.0i) => -0.10000000000000009+0.0i ^ !
but instead they returned:
(+ 1 -1.1-0.0i) => -0.10000000000000009-0.0i (- 1 +1.1+0.0i) => -0.10000000000000009+0.0i ^ !
this is wrong because R6RS specifies the following for the "-" function:
Implementations that distinguish -0.0 should adopt behavior consistent with the following examples: (+ 0.0 -0.0) => 0.0 (+ -0.0 0.0) => 0.0 (+ 0.0 0.0) => 0.0 (+ -0.0 -0.0) => -0.0
so the "+" operation must be implemented as:
(+ 1 -1.1-0.0i) == (make-rectangular (+ 1 -1.1) (+ 0 -0.0)) == (make-rectangular (+ 1 -1.1) (+ 0.0 -0.0)) == (make-rectangular (+ 1 -1.1) (+ 0.0 -0.0)) == (make-rectangular -0.100... 0.0)
notice that the step:
(+ 0 -0.0) == (+ 0.0 -0.0)
is not compliant with R6RS but we accept it because it makes other formulas work correctly, for example the following two versions of ATAN which should return the same result:
(define (atan-one x) (* +0.5i (- (log (+ 1 (* -1i x))) (log (+ 1 (* +1i x)))))) (define (atan-two x) (* +0.5i (- (log (- 1 (* +1i x))) (log (+ 1 (* +1i x))))))
Should be fixed in the head of the devel branch.
The two following operations must return the same result:
but instead they returned:
this is wrong because R6RS specifies the following for the "-" function:
so the "+" operation must be implemented as:
notice that the step:
is not compliant with R6RS but we accept it because it makes other formulas work correctly, for example the following two versions of ATAN which should return the same result: