Sophie

Sophie

distrib > Mageia > cauldron > i586 > by-pkgid > 69f33684a4340840be13312052d715a8 > files > 1

ecl-16.1.3-1.mga7.src.rpm

--- src/c/numbers/atan.d.orig	2016-12-19 03:25:00.000000000 -0700
+++ src/c/numbers/atan.d	2017-02-23 11:03:32.602020581 -0700
@@ -22,27 +22,29 @@
 static double
 ecl_atan2_double(double y, double x)
 {
-  if (signbit(x)) {
-    if (signbit(y)) {
-      return -ECL_PI_D + atan(-y / -x);
-    } else if (y == 0) {
-      return ECL_PI_D;
-    } else {
-      return ECL_PI_D - atan(y / -x);
-    }
-  } else if (x == 0) {
-    if (signbit(y)) {
+  if (x == 0) {
+    if (y == 0) {
+      /* Signals floating-point-invalid operation.  If not trapped,
+         produces NaN. */
+      return x / y;
+    } else if (signbit(y)) {
       return -ECL_PI2_D;
-    } else if (y == 0) {
-      return x / y;  /* Produces a NaN */
     } else {
       return ECL_PI2_D;
     }
+  } else if (signbit(x)) {
+    if (y == 0) {
+      return ECL_PI_D;
+    } else if (signbit(y)) {
+      return -ECL_PI_D + atan(-y / -x);
+    } else {
+      return ECL_PI_D - atan(y / -x);
+    }
   } else {
-    if (signbit(y)) {
-      return -atan(-y / x);
-    } else if (y == 0) {
+    if (y == 0) {
       return (double)0;
+    } else if (signbit(y)) {
+      return -atan(-y / x);
     } else {
       return atan(y / x);
     }
@@ -53,27 +55,29 @@ ecl_atan2_double(double y, double x)
 static long double
 ecl_atan2_long_double(long double y, long double x)
 {
-  if (signbit(x)) {
-    if (signbit(y)) {
-      return -ECL_PI_L + atanl(-y / -x);
-    } else if (y == 0) {
-      return ECL_PI_L;
-    } else {
-      return ECL_PI_L - atanl(y / -x);
-    }
-  } else if (x == 0) {
-    if (signbit(y)) {
+  if (x == 0) {
+    if (y == 0) {
+      /* Signals floating-point-invalid-operation.  If not trapped,
+         produces NaN. */
+      return x / y;
+    } else if (signbit(y)) {
       return -ECL_PI2_L;
-    } else if (y == 0) {
-      return x / y;  /* Produces a NaN */
     } else {
       return ECL_PI2_L;
     }
+  } else if (signbit(x)) {
+    if (y == 0) {
+      return ECL_PI_L;
+    } else if (signbit(y)) {
+      return -ECL_PI_L + atanl(-y / -x);
+    } else {
+      return ECL_PI_L - atanl(y / -x);
+    }
   } else {
-    if (signbit(y)) {
-      return -atanl(-y / x);
-    } else if (y == 0) {
+    if (y == 0) {
       return (long double)0;
+    } else if (signbit(y)) {
+      return -atanl(-y / x);
     } else {
       return atanl(y / x);
     }
--- src/tests/normal-tests/mixed.lsp.orig	2016-12-19 03:25:00.000000000 -0700
+++ src/tests/normal-tests/mixed.lsp	2017-02-23 10:56:00.028415503 -0700
@@ -178,7 +178,7 @@
 ;;;; Created:  2016-09-07
 ;;;; Contains: External process interaction API
 ;;;;
-(test external-process.0001.run-program
+(test mix.0011.run-program
   (let ((p (nth-value 2 (ext:run-program #-windows "sleep"
                                          #+windows "timeout"
                                          (list "3") :wait nil))))
@@ -195,3 +195,22 @@
     (finishes (ext:terminate-process p))))
 
 
+;;; Date: 2016-12-20
+;;; Reported by: Kris Katterjohn
+;;; Fixed: Daniel KochmaƄski
+;;; Description:
+;;;
+;;;   atan signalled `division-by-zero' exception when the second
+;;;   argument was signed zero. Also inconsistent behavior on invalid
+;;;   operation (atan 0.0 0.0).
+;;;
+;;; Bug: https://gitlab.com/embeddable-common-lisp/ecl/issues/329
+(test mix.0012.atan-signed-zero
+  (finishes (atan 1.0 -0.0))
+  (signals floating-point-invalid-operation (atan -0.0 -0.0))
+  (signals floating-point-invalid-operation (atan +0.0 -0.0))
+  (signals floating-point-invalid-operation (atan -0.0 +0.0))
+  (signals floating-point-invalid-operation (atan +0.0 +0.0)))
+
+
+