@@ -1480,7 +1480,7 @@ public T Ln(T thisValue, EContext ctx) {
14801480 EInteger cprec = EInteger .Max (bounds [1 ].ToEInteger (), ctx .getPrecision ())
14811481 .Add (bigError );
14821482 // System.out.println("cprec prec " + (// ctx.getPrecision()) + " bounds " +
1483- // (bounds[1].ToEInteger()));
1483+ //(bounds[1].ToEInteger()));
14841484 ctxdiv = SetPrecisionIfLimited (ctx , cprec )
14851485 .WithRounding (intermedRounding ).WithBlankFlags ();
14861486 T oldThisValue = thisValue ;
@@ -2278,7 +2278,16 @@ public T Power(T thisValue, T pow, EContext ctx) {
22782278 return this .SignalInvalid (ctx );
22792279 }
22802280 signedMant = this .helper .GetMantissa (powInt ).Abs ();
2281- return this .PowerIntegral (thisValue , signedMant , ctx );
2281+ // Use this line rather than commented line because in this case, where
2282+ // thisValue is 1 and power is a negative integer, the reciprocal of 1
2283+ // is used, which will have an exponent of 0, according to the
2284+ // General Decimal Arithmetic Specification
2285+ if (powSign < 0 ) {
2286+ return this .PowerIntegral (this .helper .ValueOf (1 ), signedMant ,
2287+ ctx );
2288+ } else {
2289+ return this .PowerIntegral (thisValue , signedMant , ctx );
2290+ }
22822291 }
22832292 }
22842293 // Very high values of pow and a very high exponent
0 commit comments