Permalink
Browse files

Prevent spurious negative zeros

  • Loading branch information...
1 parent 604bb6f commit ab7d01c6ce63f553844efa1019b58cb9f0bea842 @Util Util committed Jul 22, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/pmc/complex.pmc
View
@@ -1773,12 +1773,12 @@ atanh = i atan(-ix)
GET_ATTR_re(INTERP, SELF, re);
GET_ATTR_im(INTERP, SELF, im);
SET_ATTR_re(INTERP, d, im);
- SET_ATTR_im(INTERP, d, -re);
+ SET_ATTR_im(INTERP, d, FLOAT_IS_ZERO(re) ? 0.0 : -re);
(PMC *d) = PCCINVOKE(INTERP, d, "asin");
GET_ATTR_re(INTERP, d, re);
GET_ATTR_im(INTERP, d, im);
- SET_ATTR_re(INTERP, d, -im);
+ SET_ATTR_re(INTERP, d, FLOAT_IS_ZERO(im) ? 0.0 : -im);
SET_ATTR_im(INTERP, d, re);
RETURN(PMC *d);
@@ -1828,12 +1828,12 @@ atanh = i atan(-ix)
GET_ATTR_re(INTERP, SELF, re);
GET_ATTR_im(INTERP, SELF, im);
SET_ATTR_re(INTERP, d, im);
- SET_ATTR_im(INTERP, d, -re);
+ SET_ATTR_im(INTERP, d, FLOAT_IS_ZERO(re) ? 0.0 : -re);
(PMC *d) = PCCINVOKE(INTERP, d, "atan");
GET_ATTR_re(INTERP, d, re);
GET_ATTR_im(INTERP, d, im);
- SET_ATTR_re(INTERP, d, -im);
+ SET_ATTR_re(INTERP, d, FLOAT_IS_ZERO(im) ? 0.0 : -im);
SET_ATTR_im(INTERP, d, re);
RETURN(PMC *d);

0 comments on commit ab7d01c

Please sign in to comment.