public static double pow(double value,double power){
  if (USE_JDK_MATH) {
    return STRICT_MATH ? StrictMath.pow(value,power) : Math.pow(value,power);
  }
  if (power == 0.0) {
    return 1.0;
  }
 else   if (power == 1.0) {
    return value;
  }
  if (value <= 0.0) {
    int powerInfo;
    if (Math.abs(power) >= (TWO_POW_52 * 2)) {
      powerInfo=1;
    }
 else {
      if (Math.abs(power) <= (double)Integer.MAX_VALUE) {
        int powerAsInt=(int)power;
        if (power == (double)powerAsInt) {
          powerInfo=((powerAsInt & 1) == 0) ? 1 : -1;
        }
 else {
          powerInfo=0;
        }
      }
 else {
        long powerAsLong=(long)power;
        if (power == (double)powerAsLong) {
          powerInfo=((powerAsLong & 1) == 0) ? 1 : -1;
        }
 else {
          if (power != power) {
            return Double.NaN;
          }
          powerInfo=0;
        }
      }
    }
    if (value == 0.0) {
      if (power < 0.0) {
        return (powerInfo < 0) ? 1 / value : Double.POSITIVE_INFINITY;
      }
 else {
        return (powerInfo < 0) ? value : 0.0;
      }
    }
 else {
      if (value == Double.NEGATIVE_INFINITY) {
        if (powerInfo < 0) {
          return (power < 0.0) ? -0.0 : Double.NEGATIVE_INFINITY;
        }
 else {
          return (power < 0.0) ? 0.0 : Double.POSITIVE_INFINITY;
        }
      }
 else {
        return (powerInfo != 0) ? powerInfo * FastMath.exp(power * FastMath.log(-value)) : Double.NaN;
      }
    }
  }
 else {
    return FastMath.exp(power * FastMath.log(value));
  }
}

public static double pow ( double value , double power ) { if ( USE_JDK_MATH ) { return STRICT_MATH ? StrictMath . pow ( value , power ) : Math . pow ( value , power ) ; } if ( power == 0.0 ) { return 1.0 ; } else if ( power == 1.0 ) { return value ; } if ( value <= 0.0 ) { int powerInfo ; if ( Math . abs ( power ) >= ( TWO_POW_52 * 2 ) ) { powerInfo = 1 ; } else { if ( Math . abs ( power ) <= ( double ) Integer . MAX_VALUE ) { int powerAsInt = ( int ) power ; if ( power == ( double ) powerAsInt ) { powerInfo = ( ( powerAsInt & 1 ) == 0 ) ? 1 : - 1 ; } else { powerInfo = 0 ; } } else { long powerAsLong = ( long ) power ; if ( power == ( double ) powerAsLong ) { powerInfo = ( ( powerAsLong & 1 ) == 0 ) ? 1 : - 1 ; } else { if ( power != power ) { return Double . NaN ; } powerInfo = 0 ; } } } if ( value == 0.0 ) { if ( power < 0.0 ) { return ( powerInfo < 0 ) ? 1 / value : Double . POSITIVE_INFINITY ; } else { return ( powerInfo < 0 ) ? value : 0.0 ; } } else { if ( value == Double . NEGATIVE_INFINITY ) { if ( powerInfo < 0 ) { return ( power < 0.0 ) ? - 0.0 : Double . NEGATIVE_INFINITY ; } else { return ( power < 0.0 ) ? 0.0 : Double . POSITIVE_INFINITY ; } } else { return ( powerInfo != 0 ) ? powerInfo * FastMath . exp ( power * FastMath . log ( - value ) ) : Double . NaN ; } } } else { return FastMath . exp ( power * FastMath . log ( value ) ) ; } }
1e - 13ish accuracy ( or better ) on whole double range .
