Message9054
Easy to fix this specific issue, although there are other issues to consider in test_cmath:
diff -r 9fef5da411e5 src/org/python/core/PyComplex.java
--- a/src/org/python/core/PyComplex.java Fri Sep 26 11:43:55 2014 -0600
+++ b/src/org/python/core/PyComplex.java Fri Sep 26 23:41:54 2014 -0600
@@ -113,7 +113,12 @@
}
complexReal.real -= complexImag.imag;
- complexReal.imag += complexImag.real;
+ if (complexReal.imag == 0.0) {
+ // necessary if complexImag is -0.0, given that adding 0.0 + -0.0 is 0.0
+ complexReal.imag = complexImag.real;
+ } else {
+ complexReal.imag += complexImag.real;
+ }
if (new_.for_type != subtype) {
complexReal = new PyComplexDerived(subtype, complexReal.real, complexReal.imag);
}
Similar care has to be done with cmath.acos, etc. I compared CPython with Wolfram Alpha (they are comparable), so it looks like we should follow what CPython has done in those cases. |
|
Date |
User |
Action |
Args |
2014-09-27 05:49:32 | zyasoft | set | messageid: <1411796972.5.0.494243045124.issue1853@psf.upfronthosting.co.za> |
2014-09-27 05:49:32 | zyasoft | set | recipients:
+ zyasoft, fwierzbicki, pjenvey |
2014-09-27 05:49:32 | zyasoft | link | issue1853 messages |
2014-09-27 05:49:31 | zyasoft | create | |
|