diff --git a/CHANGES b/CHANGES index e07e5b8..cac25b9 100644 --- a/CHANGES +++ b/CHANGES @@ -63,6 +63,11 @@ The following are the changes from calc version 2.12.7.1 to date: and is non-empty, then calc history file will be defined by the $CALCHISTFILE environment variable. + Calc as defined 0^0 as 1. However in the past, 0 raised to + an expression that evaluted to zero returned 1. The result + was that 0^0 was different than 0^(6-6) or even 0^(0). + Now, calc will return 1 for 0^(0) and 0^zero when zero == 0. + The following are the changes from calc version 2.12.6.10: to 2.12.7.0: diff --git a/cal/test8900.cal b/cal/test8900.cal index cd4162c..5afc7a0 100644 --- a/cal/test8900.cal +++ b/cal/test8900.cal @@ -2057,7 +2057,12 @@ define t010() epsilon(eps); return 5; } - if ((stirling2(10, 5) - (42525)) != 0) { + /* + * Once, when an expression such as 0^(6-6) returned 0, + * then stirling2(10, 5) == 42525. However when we made9 + * 0^(6-6) == 0^0 == 1, then stirling2(10, 5) == 5102999/120. + */ + if ((stirling2(10, 5) - (5102999/120)) != 0) { epsilon(eps); return 6; } diff --git a/value.c b/value.c index 40c2f6a..c8a8ffe 100644 --- a/value.c +++ b/value.c @@ -1879,9 +1879,9 @@ powvalue(VALUE *v1, VALUE *v2, VALUE *vres) *vres = error_value(E_1OVER0); break; } - /* 0 ^ non-neg is zero, including 0^0 */ + /* 0 ^ non-neg is 1, including 0^0 */ vres->v_type = V_NUM; - vres->v_num = qlink(&_qzero_); + vres->v_num = qlink(&_qone_); } else if (qisint(real_v2)) { vres->v_num = qpowi(v1->v_num, real_v2); } else {