Test failure here: ---CUT--- ERROR] Failures: [ERROR] CStandardTest.testCosh:692->assertComplex:275 Operation failed (z=(-Infinity,0.5)). Expected: (-Infinity,-Infinity) but was: (Infinity,-Infinity) ---CUT---
Gilles 2019-12-05 1:45 UTC+01:00, aherb...@apache.org <aherb...@apache.org>: > This is an automated email from the ASF dual-hosted git repository. > > aherbert pushed a commit to branch master > in repository https://gitbox.apache.org/repos/asf/commons-numbers.git > > commit 8963bd191ca80af6b1ba3f94998d5be0d64e43ac > Author: Alex Herbert <aherb...@apache.org> > AuthorDate: Thu Dec 5 00:44:27 2019 +0000 > > Preserve even function in cosh > --- > .../java/org/apache/commons/numbers/complex/Complex.java | 14 > +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git > a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java > b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java > index 490380b..e5b9ca8 100644 > --- > a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java > +++ > b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java > @@ -1241,6 +1241,12 @@ public final class Complex implements Serializable > { > return constructor.create(Math.cosh(real) * > Math.cos(imaginary), > Math.sinh(real) * > Math.sin(imaginary)); > } > + // ISO C99: Preserve the even function > + // f(z) = f(-z) > + if (negative(real)) { > + real = -real; > + imaginary = -imaginary; > + } > // Special case for real == 0 > final double im = real == 0 ? Math.copySign(0, imaginary) : > Double.NaN; > return constructor.create(Double.NaN, im); > @@ -1253,6 +1259,12 @@ public final class Complex implements Serializable > { > return constructor.create(Double.POSITIVE_INFINITY, > im); > } > // inf * cis(y) > + // ISO C99: Preserve the even function > + // f(z) = f(-z) > + if (real < 0) { > + real = -real; > + imaginary = -imaginary; > + } > final double re = real * Math.cos(imaginary); > final double im = real * Math.sin(imaginary); > return constructor.create(re, im); > @@ -1262,7 +1274,7 @@ public final class Complex implements Serializable { > } > // real is NaN > if (imaginary == 0) { > - return constructor.create(Double.NaN, Math.copySign(0, > imaginary)); > + return constructor.create(Double.NaN, imaginary); > } > // optionally raises the ‘‘invalid’’ floating-point exception, for > nonzero y. > return NAN; > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org