/** * Returns this number raised to the specified power. * * @param e the exponent. * @return <code>this**e</code>. */ public Float64 pow(double e) { Float64 r = FACTORY.object(); r._value = MathLib.pow(this._value, e); return r; }
/** * Returns this number raised to the power of the specified exponent. * * @param that the exponent. * @return <code>this**that</code>. */ public Float64 pow(Float64 that) { Float64 r = FACTORY.object(); r._value = MathLib.pow(this._value, that._value); return r; }
/** * Returns the value of the first argument raised to the power of the * second argument. * * @param x the base. * @param y the exponent. * @return <code>x<sup>y</sup></code> **/ public static double pow(double x, double y) { // Use close approximation (+/- LSB) if ((x < 0) && (y == (int) y)) return (((int) y) & 1) == 0 ? pow(-x, y) : -pow(-x, y); return MathLib.exp(y * MathLib.log(x)); }
/** * Returns the value of the first argument raised to the power of the * second argument. * * @param x the base. * @param y the exponent. * @return <code>x<sup>y</sup></code> **/ public static double pow(double x, double y) { // Use close approximation (+/- LSB) if ((x < 0) && (y == (int) y)) return (((int) y) & 1) == 0 ? pow(-x, y) : -pow(-x, y); return MathLib.exp(y * MathLib.log(x)); }
/** * Returns the value of the first argument raised to the power of the * second argument. * * @param x the base. * @param y the exponent. * @return <code>x<sup>y</sup></code> **/ public static double pow(double x, double y) { // Use close approximation (+/- LSB) if ((x < 0) && (y == (int) y)) return (((int) y) & 1) == 0 ? pow(-x, y) : -pow(-x, y); return MathLib.exp(y * MathLib.log(x)); }
/** * Returns the root mean square value of the given inputs over the given * range. * * @param lowerFreqHz * >= 1 * @param upperFreqHz * < {@link #getUpperMeasurableFrequency()} * @param fftd * powers * * @return the rms value */ public double rms(int lowerFreqHz, int upperFreqHz, double... fftd) { assert fftd != null && fftd.length > 0; assert lowerFreqHz >= 1 && lowerFreqHz < upperFreqHz && upperFreqHz < getUpperMeasurableFrequency(); int divisor = fftd.length; double sum = 0; for (int i = lowerFreqHz; i <= upperFreqHz; i++) { sum += MathLib.pow(fftd[i], 2); } return MathLib.sqrt(new BigDecimal(sum).divide(new BigDecimal(divisor), 10, RoundingMode.HALF_UP).doubleValue()); }
Amount<Q> m = Amount.newInstance(_unit.root(n)); if (this._isExact) { double rootDouble = MathLib.pow(_exactValue, 1.0 / n); long rootLong = (long) rootDouble; long thisLong = rootLong; return m.setExact(rootLong); double min = MathLib.pow(_minimum, 1.0 / n); double max = MathLib.pow(_maximum, 1.0 / n); m._isExact = false; m._minimum = (min < 0) ? min * INCREMENT : min * DECREMENT;
/** * Returns this complex raised to the specified power. * * @param e the exponent. * @return <code>this**e</code>. */ public Complex pow(double e) { Complex c = FACTORY.object(); double m = MathLib.pow(this.magnitude(), e); double a = this.argument() * e; c._real = m * MathLib.cos(a); c._imaginary = m * MathLib.sin(a); return c; }