代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gawk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
commit a3799ae3f5dd6648040d499224cc6dea61b355dd
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Mon Sep 19 18:51:28 2022 +0300
Fix negative NaN issue on RiscV.
diff --git a/ChangeLog b/ChangeLog
index 35941d0a..d751baf1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,0 +1,6 @@
+2022-09-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (fix_nan_sign): New function. See bug list citation
+ in the code.
+ * interpret.h (r_interpret): Use it for plus and minus cases.
+
diff --git a/eval.c b/eval.c
index 1069570b..3bfff0ca 100644
--- a/eval.c
+++ b/eval.c
@@ -39,6 +39,8 @@ static int num_exec_hook = 0;
static Func_pre_exec pre_execute[MAX_EXEC_HOOKS];
static Func_post_exec post_execute = NULL;
+static double fix_nan_sign(double left, double right, double result);
+
extern void frame_popped();
int OFSlen;
@@ -1901,3 +1903,20 @@ elem_new_to_scalar(NODE *n)
return n;
}
+
+/* fix_nan_sign --- fix NaN sign on RiscV */
+
+// See the thread starting at
+// https://lists.gnu.org/archive/html/bug-gawk/2022-09/msg00005.html
+// for why we need this function.
+
+static double
+fix_nan_sign(double left, double right, double result)
+{
+ if (isnan(left) && signbit(left))
+ return copysign(result, -1.0);
+ else if (isnan(right) && signbit(right))
+ return copysign(result, -1.0);
+ else
+ return result;
+}
diff --git a/interpret.h b/interpret.h
index 26010ada..955d918f 100644
--- a/interpret.h
+++ b/interpret.h
@@ -583,6 +583,7 @@ uninitialized_scalar:
plus:
t1 = TOP_NUMBER();
r = make_number(t1->numbr + x2);
+ r->numbr = fix_nan_sign(t1->numbr, x2, r->numbr);
DEREF(t1);
REPLACE(r);
break;
@@ -597,6 +598,7 @@ plus:
minus:
t1 = TOP_NUMBER();
r = make_number(t1->numbr - x2);
+ r->numbr = fix_nan_sign(t1->numbr, x2, r->numbr);
DEREF(t1);
REPLACE(r);
break;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。