# HG changeset patch # User Jaroslav Hajek # Date 1221247024 -7200 # Node ID c594892c64c0d0b7271a6f4fc0257dcb2a1b2d1b # Parent 3b2346046d32ad8a819b26236c575a6fc2a1436a fix integer exponentiation with negative exponent diff -r 3b2346046d32 -r c594892c64c0 liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h Thu Sep 11 17:03:26 2008 -0400 +++ b/liboctave/oct-inttypes.h Fri Sep 12 21:17:04 2008 +0200 @@ -481,10 +481,15 @@ octave_int zero = octave_int (0); octave_int one = octave_int (1); - if (b == zero) + if (b == zero || a == one) retval = one; else if (b < zero) - retval = zero; + { + if (std::numeric_limits::is_signed && a.value () == -1) + retval = (b.value () % 2) ? a : one; + else + retval = zero; + } else { octave_int a_val = a;