question: public static double powFast ( double value , int power ) { if ( USE_JDK_MATH ) { return STRICT_MATH ? StrictMath . pow ( value , power ) : Math . pow ( value , power ) ; } if ( power > 5 ) { double oddRemains = 1.0 ; do { if ( ( power & 1 ) != 0 ) { oddRemains *= value ; } value *= value ; power >>= 1 ; } while ( power > 5 ) ; if ( power == 3 ) { return oddRemains * value * value * value ; } else { double v2 = value * value ; if ( power == 4 ) { return oddRemains * v2 * v2 ; } else { return oddRemains * v2 * v2 * value ; } } } else if ( power >= 0 ) { if ( power < 3 ) { if ( power == 2 ) { return value * value ; } else if ( power != 0 ) { return value ; } else { return 1.0 ; } } else { if ( power == 3 ) { return value * value * value ; } else { double v2 = value * value ; if ( power == 4 ) { return v2 * v2 ; } else { return v2 * v2 * value ; } } } } else { if ( power == Integer . MIN_VALUE ) { return 1.0 / ( FastMath . powFast ( value , Integer . MAX_VALUE ) * value ) ; } else { return 1.0 / FastMath . powFast ( value , - power ) ; } } }
target:  This treatment is somehow accurate for low values of |power|, and for |power*getExponent(value)| &lt; 1023 or so (to stay away from double extreme magnitudes (large and small)).