From db3a43c8edeb36ecc9e7cde10b1c06be3f2147fc Mon Sep 17 00:00:00 2001 From: Angelika Schwarz <17718454+angsch@users.noreply.github.com> Date: Wed, 20 Sep 2023 19:42:13 +0200 Subject: [PATCH] Simplify rotg * The check da != ZERO is no longer necessary since there is a special case ada == ZERO, where ada = |da|. * Add the missing check c != ZERO before the division. Note that with these two changes the long double code follows the float/double version of the code. --- interface/rotg.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/interface/rotg.c b/interface/rotg.c index 8d40d9c53..423ebda21 100644 --- a/interface/rotg.c +++ b/interface/rotg.c @@ -66,13 +66,8 @@ void CNAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){ c = da / r; s = db / r; z = ONE; - if (da != ZERO) { - if (ada > adb){ - z = s; - } else { - z = ONE / c; - } - } + if (ada > adb) z = s; + if ((ada <= adb) && (c != ZERO)) z = ONE / c; *C = c; *S = s;