Commit 0de27aac by Tobias Schlüter Committed by Tobias Schlüter

gfortran.h (arith): Remove ARITH_0TO0.

* gfortran.h (arith): Remove ARITH_0TO0.
* arith.c (gfc_arith_error): Remove handling of ARITH_0TO0.
(gfc_arith_power): Remove special casing of zero to integral
power zero.

From-SVN: r96737
parent 5be245e4
2005-03-18 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.h (arith): Remove ARITH_0TO0.
* arith.c (gfc_arith_error): Remove handling of ARITH_0TO0.
(gfc_arith_power): Remove special casing of zero to integral
power zero.
2005-03-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2005-03-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Make-lang.in (fortran-warn): Remove -Wno-error. * Make-lang.in (fortran-warn): Remove -Wno-error.
......
...@@ -152,9 +152,6 @@ gfc_arith_error (arith code) ...@@ -152,9 +152,6 @@ gfc_arith_error (arith code)
case ARITH_DIV0: case ARITH_DIV0:
p = "Division by zero"; p = "Division by zero";
break; break;
case ARITH_0TO0:
p = "Indeterminate form 0 ** 0";
break;
case ARITH_INCOMMENSURATE: case ARITH_INCOMMENSURATE:
p = "Array operands are incommensurate"; p = "Array operands are incommensurate";
break; break;
...@@ -918,33 +915,23 @@ gfc_arith_power (gfc_expr * op1, gfc_expr * op2, gfc_expr ** resultp) ...@@ -918,33 +915,23 @@ gfc_arith_power (gfc_expr * op1, gfc_expr * op2, gfc_expr ** resultp)
result = gfc_constant_result (op1->ts.type, op1->ts.kind, &op1->where); result = gfc_constant_result (op1->ts.type, op1->ts.kind, &op1->where);
if (power == 0) if (power == 0)
{ /* Handle something to the zeroth power */ {
/* Handle something to the zeroth power. Since we're dealing
with integral exponents, there is no ambiguity in the
limiting procedure used to determine the value of 0**0. */
switch (op1->ts.type) switch (op1->ts.type)
{ {
case BT_INTEGER: case BT_INTEGER:
if (mpz_sgn (op1->value.integer) == 0) mpz_set_ui (result->value.integer, 1);
rc = ARITH_0TO0;
else
mpz_set_ui (result->value.integer, 1);
break; break;
case BT_REAL: case BT_REAL:
if (mpfr_sgn (op1->value.real) == 0) mpfr_set_ui (result->value.real, 1, GFC_RND_MODE);
rc = ARITH_0TO0;
else
mpfr_set_ui (result->value.real, 1, GFC_RND_MODE);
break; break;
case BT_COMPLEX: case BT_COMPLEX:
if (mpfr_sgn (op1->value.complex.r) == 0 mpfr_set_ui (result->value.complex.r, 1, GFC_RND_MODE);
&& mpfr_sgn (op1->value.complex.i) == 0) mpfr_set_ui (result->value.complex.i, 0, GFC_RND_MODE);
rc = ARITH_0TO0;
else
{
mpfr_set_ui (result->value.complex.r, 1, GFC_RND_MODE);
mpfr_set_ui (result->value.complex.i, 0, GFC_RND_MODE);
}
break; break;
default: default:
......
...@@ -181,7 +181,7 @@ extern mstring intrinsic_operators[]; ...@@ -181,7 +181,7 @@ extern mstring intrinsic_operators[];
/* Arithmetic results. */ /* Arithmetic results. */
typedef enum typedef enum
{ ARITH_OK = 1, ARITH_OVERFLOW, ARITH_UNDERFLOW, ARITH_NAN, { ARITH_OK = 1, ARITH_OVERFLOW, ARITH_UNDERFLOW, ARITH_NAN,
ARITH_DIV0, ARITH_0TO0, ARITH_INCOMMENSURATE, ARITH_ASYMMETRIC ARITH_DIV0, ARITH_INCOMMENSURATE, ARITH_ASYMMETRIC
} }
arith; arith;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment