public DD pow(int exp){
  if (exp == 0.0)   return valueOf(1.0);
  DD r=new DD(this);
  DD s=valueOf(1.0);
  int n=Math.abs(exp);
  if (n > 1) {
    while (n > 0) {
      if (n % 2 == 1) {
        s.selfMultiply(r);
      }
      n/=2;
      if (n > 0)       r=r.sqr();
    }
  }
 else {
    s=r;
  }
  if (exp < 0)   return s.reciprocal();
  return s;
}

public DD pow ( int exp ) { if ( exp == 0.0 ) return valueOf ( 1.0 ) ; DD r = new DD ( this ) ; DD s = valueOf ( 1.0 ) ; int n = Math . abs ( exp ) ; if ( n > 1 ) { while ( n > 0 ) { if ( n % 2 == 1 ) { s . selfMultiply ( r ) ; } n /= 2 ; if ( n > 0 ) r = r . sqr ( ) ; } } else { s = r ; } if ( exp < 0 ) return s . reciprocal ( ) ; return s ; }
computes the value of this number raised to an integral power . follows semantics of java math . pow as closely as possible .
