emul/mini/src/main/java/java/lang/Math.java
branchmodel
changeset 878 ecbd252fd3a7
parent 877 3392f250c784
parent 871 6168fb585ab4
child 879 af170d42b5b3
     1.1 --- a/emul/mini/src/main/java/java/lang/Math.java	Fri Mar 22 16:59:47 2013 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,1310 +0,0 @@
     1.4 -/*
     1.5 - * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 - *
     1.8 - * This code is free software; you can redistribute it and/or modify it
     1.9 - * under the terms of the GNU General Public License version 2 only, as
    1.10 - * published by the Free Software Foundation.  Oracle designates this
    1.11 - * particular file as subject to the "Classpath" exception as provided
    1.12 - * by Oracle in the LICENSE file that accompanied this code.
    1.13 - *
    1.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 - * version 2 for more details (a copy is included in the LICENSE file that
    1.18 - * accompanied this code).
    1.19 - *
    1.20 - * You should have received a copy of the GNU General Public License version
    1.21 - * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 - *
    1.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 - * or visit www.oracle.com if you need additional information or have any
    1.26 - * questions.
    1.27 - */
    1.28 -
    1.29 -package java.lang;
    1.30 -
    1.31 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
    1.32 -
    1.33 -
    1.34 -/**
    1.35 - * The class {@code Math} contains methods for performing basic
    1.36 - * numeric operations such as the elementary exponential, logarithm,
    1.37 - * square root, and trigonometric functions.
    1.38 - *
    1.39 - * <p>Unlike some of the numeric methods of class
    1.40 - * {@code StrictMath}, all implementations of the equivalent
    1.41 - * functions of class {@code Math} are not defined to return the
    1.42 - * bit-for-bit same results.  This relaxation permits
    1.43 - * better-performing implementations where strict reproducibility is
    1.44 - * not required.
    1.45 - *
    1.46 - * <p>By default many of the {@code Math} methods simply call
    1.47 - * the equivalent method in {@code StrictMath} for their
    1.48 - * implementation.  Code generators are encouraged to use
    1.49 - * platform-specific native libraries or microprocessor instructions,
    1.50 - * where available, to provide higher-performance implementations of
    1.51 - * {@code Math} methods.  Such higher-performance
    1.52 - * implementations still must conform to the specification for
    1.53 - * {@code Math}.
    1.54 - *
    1.55 - * <p>The quality of implementation specifications concern two
    1.56 - * properties, accuracy of the returned result and monotonicity of the
    1.57 - * method.  Accuracy of the floating-point {@code Math} methods
    1.58 - * is measured in terms of <i>ulps</i>, units in the last place.  For
    1.59 - * a given floating-point format, an ulp of a specific real number
    1.60 - * value is the distance between the two floating-point values
    1.61 - * bracketing that numerical value.  When discussing the accuracy of a
    1.62 - * method as a whole rather than at a specific argument, the number of
    1.63 - * ulps cited is for the worst-case error at any argument.  If a
    1.64 - * method always has an error less than 0.5 ulps, the method always
    1.65 - * returns the floating-point number nearest the exact result; such a
    1.66 - * method is <i>correctly rounded</i>.  A correctly rounded method is
    1.67 - * generally the best a floating-point approximation can be; however,
    1.68 - * it is impractical for many floating-point methods to be correctly
    1.69 - * rounded.  Instead, for the {@code Math} class, a larger error
    1.70 - * bound of 1 or 2 ulps is allowed for certain methods.  Informally,
    1.71 - * with a 1 ulp error bound, when the exact result is a representable
    1.72 - * number, the exact result should be returned as the computed result;
    1.73 - * otherwise, either of the two floating-point values which bracket
    1.74 - * the exact result may be returned.  For exact results large in
    1.75 - * magnitude, one of the endpoints of the bracket may be infinite.
    1.76 - * Besides accuracy at individual arguments, maintaining proper
    1.77 - * relations between the method at different arguments is also
    1.78 - * important.  Therefore, most methods with more than 0.5 ulp errors
    1.79 - * are required to be <i>semi-monotonic</i>: whenever the mathematical
    1.80 - * function is non-decreasing, so is the floating-point approximation,
    1.81 - * likewise, whenever the mathematical function is non-increasing, so
    1.82 - * is the floating-point approximation.  Not all approximations that
    1.83 - * have 1 ulp accuracy will automatically meet the monotonicity
    1.84 - * requirements.
    1.85 - *
    1.86 - * @author  unascribed
    1.87 - * @author  Joseph D. Darcy
    1.88 - * @since   JDK1.0
    1.89 - */
    1.90 -
    1.91 -public final class Math {
    1.92 -
    1.93 -    /**
    1.94 -     * Don't let anyone instantiate this class.
    1.95 -     */
    1.96 -    private Math() {}
    1.97 -
    1.98 -    /**
    1.99 -     * The {@code double} value that is closer than any other to
   1.100 -     * <i>e</i>, the base of the natural logarithms.
   1.101 -     */
   1.102 -    public static final double E = 2.7182818284590452354;
   1.103 -
   1.104 -    /**
   1.105 -     * The {@code double} value that is closer than any other to
   1.106 -     * <i>pi</i>, the ratio of the circumference of a circle to its
   1.107 -     * diameter.
   1.108 -     */
   1.109 -    public static final double PI = 3.14159265358979323846;
   1.110 -
   1.111 -    /**
   1.112 -     * Returns the trigonometric sine of an angle.  Special cases:
   1.113 -     * <ul><li>If the argument is NaN or an infinity, then the
   1.114 -     * result is NaN.
   1.115 -     * <li>If the argument is zero, then the result is a zero with the
   1.116 -     * same sign as the argument.</ul>
   1.117 -     *
   1.118 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.119 -     * Results must be semi-monotonic.
   1.120 -     *
   1.121 -     * @param   a   an angle, in radians.
   1.122 -     * @return  the sine of the argument.
   1.123 -     */
   1.124 -    @JavaScriptBody(args="a", body="return Math.sin(a);")
   1.125 -    public static double sin(double a) {
   1.126 -        throw new UnsupportedOperationException();
   1.127 -    }
   1.128 -
   1.129 -    /**
   1.130 -     * Returns the trigonometric cosine of an angle. Special cases:
   1.131 -     * <ul><li>If the argument is NaN or an infinity, then the
   1.132 -     * result is NaN.</ul>
   1.133 -     *
   1.134 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.135 -     * Results must be semi-monotonic.
   1.136 -     *
   1.137 -     * @param   a   an angle, in radians.
   1.138 -     * @return  the cosine of the argument.
   1.139 -     */
   1.140 -    @JavaScriptBody(args="a", body="return Math.cos(a);")
   1.141 -    public static double cos(double a) {
   1.142 -        throw new UnsupportedOperationException();
   1.143 -    }
   1.144 -
   1.145 -    /**
   1.146 -     * Returns the trigonometric tangent of an angle.  Special cases:
   1.147 -     * <ul><li>If the argument is NaN or an infinity, then the result
   1.148 -     * is NaN.
   1.149 -     * <li>If the argument is zero, then the result is a zero with the
   1.150 -     * same sign as the argument.</ul>
   1.151 -     *
   1.152 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.153 -     * Results must be semi-monotonic.
   1.154 -     *
   1.155 -     * @param   a   an angle, in radians.
   1.156 -     * @return  the tangent of the argument.
   1.157 -     */
   1.158 -    @JavaScriptBody(args="a", body="return Math.tan(a);")
   1.159 -    public static double tan(double a) {
   1.160 -        throw new UnsupportedOperationException();
   1.161 -    }
   1.162 -
   1.163 -    /**
   1.164 -     * Returns the arc sine of a value; the returned angle is in the
   1.165 -     * range -<i>pi</i>/2 through <i>pi</i>/2.  Special cases:
   1.166 -     * <ul><li>If the argument is NaN or its absolute value is greater
   1.167 -     * than 1, then the result is NaN.
   1.168 -     * <li>If the argument is zero, then the result is a zero with the
   1.169 -     * same sign as the argument.</ul>
   1.170 -     *
   1.171 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.172 -     * Results must be semi-monotonic.
   1.173 -     *
   1.174 -     * @param   a   the value whose arc sine is to be returned.
   1.175 -     * @return  the arc sine of the argument.
   1.176 -     */
   1.177 -    @JavaScriptBody(args="a", body="return Math.asin(a);")
   1.178 -    public static double asin(double a) {
   1.179 -        throw new UnsupportedOperationException();
   1.180 -    }
   1.181 -
   1.182 -    /**
   1.183 -     * Returns the arc cosine of a value; the returned angle is in the
   1.184 -     * range 0.0 through <i>pi</i>.  Special case:
   1.185 -     * <ul><li>If the argument is NaN or its absolute value is greater
   1.186 -     * than 1, then the result is NaN.</ul>
   1.187 -     *
   1.188 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.189 -     * Results must be semi-monotonic.
   1.190 -     *
   1.191 -     * @param   a   the value whose arc cosine is to be returned.
   1.192 -     * @return  the arc cosine of the argument.
   1.193 -     */
   1.194 -    @JavaScriptBody(args="a", body="return Math.acos(a);")
   1.195 -    public static double acos(double a) {
   1.196 -        throw new UnsupportedOperationException();
   1.197 -    }
   1.198 -
   1.199 -    /**
   1.200 -     * Returns the arc tangent of a value; the returned angle is in the
   1.201 -     * range -<i>pi</i>/2 through <i>pi</i>/2.  Special cases:
   1.202 -     * <ul><li>If the argument is NaN, then the result is NaN.
   1.203 -     * <li>If the argument is zero, then the result is a zero with the
   1.204 -     * same sign as the argument.</ul>
   1.205 -     *
   1.206 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.207 -     * Results must be semi-monotonic.
   1.208 -     *
   1.209 -     * @param   a   the value whose arc tangent is to be returned.
   1.210 -     * @return  the arc tangent of the argument.
   1.211 -     */
   1.212 -    @JavaScriptBody(args="a", body="return Math.atan(a);")
   1.213 -    public static double atan(double a) {
   1.214 -        throw new UnsupportedOperationException();
   1.215 -    }
   1.216 -
   1.217 -    /**
   1.218 -     * Converts an angle measured in degrees to an approximately
   1.219 -     * equivalent angle measured in radians.  The conversion from
   1.220 -     * degrees to radians is generally inexact.
   1.221 -     *
   1.222 -     * @param   angdeg   an angle, in degrees
   1.223 -     * @return  the measurement of the angle {@code angdeg}
   1.224 -     *          in radians.
   1.225 -     * @since   1.2
   1.226 -     */
   1.227 -    public static double toRadians(double angdeg) {
   1.228 -        return angdeg / 180.0 * PI;
   1.229 -    }
   1.230 -
   1.231 -    /**
   1.232 -     * Converts an angle measured in radians to an approximately
   1.233 -     * equivalent angle measured in degrees.  The conversion from
   1.234 -     * radians to degrees is generally inexact; users should
   1.235 -     * <i>not</i> expect {@code cos(toRadians(90.0))} to exactly
   1.236 -     * equal {@code 0.0}.
   1.237 -     *
   1.238 -     * @param   angrad   an angle, in radians
   1.239 -     * @return  the measurement of the angle {@code angrad}
   1.240 -     *          in degrees.
   1.241 -     * @since   1.2
   1.242 -     */
   1.243 -    public static double toDegrees(double angrad) {
   1.244 -        return angrad * 180.0 / PI;
   1.245 -    }
   1.246 -
   1.247 -    /**
   1.248 -     * Returns Euler's number <i>e</i> raised to the power of a
   1.249 -     * {@code double} value.  Special cases:
   1.250 -     * <ul><li>If the argument is NaN, the result is NaN.
   1.251 -     * <li>If the argument is positive infinity, then the result is
   1.252 -     * positive infinity.
   1.253 -     * <li>If the argument is negative infinity, then the result is
   1.254 -     * positive zero.</ul>
   1.255 -     *
   1.256 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.257 -     * Results must be semi-monotonic.
   1.258 -     *
   1.259 -     * @param   a   the exponent to raise <i>e</i> to.
   1.260 -     * @return  the value <i>e</i><sup>{@code a}</sup>,
   1.261 -     *          where <i>e</i> is the base of the natural logarithms.
   1.262 -     */
   1.263 -    @JavaScriptBody(args="a", body="return Math.exp(a);")
   1.264 -    public static double exp(double a) {
   1.265 -        throw new UnsupportedOperationException();
   1.266 -    }
   1.267 -
   1.268 -    /**
   1.269 -     * Returns the natural logarithm (base <i>e</i>) of a {@code double}
   1.270 -     * value.  Special cases:
   1.271 -     * <ul><li>If the argument is NaN or less than zero, then the result
   1.272 -     * is NaN.
   1.273 -     * <li>If the argument is positive infinity, then the result is
   1.274 -     * positive infinity.
   1.275 -     * <li>If the argument is positive zero or negative zero, then the
   1.276 -     * result is negative infinity.</ul>
   1.277 -     *
   1.278 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.279 -     * Results must be semi-monotonic.
   1.280 -     *
   1.281 -     * @param   a   a value
   1.282 -     * @return  the value ln&nbsp;{@code a}, the natural logarithm of
   1.283 -     *          {@code a}.
   1.284 -     */
   1.285 -    @JavaScriptBody(args="a", body="return Math.log(a);")
   1.286 -    public static double log(double a) {
   1.287 -        throw new UnsupportedOperationException();
   1.288 -    }
   1.289 -
   1.290 -    /**
   1.291 -     * Returns the base 10 logarithm of a {@code double} value.
   1.292 -     * Special cases:
   1.293 -     *
   1.294 -     * <ul><li>If the argument is NaN or less than zero, then the result
   1.295 -     * is NaN.
   1.296 -     * <li>If the argument is positive infinity, then the result is
   1.297 -     * positive infinity.
   1.298 -     * <li>If the argument is positive zero or negative zero, then the
   1.299 -     * result is negative infinity.
   1.300 -     * <li> If the argument is equal to 10<sup><i>n</i></sup> for
   1.301 -     * integer <i>n</i>, then the result is <i>n</i>.
   1.302 -     * </ul>
   1.303 -     *
   1.304 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.305 -     * Results must be semi-monotonic.
   1.306 -     *
   1.307 -     * @param   a   a value
   1.308 -     * @return  the base 10 logarithm of  {@code a}.
   1.309 -     * @since 1.5
   1.310 -     */
   1.311 -    @JavaScriptBody(args="a", body="return Math.log(a) / Math.LN10;")
   1.312 -    public static double log10(double a) {
   1.313 -        throw new UnsupportedOperationException();
   1.314 -    }
   1.315 -
   1.316 -    /**
   1.317 -     * Returns the correctly rounded positive square root of a
   1.318 -     * {@code double} value.
   1.319 -     * Special cases:
   1.320 -     * <ul><li>If the argument is NaN or less than zero, then the result
   1.321 -     * is NaN.
   1.322 -     * <li>If the argument is positive infinity, then the result is positive
   1.323 -     * infinity.
   1.324 -     * <li>If the argument is positive zero or negative zero, then the
   1.325 -     * result is the same as the argument.</ul>
   1.326 -     * Otherwise, the result is the {@code double} value closest to
   1.327 -     * the true mathematical square root of the argument value.
   1.328 -     *
   1.329 -     * @param   a   a value.
   1.330 -     * @return  the positive square root of {@code a}.
   1.331 -     *          If the argument is NaN or less than zero, the result is NaN.
   1.332 -     */
   1.333 -    @JavaScriptBody(args="a", body="return Math.sqrt(a);")
   1.334 -    public static double sqrt(double a) {
   1.335 -        throw new UnsupportedOperationException();
   1.336 -    }
   1.337 -
   1.338 -    /**
   1.339 -     * Returns the smallest (closest to negative infinity)
   1.340 -     * {@code double} value that is greater than or equal to the
   1.341 -     * argument and is equal to a mathematical integer. Special cases:
   1.342 -     * <ul><li>If the argument value is already equal to a
   1.343 -     * mathematical integer, then the result is the same as the
   1.344 -     * argument.  <li>If the argument is NaN or an infinity or
   1.345 -     * positive zero or negative zero, then the result is the same as
   1.346 -     * the argument.  <li>If the argument value is less than zero but
   1.347 -     * greater than -1.0, then the result is negative zero.</ul> Note
   1.348 -     * that the value of {@code Math.ceil(x)} is exactly the
   1.349 -     * value of {@code -Math.floor(-x)}.
   1.350 -     *
   1.351 -     *
   1.352 -     * @param   a   a value.
   1.353 -     * @return  the smallest (closest to negative infinity)
   1.354 -     *          floating-point value that is greater than or equal to
   1.355 -     *          the argument and is equal to a mathematical integer.
   1.356 -     */
   1.357 -    @JavaScriptBody(args="a", body="return Math.ceil(a);")
   1.358 -    public static double ceil(double a) {
   1.359 -        throw new UnsupportedOperationException();
   1.360 -    }
   1.361 -
   1.362 -    /**
   1.363 -     * Returns the largest (closest to positive infinity)
   1.364 -     * {@code double} value that is less than or equal to the
   1.365 -     * argument and is equal to a mathematical integer. Special cases:
   1.366 -     * <ul><li>If the argument value is already equal to a
   1.367 -     * mathematical integer, then the result is the same as the
   1.368 -     * argument.  <li>If the argument is NaN or an infinity or
   1.369 -     * positive zero or negative zero, then the result is the same as
   1.370 -     * the argument.</ul>
   1.371 -     *
   1.372 -     * @param   a   a value.
   1.373 -     * @return  the largest (closest to positive infinity)
   1.374 -     *          floating-point value that less than or equal to the argument
   1.375 -     *          and is equal to a mathematical integer.
   1.376 -     */
   1.377 -    @JavaScriptBody(args="a", body="return Math.floor(a);")
   1.378 -    public static double floor(double a) {
   1.379 -        throw new UnsupportedOperationException();
   1.380 -    }
   1.381 -    /**
   1.382 -     * Computes the remainder operation on two arguments as prescribed
   1.383 -     * by the IEEE 754 standard.
   1.384 -     * The remainder value is mathematically equal to
   1.385 -     * <code>f1&nbsp;-&nbsp;f2</code>&nbsp;&times;&nbsp;<i>n</i>,
   1.386 -     * where <i>n</i> is the mathematical integer closest to the exact
   1.387 -     * mathematical value of the quotient {@code f1/f2}, and if two
   1.388 -     * mathematical integers are equally close to {@code f1/f2},
   1.389 -     * then <i>n</i> is the integer that is even. If the remainder is
   1.390 -     * zero, its sign is the same as the sign of the first argument.
   1.391 -     * Special cases:
   1.392 -     * <ul><li>If either argument is NaN, or the first argument is infinite,
   1.393 -     * or the second argument is positive zero or negative zero, then the
   1.394 -     * result is NaN.
   1.395 -     * <li>If the first argument is finite and the second argument is
   1.396 -     * infinite, then the result is the same as the first argument.</ul>
   1.397 -     *
   1.398 -     * @param   f1   the dividend.
   1.399 -     * @param   f2   the divisor.
   1.400 -     * @return  the remainder when {@code f1} is divided by
   1.401 -     *          {@code f2}.
   1.402 -     */
   1.403 -    public static double IEEEremainder(double f1, double f2) {
   1.404 -        return f1 - (f2 * Math.round(f1 / f2));
   1.405 -    }
   1.406 -
   1.407 -    /**
   1.408 -     * Returns the {@code double} value that is closest in value
   1.409 -     * to the argument and is equal to a mathematical integer. If two
   1.410 -     * {@code double} values that are mathematical integers are
   1.411 -     * equally close, the result is the integer value that is
   1.412 -     * even. Special cases:
   1.413 -     * <ul><li>If the argument value is already equal to a mathematical
   1.414 -     * integer, then the result is the same as the argument.
   1.415 -     * <li>If the argument is NaN or an infinity or positive zero or negative
   1.416 -     * zero, then the result is the same as the argument.</ul>
   1.417 -     *
   1.418 -     * @param   a   a {@code double} value.
   1.419 -     * @return  the closest floating-point value to {@code a} that is
   1.420 -     *          equal to a mathematical integer.
   1.421 -     */
   1.422 -    public static double rint(double a) {
   1.423 -        double ceil = ceil(a);
   1.424 -        double floor = floor(a);
   1.425 -        
   1.426 -        double dc = ceil - a;
   1.427 -        double df = a - floor;
   1.428 -        
   1.429 -        if (dc < df) {
   1.430 -            return ceil;
   1.431 -        } else if (dc > df) {
   1.432 -            return floor;
   1.433 -        }
   1.434 -        
   1.435 -        int tenC = (int) (ceil % 10.0);
   1.436 -        
   1.437 -        if (tenC % 2 == 0) {
   1.438 -            return ceil;
   1.439 -        } else {
   1.440 -            return floor;
   1.441 -        }
   1.442 -    }
   1.443 -
   1.444 -    /**
   1.445 -     * Returns the angle <i>theta</i> from the conversion of rectangular
   1.446 -     * coordinates ({@code x},&nbsp;{@code y}) to polar
   1.447 -     * coordinates (r,&nbsp;<i>theta</i>).
   1.448 -     * This method computes the phase <i>theta</i> by computing an arc tangent
   1.449 -     * of {@code y/x} in the range of -<i>pi</i> to <i>pi</i>. Special
   1.450 -     * cases:
   1.451 -     * <ul><li>If either argument is NaN, then the result is NaN.
   1.452 -     * <li>If the first argument is positive zero and the second argument
   1.453 -     * is positive, or the first argument is positive and finite and the
   1.454 -     * second argument is positive infinity, then the result is positive
   1.455 -     * zero.
   1.456 -     * <li>If the first argument is negative zero and the second argument
   1.457 -     * is positive, or the first argument is negative and finite and the
   1.458 -     * second argument is positive infinity, then the result is negative zero.
   1.459 -     * <li>If the first argument is positive zero and the second argument
   1.460 -     * is negative, or the first argument is positive and finite and the
   1.461 -     * second argument is negative infinity, then the result is the
   1.462 -     * {@code double} value closest to <i>pi</i>.
   1.463 -     * <li>If the first argument is negative zero and the second argument
   1.464 -     * is negative, or the first argument is negative and finite and the
   1.465 -     * second argument is negative infinity, then the result is the
   1.466 -     * {@code double} value closest to -<i>pi</i>.
   1.467 -     * <li>If the first argument is positive and the second argument is
   1.468 -     * positive zero or negative zero, or the first argument is positive
   1.469 -     * infinity and the second argument is finite, then the result is the
   1.470 -     * {@code double} value closest to <i>pi</i>/2.
   1.471 -     * <li>If the first argument is negative and the second argument is
   1.472 -     * positive zero or negative zero, or the first argument is negative
   1.473 -     * infinity and the second argument is finite, then the result is the
   1.474 -     * {@code double} value closest to -<i>pi</i>/2.
   1.475 -     * <li>If both arguments are positive infinity, then the result is the
   1.476 -     * {@code double} value closest to <i>pi</i>/4.
   1.477 -     * <li>If the first argument is positive infinity and the second argument
   1.478 -     * is negative infinity, then the result is the {@code double}
   1.479 -     * value closest to 3*<i>pi</i>/4.
   1.480 -     * <li>If the first argument is negative infinity and the second argument
   1.481 -     * is positive infinity, then the result is the {@code double} value
   1.482 -     * closest to -<i>pi</i>/4.
   1.483 -     * <li>If both arguments are negative infinity, then the result is the
   1.484 -     * {@code double} value closest to -3*<i>pi</i>/4.</ul>
   1.485 -     *
   1.486 -     * <p>The computed result must be within 2 ulps of the exact result.
   1.487 -     * Results must be semi-monotonic.
   1.488 -     *
   1.489 -     * @param   y   the ordinate coordinate
   1.490 -     * @param   x   the abscissa coordinate
   1.491 -     * @return  the <i>theta</i> component of the point
   1.492 -     *          (<i>r</i>,&nbsp;<i>theta</i>)
   1.493 -     *          in polar coordinates that corresponds to the point
   1.494 -     *          (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates.
   1.495 -     */
   1.496 -    @JavaScriptBody(args={"y", "x"}, body="return Math.atan2(y, x);")
   1.497 -    public static double atan2(double y, double x) {
   1.498 -        throw new UnsupportedOperationException();
   1.499 -    }
   1.500 -
   1.501 -    /**
   1.502 -     * Returns the value of the first argument raised to the power of the
   1.503 -     * second argument. Special cases:
   1.504 -     *
   1.505 -     * <ul><li>If the second argument is positive or negative zero, then the
   1.506 -     * result is 1.0.
   1.507 -     * <li>If the second argument is 1.0, then the result is the same as the
   1.508 -     * first argument.
   1.509 -     * <li>If the second argument is NaN, then the result is NaN.
   1.510 -     * <li>If the first argument is NaN and the second argument is nonzero,
   1.511 -     * then the result is NaN.
   1.512 -     *
   1.513 -     * <li>If
   1.514 -     * <ul>
   1.515 -     * <li>the absolute value of the first argument is greater than 1
   1.516 -     * and the second argument is positive infinity, or
   1.517 -     * <li>the absolute value of the first argument is less than 1 and
   1.518 -     * the second argument is negative infinity,
   1.519 -     * </ul>
   1.520 -     * then the result is positive infinity.
   1.521 -     *
   1.522 -     * <li>If
   1.523 -     * <ul>
   1.524 -     * <li>the absolute value of the first argument is greater than 1 and
   1.525 -     * the second argument is negative infinity, or
   1.526 -     * <li>the absolute value of the
   1.527 -     * first argument is less than 1 and the second argument is positive
   1.528 -     * infinity,
   1.529 -     * </ul>
   1.530 -     * then the result is positive zero.
   1.531 -     *
   1.532 -     * <li>If the absolute value of the first argument equals 1 and the
   1.533 -     * second argument is infinite, then the result is NaN.
   1.534 -     *
   1.535 -     * <li>If
   1.536 -     * <ul>
   1.537 -     * <li>the first argument is positive zero and the second argument
   1.538 -     * is greater than zero, or
   1.539 -     * <li>the first argument is positive infinity and the second
   1.540 -     * argument is less than zero,
   1.541 -     * </ul>
   1.542 -     * then the result is positive zero.
   1.543 -     *
   1.544 -     * <li>If
   1.545 -     * <ul>
   1.546 -     * <li>the first argument is positive zero and the second argument
   1.547 -     * is less than zero, or
   1.548 -     * <li>the first argument is positive infinity and the second
   1.549 -     * argument is greater than zero,
   1.550 -     * </ul>
   1.551 -     * then the result is positive infinity.
   1.552 -     *
   1.553 -     * <li>If
   1.554 -     * <ul>
   1.555 -     * <li>the first argument is negative zero and the second argument
   1.556 -     * is greater than zero but not a finite odd integer, or
   1.557 -     * <li>the first argument is negative infinity and the second
   1.558 -     * argument is less than zero but not a finite odd integer,
   1.559 -     * </ul>
   1.560 -     * then the result is positive zero.
   1.561 -     *
   1.562 -     * <li>If
   1.563 -     * <ul>
   1.564 -     * <li>the first argument is negative zero and the second argument
   1.565 -     * is a positive finite odd integer, or
   1.566 -     * <li>the first argument is negative infinity and the second
   1.567 -     * argument is a negative finite odd integer,
   1.568 -     * </ul>
   1.569 -     * then the result is negative zero.
   1.570 -     *
   1.571 -     * <li>If
   1.572 -     * <ul>
   1.573 -     * <li>the first argument is negative zero and the second argument
   1.574 -     * is less than zero but not a finite odd integer, or
   1.575 -     * <li>the first argument is negative infinity and the second
   1.576 -     * argument is greater than zero but not a finite odd integer,
   1.577 -     * </ul>
   1.578 -     * then the result is positive infinity.
   1.579 -     *
   1.580 -     * <li>If
   1.581 -     * <ul>
   1.582 -     * <li>the first argument is negative zero and the second argument
   1.583 -     * is a negative finite odd integer, or
   1.584 -     * <li>the first argument is negative infinity and the second
   1.585 -     * argument is a positive finite odd integer,
   1.586 -     * </ul>
   1.587 -     * then the result is negative infinity.
   1.588 -     *
   1.589 -     * <li>If the first argument is finite and less than zero
   1.590 -     * <ul>
   1.591 -     * <li> if the second argument is a finite even integer, the
   1.592 -     * result is equal to the result of raising the absolute value of
   1.593 -     * the first argument to the power of the second argument
   1.594 -     *
   1.595 -     * <li>if the second argument is a finite odd integer, the result
   1.596 -     * is equal to the negative of the result of raising the absolute
   1.597 -     * value of the first argument to the power of the second
   1.598 -     * argument
   1.599 -     *
   1.600 -     * <li>if the second argument is finite and not an integer, then
   1.601 -     * the result is NaN.
   1.602 -     * </ul>
   1.603 -     *
   1.604 -     * <li>If both arguments are integers, then the result is exactly equal
   1.605 -     * to the mathematical result of raising the first argument to the power
   1.606 -     * of the second argument if that result can in fact be represented
   1.607 -     * exactly as a {@code double} value.</ul>
   1.608 -     *
   1.609 -     * <p>(In the foregoing descriptions, a floating-point value is
   1.610 -     * considered to be an integer if and only if it is finite and a
   1.611 -     * fixed point of the method {@link #ceil ceil} or,
   1.612 -     * equivalently, a fixed point of the method {@link #floor
   1.613 -     * floor}. A value is a fixed point of a one-argument
   1.614 -     * method if and only if the result of applying the method to the
   1.615 -     * value is equal to the value.)
   1.616 -     *
   1.617 -     * <p>The computed result must be within 1 ulp of the exact result.
   1.618 -     * Results must be semi-monotonic.
   1.619 -     *
   1.620 -     * @param   a   the base.
   1.621 -     * @param   b   the exponent.
   1.622 -     * @return  the value {@code a}<sup>{@code b}</sup>.
   1.623 -     */
   1.624 -    @JavaScriptBody(args={"a", "b"}, body="return Math.pow(a, b);")
   1.625 -    public static double pow(double a, double b) {
   1.626 -        throw new UnsupportedOperationException();
   1.627 -    }
   1.628 -
   1.629 -    /**
   1.630 -     * Returns the closest {@code int} to the argument, with ties
   1.631 -     * rounding up.
   1.632 -     *
   1.633 -     * <p>
   1.634 -     * Special cases:
   1.635 -     * <ul><li>If the argument is NaN, the result is 0.
   1.636 -     * <li>If the argument is negative infinity or any value less than or
   1.637 -     * equal to the value of {@code Integer.MIN_VALUE}, the result is
   1.638 -     * equal to the value of {@code Integer.MIN_VALUE}.
   1.639 -     * <li>If the argument is positive infinity or any value greater than or
   1.640 -     * equal to the value of {@code Integer.MAX_VALUE}, the result is
   1.641 -     * equal to the value of {@code Integer.MAX_VALUE}.</ul>
   1.642 -     *
   1.643 -     * @param   a   a floating-point value to be rounded to an integer.
   1.644 -     * @return  the value of the argument rounded to the nearest
   1.645 -     *          {@code int} value.
   1.646 -     * @see     java.lang.Integer#MAX_VALUE
   1.647 -     * @see     java.lang.Integer#MIN_VALUE
   1.648 -     */
   1.649 -    @JavaScriptBody(args="a", body="return Math.round(a);")
   1.650 -    public static int round(float a) {
   1.651 -        throw new UnsupportedOperationException();
   1.652 -    }
   1.653 -
   1.654 -    /**
   1.655 -     * Returns the closest {@code long} to the argument, with ties
   1.656 -     * rounding up.
   1.657 -     *
   1.658 -     * <p>Special cases:
   1.659 -     * <ul><li>If the argument is NaN, the result is 0.
   1.660 -     * <li>If the argument is negative infinity or any value less than or
   1.661 -     * equal to the value of {@code Long.MIN_VALUE}, the result is
   1.662 -     * equal to the value of {@code Long.MIN_VALUE}.
   1.663 -     * <li>If the argument is positive infinity or any value greater than or
   1.664 -     * equal to the value of {@code Long.MAX_VALUE}, the result is
   1.665 -     * equal to the value of {@code Long.MAX_VALUE}.</ul>
   1.666 -     *
   1.667 -     * @param   a   a floating-point value to be rounded to a
   1.668 -     *          {@code long}.
   1.669 -     * @return  the value of the argument rounded to the nearest
   1.670 -     *          {@code long} value.
   1.671 -     * @see     java.lang.Long#MAX_VALUE
   1.672 -     * @see     java.lang.Long#MIN_VALUE
   1.673 -     */
   1.674 -    @JavaScriptBody(args="a", body="return Math.round(a);")
   1.675 -    public static long round(double a) {
   1.676 -        throw new UnsupportedOperationException();
   1.677 -    }
   1.678 -
   1.679 -//    private static Random randomNumberGenerator;
   1.680 -//
   1.681 -//    private static synchronized Random initRNG() {
   1.682 -//        Random rnd = randomNumberGenerator;
   1.683 -//        return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
   1.684 -//    }
   1.685 -
   1.686 -    /**
   1.687 -     * Returns a {@code double} value with a positive sign, greater
   1.688 -     * than or equal to {@code 0.0} and less than {@code 1.0}.
   1.689 -     * Returned values are chosen pseudorandomly with (approximately)
   1.690 -     * uniform distribution from that range.
   1.691 -     *
   1.692 -     * <p>When this method is first called, it creates a single new
   1.693 -     * pseudorandom-number generator, exactly as if by the expression
   1.694 -     *
   1.695 -     * <blockquote>{@code new java.util.Random()}</blockquote>
   1.696 -     *
   1.697 -     * This new pseudorandom-number generator is used thereafter for
   1.698 -     * all calls to this method and is used nowhere else.
   1.699 -     *
   1.700 -     * <p>This method is properly synchronized to allow correct use by
   1.701 -     * more than one thread. However, if many threads need to generate
   1.702 -     * pseudorandom numbers at a great rate, it may reduce contention
   1.703 -     * for each thread to have its own pseudorandom-number generator.
   1.704 -     *
   1.705 -     * @return  a pseudorandom {@code double} greater than or equal
   1.706 -     * to {@code 0.0} and less than {@code 1.0}.
   1.707 -     * @see Random#nextDouble()
   1.708 -     */
   1.709 -    @JavaScriptBody(args={}, body="return Math.random();")
   1.710 -    public static double random() {
   1.711 -        throw new UnsupportedOperationException();
   1.712 -    }
   1.713 -
   1.714 -    /**
   1.715 -     * Returns the absolute value of an {@code int} value.
   1.716 -     * If the argument is not negative, the argument is returned.
   1.717 -     * If the argument is negative, the negation of the argument is returned.
   1.718 -     *
   1.719 -     * <p>Note that if the argument is equal to the value of
   1.720 -     * {@link Integer#MIN_VALUE}, the most negative representable
   1.721 -     * {@code int} value, the result is that same value, which is
   1.722 -     * negative.
   1.723 -     *
   1.724 -     * @param   a   the argument whose absolute value is to be determined
   1.725 -     * @return  the absolute value of the argument.
   1.726 -     */
   1.727 -    public static int abs(int a) {
   1.728 -        return (a < 0) ? -a : a;
   1.729 -    }
   1.730 -
   1.731 -    /**
   1.732 -     * Returns the absolute value of a {@code long} value.
   1.733 -     * If the argument is not negative, the argument is returned.
   1.734 -     * If the argument is negative, the negation of the argument is returned.
   1.735 -     *
   1.736 -     * <p>Note that if the argument is equal to the value of
   1.737 -     * {@link Long#MIN_VALUE}, the most negative representable
   1.738 -     * {@code long} value, the result is that same value, which
   1.739 -     * is negative.
   1.740 -     *
   1.741 -     * @param   a   the argument whose absolute value is to be determined
   1.742 -     * @return  the absolute value of the argument.
   1.743 -     */
   1.744 -    public static long abs(long a) {
   1.745 -        return (a < 0) ? -a : a;
   1.746 -    }
   1.747 -
   1.748 -    /**
   1.749 -     * Returns the absolute value of a {@code float} value.
   1.750 -     * If the argument is not negative, the argument is returned.
   1.751 -     * If the argument is negative, the negation of the argument is returned.
   1.752 -     * Special cases:
   1.753 -     * <ul><li>If the argument is positive zero or negative zero, the
   1.754 -     * result is positive zero.
   1.755 -     * <li>If the argument is infinite, the result is positive infinity.
   1.756 -     * <li>If the argument is NaN, the result is NaN.</ul>
   1.757 -     * In other words, the result is the same as the value of the expression:
   1.758 -     * <p>{@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))}
   1.759 -     *
   1.760 -     * @param   a   the argument whose absolute value is to be determined
   1.761 -     * @return  the absolute value of the argument.
   1.762 -     */
   1.763 -    public static float abs(float a) {
   1.764 -        return (a <= 0.0F) ? 0.0F - a : a;
   1.765 -    }
   1.766 -
   1.767 -    /**
   1.768 -     * Returns the absolute value of a {@code double} value.
   1.769 -     * If the argument is not negative, the argument is returned.
   1.770 -     * If the argument is negative, the negation of the argument is returned.
   1.771 -     * Special cases:
   1.772 -     * <ul><li>If the argument is positive zero or negative zero, the result
   1.773 -     * is positive zero.
   1.774 -     * <li>If the argument is infinite, the result is positive infinity.
   1.775 -     * <li>If the argument is NaN, the result is NaN.</ul>
   1.776 -     * In other words, the result is the same as the value of the expression:
   1.777 -     * <p>{@code Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)}
   1.778 -     *
   1.779 -     * @param   a   the argument whose absolute value is to be determined
   1.780 -     * @return  the absolute value of the argument.
   1.781 -     */
   1.782 -    public static double abs(double a) {
   1.783 -        return (a <= 0.0D) ? 0.0D - a : a;
   1.784 -    }
   1.785 -
   1.786 -    /**
   1.787 -     * Returns the greater of two {@code int} values. That is, the
   1.788 -     * result is the argument closer to the value of
   1.789 -     * {@link Integer#MAX_VALUE}. If the arguments have the same value,
   1.790 -     * the result is that same value.
   1.791 -     *
   1.792 -     * @param   a   an argument.
   1.793 -     * @param   b   another argument.
   1.794 -     * @return  the larger of {@code a} and {@code b}.
   1.795 -     */
   1.796 -    public static int max(int a, int b) {
   1.797 -        return (a >= b) ? a : b;
   1.798 -    }
   1.799 -
   1.800 -    /**
   1.801 -     * Returns the greater of two {@code long} values. That is, the
   1.802 -     * result is the argument closer to the value of
   1.803 -     * {@link Long#MAX_VALUE}. If the arguments have the same value,
   1.804 -     * the result is that same value.
   1.805 -     *
   1.806 -     * @param   a   an argument.
   1.807 -     * @param   b   another argument.
   1.808 -     * @return  the larger of {@code a} and {@code b}.
   1.809 -     */
   1.810 -    public static long max(long a, long b) {
   1.811 -        return (a >= b) ? a : b;
   1.812 -    }
   1.813 -
   1.814 -    /**
   1.815 -     * Returns the greater of two {@code float} values.  That is,
   1.816 -     * the result is the argument closer to positive infinity. If the
   1.817 -     * arguments have the same value, the result is that same
   1.818 -     * value. If either value is NaN, then the result is NaN.  Unlike
   1.819 -     * the numerical comparison operators, this method considers
   1.820 -     * negative zero to be strictly smaller than positive zero. If one
   1.821 -     * argument is positive zero and the other negative zero, the
   1.822 -     * result is positive zero.
   1.823 -     *
   1.824 -     * @param   a   an argument.
   1.825 -     * @param   b   another argument.
   1.826 -     * @return  the larger of {@code a} and {@code b}.
   1.827 -     */
   1.828 -    @JavaScriptBody(args={"a", "b"},
   1.829 -        body="return Math.max(a,b);"
   1.830 -    )
   1.831 -    public static float max(float a, float b) {
   1.832 -        throw new UnsupportedOperationException();
   1.833 -    }
   1.834 -
   1.835 -    /**
   1.836 -     * Returns the greater of two {@code double} values.  That
   1.837 -     * is, the result is the argument closer to positive infinity. If
   1.838 -     * the arguments have the same value, the result is that same
   1.839 -     * value. If either value is NaN, then the result is NaN.  Unlike
   1.840 -     * the numerical comparison operators, this method considers
   1.841 -     * negative zero to be strictly smaller than positive zero. If one
   1.842 -     * argument is positive zero and the other negative zero, the
   1.843 -     * result is positive zero.
   1.844 -     *
   1.845 -     * @param   a   an argument.
   1.846 -     * @param   b   another argument.
   1.847 -     * @return  the larger of {@code a} and {@code b}.
   1.848 -     */
   1.849 -    @JavaScriptBody(args={"a", "b"},
   1.850 -        body="return Math.max(a,b);"
   1.851 -    )
   1.852 -    public static double max(double a, double b) {
   1.853 -        throw new UnsupportedOperationException();
   1.854 -    }
   1.855 -
   1.856 -    /**
   1.857 -     * Returns the smaller of two {@code int} values. That is,
   1.858 -     * the result the argument closer to the value of
   1.859 -     * {@link Integer#MIN_VALUE}.  If the arguments have the same
   1.860 -     * value, the result is that same value.
   1.861 -     *
   1.862 -     * @param   a   an argument.
   1.863 -     * @param   b   another argument.
   1.864 -     * @return  the smaller of {@code a} and {@code b}.
   1.865 -     */
   1.866 -    public static int min(int a, int b) {
   1.867 -        return (a <= b) ? a : b;
   1.868 -    }
   1.869 -
   1.870 -    /**
   1.871 -     * Returns the smaller of two {@code long} values. That is,
   1.872 -     * the result is the argument closer to the value of
   1.873 -     * {@link Long#MIN_VALUE}. If the arguments have the same
   1.874 -     * value, the result is that same value.
   1.875 -     *
   1.876 -     * @param   a   an argument.
   1.877 -     * @param   b   another argument.
   1.878 -     * @return  the smaller of {@code a} and {@code b}.
   1.879 -     */
   1.880 -    public static long min(long a, long b) {
   1.881 -        return (a <= b) ? a : b;
   1.882 -    }
   1.883 -
   1.884 -    /**
   1.885 -     * Returns the smaller of two {@code float} values.  That is,
   1.886 -     * the result is the value closer to negative infinity. If the
   1.887 -     * arguments have the same value, the result is that same
   1.888 -     * value. If either value is NaN, then the result is NaN.  Unlike
   1.889 -     * the numerical comparison operators, this method considers
   1.890 -     * negative zero to be strictly smaller than positive zero.  If
   1.891 -     * one argument is positive zero and the other is negative zero,
   1.892 -     * the result is negative zero.
   1.893 -     *
   1.894 -     * @param   a   an argument.
   1.895 -     * @param   b   another argument.
   1.896 -     * @return  the smaller of {@code a} and {@code b}.
   1.897 -     */
   1.898 -    @JavaScriptBody(args={"a", "b"},
   1.899 -        body="return Math.min(a,b);"
   1.900 -    )
   1.901 -    public static float min(float a, float b) {
   1.902 -        throw new UnsupportedOperationException();
   1.903 -    }
   1.904 -
   1.905 -    /**
   1.906 -     * Returns the smaller of two {@code double} values.  That
   1.907 -     * is, the result is the value closer to negative infinity. If the
   1.908 -     * arguments have the same value, the result is that same
   1.909 -     * value. If either value is NaN, then the result is NaN.  Unlike
   1.910 -     * the numerical comparison operators, this method considers
   1.911 -     * negative zero to be strictly smaller than positive zero. If one
   1.912 -     * argument is positive zero and the other is negative zero, the
   1.913 -     * result is negative zero.
   1.914 -     *
   1.915 -     * @param   a   an argument.
   1.916 -     * @param   b   another argument.
   1.917 -     * @return  the smaller of {@code a} and {@code b}.
   1.918 -     */
   1.919 -    @JavaScriptBody(args={"a", "b"},
   1.920 -        body="return Math.min(a,b);"
   1.921 -    )
   1.922 -    public static double min(double a, double b) {
   1.923 -        throw new UnsupportedOperationException();
   1.924 -    }
   1.925 -
   1.926 -    /**
   1.927 -     * Returns the size of an ulp of the argument.  An ulp of a
   1.928 -     * {@code double} value is the positive distance between this
   1.929 -     * floating-point value and the {@code double} value next
   1.930 -     * larger in magnitude.  Note that for non-NaN <i>x</i>,
   1.931 -     * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
   1.932 -     *
   1.933 -     * <p>Special Cases:
   1.934 -     * <ul>
   1.935 -     * <li> If the argument is NaN, then the result is NaN.
   1.936 -     * <li> If the argument is positive or negative infinity, then the
   1.937 -     * result is positive infinity.
   1.938 -     * <li> If the argument is positive or negative zero, then the result is
   1.939 -     * {@code Double.MIN_VALUE}.
   1.940 -     * <li> If the argument is &plusmn;{@code Double.MAX_VALUE}, then
   1.941 -     * the result is equal to 2<sup>971</sup>.
   1.942 -     * </ul>
   1.943 -     *
   1.944 -     * @param d the floating-point value whose ulp is to be returned
   1.945 -     * @return the size of an ulp of the argument
   1.946 -     * @author Joseph D. Darcy
   1.947 -     * @since 1.5
   1.948 -     */
   1.949 -//    public static double ulp(double d) {
   1.950 -//        return sun.misc.FpUtils.ulp(d);
   1.951 -//    }
   1.952 -
   1.953 -    /**
   1.954 -     * Returns the size of an ulp of the argument.  An ulp of a
   1.955 -     * {@code float} value is the positive distance between this
   1.956 -     * floating-point value and the {@code float} value next
   1.957 -     * larger in magnitude.  Note that for non-NaN <i>x</i>,
   1.958 -     * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
   1.959 -     *
   1.960 -     * <p>Special Cases:
   1.961 -     * <ul>
   1.962 -     * <li> If the argument is NaN, then the result is NaN.
   1.963 -     * <li> If the argument is positive or negative infinity, then the
   1.964 -     * result is positive infinity.
   1.965 -     * <li> If the argument is positive or negative zero, then the result is
   1.966 -     * {@code Float.MIN_VALUE}.
   1.967 -     * <li> If the argument is &plusmn;{@code Float.MAX_VALUE}, then
   1.968 -     * the result is equal to 2<sup>104</sup>.
   1.969 -     * </ul>
   1.970 -     *
   1.971 -     * @param f the floating-point value whose ulp is to be returned
   1.972 -     * @return the size of an ulp of the argument
   1.973 -     * @author Joseph D. Darcy
   1.974 -     * @since 1.5
   1.975 -     */
   1.976 -//    public static float ulp(float f) {
   1.977 -//        return sun.misc.FpUtils.ulp(f);
   1.978 -//    }
   1.979 -
   1.980 -    /**
   1.981 -     * Returns the signum function of the argument; zero if the argument
   1.982 -     * is zero, 1.0 if the argument is greater than zero, -1.0 if the
   1.983 -     * argument is less than zero.
   1.984 -     *
   1.985 -     * <p>Special Cases:
   1.986 -     * <ul>
   1.987 -     * <li> If the argument is NaN, then the result is NaN.
   1.988 -     * <li> If the argument is positive zero or negative zero, then the
   1.989 -     *      result is the same as the argument.
   1.990 -     * </ul>
   1.991 -     *
   1.992 -     * @param d the floating-point value whose signum is to be returned
   1.993 -     * @return the signum function of the argument
   1.994 -     * @author Joseph D. Darcy
   1.995 -     * @since 1.5
   1.996 -     */
   1.997 -    public static double signum(double d) {
   1.998 -        if (d < 0.0) { return -1.0; }
   1.999 -        if (d > 0.0) { return 1.0; }
  1.1000 -        return d;
  1.1001 -    }
  1.1002 -
  1.1003 -    /**
  1.1004 -     * Returns the signum function of the argument; zero if the argument
  1.1005 -     * is zero, 1.0f if the argument is greater than zero, -1.0f if the
  1.1006 -     * argument is less than zero.
  1.1007 -     *
  1.1008 -     * <p>Special Cases:
  1.1009 -     * <ul>
  1.1010 -     * <li> If the argument is NaN, then the result is NaN.
  1.1011 -     * <li> If the argument is positive zero or negative zero, then the
  1.1012 -     *      result is the same as the argument.
  1.1013 -     * </ul>
  1.1014 -     *
  1.1015 -     * @param f the floating-point value whose signum is to be returned
  1.1016 -     * @return the signum function of the argument
  1.1017 -     * @author Joseph D. Darcy
  1.1018 -     * @since 1.5
  1.1019 -     */
  1.1020 -    public static float signum(float f) {
  1.1021 -        if (f < 0.0f) { return -1.0f; }
  1.1022 -        if (f > 0.0f) { return 1.0f; }
  1.1023 -        return f;
  1.1024 -    }
  1.1025 -
  1.1026 -    /**
  1.1027 -     * Returns the first floating-point argument with the sign of the
  1.1028 -     * second floating-point argument.  Note that unlike the {@link
  1.1029 -     * StrictMath#copySign(double, double) StrictMath.copySign}
  1.1030 -     * method, this method does not require NaN {@code sign}
  1.1031 -     * arguments to be treated as positive values; implementations are
  1.1032 -     * permitted to treat some NaN arguments as positive and other NaN
  1.1033 -     * arguments as negative to allow greater performance.
  1.1034 -     *
  1.1035 -     * @param magnitude  the parameter providing the magnitude of the result
  1.1036 -     * @param sign   the parameter providing the sign of the result
  1.1037 -     * @return a value with the magnitude of {@code magnitude}
  1.1038 -     * and the sign of {@code sign}.
  1.1039 -     * @since 1.6
  1.1040 -     */
  1.1041 -//    public static double copySign(double magnitude, double sign) {
  1.1042 -//        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
  1.1043 -//    }
  1.1044 -
  1.1045 -    /**
  1.1046 -     * Returns the first floating-point argument with the sign of the
  1.1047 -     * second floating-point argument.  Note that unlike the {@link
  1.1048 -     * StrictMath#copySign(float, float) StrictMath.copySign}
  1.1049 -     * method, this method does not require NaN {@code sign}
  1.1050 -     * arguments to be treated as positive values; implementations are
  1.1051 -     * permitted to treat some NaN arguments as positive and other NaN
  1.1052 -     * arguments as negative to allow greater performance.
  1.1053 -     *
  1.1054 -     * @param magnitude  the parameter providing the magnitude of the result
  1.1055 -     * @param sign   the parameter providing the sign of the result
  1.1056 -     * @return a value with the magnitude of {@code magnitude}
  1.1057 -     * and the sign of {@code sign}.
  1.1058 -     * @since 1.6
  1.1059 -     */
  1.1060 -//    public static float copySign(float magnitude, float sign) {
  1.1061 -//        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
  1.1062 -//    }
  1.1063 -
  1.1064 -    /**
  1.1065 -     * Returns the unbiased exponent used in the representation of a
  1.1066 -     * {@code float}.  Special cases:
  1.1067 -     *
  1.1068 -     * <ul>
  1.1069 -     * <li>If the argument is NaN or infinite, then the result is
  1.1070 -     * {@link Float#MAX_EXPONENT} + 1.
  1.1071 -     * <li>If the argument is zero or subnormal, then the result is
  1.1072 -     * {@link Float#MIN_EXPONENT} -1.
  1.1073 -     * </ul>
  1.1074 -     * @param f a {@code float} value
  1.1075 -     * @return the unbiased exponent of the argument
  1.1076 -     * @since 1.6
  1.1077 -     */
  1.1078 -//    public static int getExponent(float f) {
  1.1079 -//        return sun.misc.FpUtils.getExponent(f);
  1.1080 -//    }
  1.1081 -
  1.1082 -    /**
  1.1083 -     * Returns the unbiased exponent used in the representation of a
  1.1084 -     * {@code double}.  Special cases:
  1.1085 -     *
  1.1086 -     * <ul>
  1.1087 -     * <li>If the argument is NaN or infinite, then the result is
  1.1088 -     * {@link Double#MAX_EXPONENT} + 1.
  1.1089 -     * <li>If the argument is zero or subnormal, then the result is
  1.1090 -     * {@link Double#MIN_EXPONENT} -1.
  1.1091 -     * </ul>
  1.1092 -     * @param d a {@code double} value
  1.1093 -     * @return the unbiased exponent of the argument
  1.1094 -     * @since 1.6
  1.1095 -     */
  1.1096 -//    public static int getExponent(double d) {
  1.1097 -//        return sun.misc.FpUtils.getExponent(d);
  1.1098 -//    }
  1.1099 -
  1.1100 -    /**
  1.1101 -     * Returns the floating-point number adjacent to the first
  1.1102 -     * argument in the direction of the second argument.  If both
  1.1103 -     * arguments compare as equal the second argument is returned.
  1.1104 -     *
  1.1105 -     * <p>
  1.1106 -     * Special cases:
  1.1107 -     * <ul>
  1.1108 -     * <li> If either argument is a NaN, then NaN is returned.
  1.1109 -     *
  1.1110 -     * <li> If both arguments are signed zeros, {@code direction}
  1.1111 -     * is returned unchanged (as implied by the requirement of
  1.1112 -     * returning the second argument if the arguments compare as
  1.1113 -     * equal).
  1.1114 -     *
  1.1115 -     * <li> If {@code start} is
  1.1116 -     * &plusmn;{@link Double#MIN_VALUE} and {@code direction}
  1.1117 -     * has a value such that the result should have a smaller
  1.1118 -     * magnitude, then a zero with the same sign as {@code start}
  1.1119 -     * is returned.
  1.1120 -     *
  1.1121 -     * <li> If {@code start} is infinite and
  1.1122 -     * {@code direction} has a value such that the result should
  1.1123 -     * have a smaller magnitude, {@link Double#MAX_VALUE} with the
  1.1124 -     * same sign as {@code start} is returned.
  1.1125 -     *
  1.1126 -     * <li> If {@code start} is equal to &plusmn;
  1.1127 -     * {@link Double#MAX_VALUE} and {@code direction} has a
  1.1128 -     * value such that the result should have a larger magnitude, an
  1.1129 -     * infinity with same sign as {@code start} is returned.
  1.1130 -     * </ul>
  1.1131 -     *
  1.1132 -     * @param start  starting floating-point value
  1.1133 -     * @param direction value indicating which of
  1.1134 -     * {@code start}'s neighbors or {@code start} should
  1.1135 -     * be returned
  1.1136 -     * @return The floating-point number adjacent to {@code start} in the
  1.1137 -     * direction of {@code direction}.
  1.1138 -     * @since 1.6
  1.1139 -     */
  1.1140 -//    public static double nextAfter(double start, double direction) {
  1.1141 -//        return sun.misc.FpUtils.nextAfter(start, direction);
  1.1142 -//    }
  1.1143 -
  1.1144 -    /**
  1.1145 -     * Returns the floating-point number adjacent to the first
  1.1146 -     * argument in the direction of the second argument.  If both
  1.1147 -     * arguments compare as equal a value equivalent to the second argument
  1.1148 -     * is returned.
  1.1149 -     *
  1.1150 -     * <p>
  1.1151 -     * Special cases:
  1.1152 -     * <ul>
  1.1153 -     * <li> If either argument is a NaN, then NaN is returned.
  1.1154 -     *
  1.1155 -     * <li> If both arguments are signed zeros, a value equivalent
  1.1156 -     * to {@code direction} is returned.
  1.1157 -     *
  1.1158 -     * <li> If {@code start} is
  1.1159 -     * &plusmn;{@link Float#MIN_VALUE} and {@code direction}
  1.1160 -     * has a value such that the result should have a smaller
  1.1161 -     * magnitude, then a zero with the same sign as {@code start}
  1.1162 -     * is returned.
  1.1163 -     *
  1.1164 -     * <li> If {@code start} is infinite and
  1.1165 -     * {@code direction} has a value such that the result should
  1.1166 -     * have a smaller magnitude, {@link Float#MAX_VALUE} with the
  1.1167 -     * same sign as {@code start} is returned.
  1.1168 -     *
  1.1169 -     * <li> If {@code start} is equal to &plusmn;
  1.1170 -     * {@link Float#MAX_VALUE} and {@code direction} has a
  1.1171 -     * value such that the result should have a larger magnitude, an
  1.1172 -     * infinity with same sign as {@code start} is returned.
  1.1173 -     * </ul>
  1.1174 -     *
  1.1175 -     * @param start  starting floating-point value
  1.1176 -     * @param direction value indicating which of
  1.1177 -     * {@code start}'s neighbors or {@code start} should
  1.1178 -     * be returned
  1.1179 -     * @return The floating-point number adjacent to {@code start} in the
  1.1180 -     * direction of {@code direction}.
  1.1181 -     * @since 1.6
  1.1182 -     */
  1.1183 -//    public static float nextAfter(float start, double direction) {
  1.1184 -//        return sun.misc.FpUtils.nextAfter(start, direction);
  1.1185 -//    }
  1.1186 -
  1.1187 -    /**
  1.1188 -     * Returns the floating-point value adjacent to {@code d} in
  1.1189 -     * the direction of positive infinity.  This method is
  1.1190 -     * semantically equivalent to {@code nextAfter(d,
  1.1191 -     * Double.POSITIVE_INFINITY)}; however, a {@code nextUp}
  1.1192 -     * implementation may run faster than its equivalent
  1.1193 -     * {@code nextAfter} call.
  1.1194 -     *
  1.1195 -     * <p>Special Cases:
  1.1196 -     * <ul>
  1.1197 -     * <li> If the argument is NaN, the result is NaN.
  1.1198 -     *
  1.1199 -     * <li> If the argument is positive infinity, the result is
  1.1200 -     * positive infinity.
  1.1201 -     *
  1.1202 -     * <li> If the argument is zero, the result is
  1.1203 -     * {@link Double#MIN_VALUE}
  1.1204 -     *
  1.1205 -     * </ul>
  1.1206 -     *
  1.1207 -     * @param d starting floating-point value
  1.1208 -     * @return The adjacent floating-point value closer to positive
  1.1209 -     * infinity.
  1.1210 -     * @since 1.6
  1.1211 -     */
  1.1212 -//    public static double nextUp(double d) {
  1.1213 -//        return sun.misc.FpUtils.nextUp(d);
  1.1214 -//    }
  1.1215 -
  1.1216 -    /**
  1.1217 -     * Returns the floating-point value adjacent to {@code f} in
  1.1218 -     * the direction of positive infinity.  This method is
  1.1219 -     * semantically equivalent to {@code nextAfter(f,
  1.1220 -     * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
  1.1221 -     * implementation may run faster than its equivalent
  1.1222 -     * {@code nextAfter} call.
  1.1223 -     *
  1.1224 -     * <p>Special Cases:
  1.1225 -     * <ul>
  1.1226 -     * <li> If the argument is NaN, the result is NaN.
  1.1227 -     *
  1.1228 -     * <li> If the argument is positive infinity, the result is
  1.1229 -     * positive infinity.
  1.1230 -     *
  1.1231 -     * <li> If the argument is zero, the result is
  1.1232 -     * {@link Float#MIN_VALUE}
  1.1233 -     *
  1.1234 -     * </ul>
  1.1235 -     *
  1.1236 -     * @param f starting floating-point value
  1.1237 -     * @return The adjacent floating-point value closer to positive
  1.1238 -     * infinity.
  1.1239 -     * @since 1.6
  1.1240 -     */
  1.1241 -//    public static float nextUp(float f) {
  1.1242 -//        return sun.misc.FpUtils.nextUp(f);
  1.1243 -//    }
  1.1244 -
  1.1245 -
  1.1246 -    /**
  1.1247 -     * Return {@code d} &times;
  1.1248 -     * 2<sup>{@code scaleFactor}</sup> rounded as if performed
  1.1249 -     * by a single correctly rounded floating-point multiply to a
  1.1250 -     * member of the double value set.  See the Java
  1.1251 -     * Language Specification for a discussion of floating-point
  1.1252 -     * value sets.  If the exponent of the result is between {@link
  1.1253 -     * Double#MIN_EXPONENT} and {@link Double#MAX_EXPONENT}, the
  1.1254 -     * answer is calculated exactly.  If the exponent of the result
  1.1255 -     * would be larger than {@code Double.MAX_EXPONENT}, an
  1.1256 -     * infinity is returned.  Note that if the result is subnormal,
  1.1257 -     * precision may be lost; that is, when {@code scalb(x, n)}
  1.1258 -     * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
  1.1259 -     * <i>x</i>.  When the result is non-NaN, the result has the same
  1.1260 -     * sign as {@code d}.
  1.1261 -     *
  1.1262 -     * <p>Special cases:
  1.1263 -     * <ul>
  1.1264 -     * <li> If the first argument is NaN, NaN is returned.
  1.1265 -     * <li> If the first argument is infinite, then an infinity of the
  1.1266 -     * same sign is returned.
  1.1267 -     * <li> If the first argument is zero, then a zero of the same
  1.1268 -     * sign is returned.
  1.1269 -     * </ul>
  1.1270 -     *
  1.1271 -     * @param d number to be scaled by a power of two.
  1.1272 -     * @param scaleFactor power of 2 used to scale {@code d}
  1.1273 -     * @return {@code d} &times; 2<sup>{@code scaleFactor}</sup>
  1.1274 -     * @since 1.6
  1.1275 -     */
  1.1276 -//    public static double scalb(double d, int scaleFactor) {
  1.1277 -//        return sun.misc.FpUtils.scalb(d, scaleFactor);
  1.1278 -//    }
  1.1279 -
  1.1280 -    /**
  1.1281 -     * Return {@code f} &times;
  1.1282 -     * 2<sup>{@code scaleFactor}</sup> rounded as if performed
  1.1283 -     * by a single correctly rounded floating-point multiply to a
  1.1284 -     * member of the float value set.  See the Java
  1.1285 -     * Language Specification for a discussion of floating-point
  1.1286 -     * value sets.  If the exponent of the result is between {@link
  1.1287 -     * Float#MIN_EXPONENT} and {@link Float#MAX_EXPONENT}, the
  1.1288 -     * answer is calculated exactly.  If the exponent of the result
  1.1289 -     * would be larger than {@code Float.MAX_EXPONENT}, an
  1.1290 -     * infinity is returned.  Note that if the result is subnormal,
  1.1291 -     * precision may be lost; that is, when {@code scalb(x, n)}
  1.1292 -     * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
  1.1293 -     * <i>x</i>.  When the result is non-NaN, the result has the same
  1.1294 -     * sign as {@code f}.
  1.1295 -     *
  1.1296 -     * <p>Special cases:
  1.1297 -     * <ul>
  1.1298 -     * <li> If the first argument is NaN, NaN is returned.
  1.1299 -     * <li> If the first argument is infinite, then an infinity of the
  1.1300 -     * same sign is returned.
  1.1301 -     * <li> If the first argument is zero, then a zero of the same
  1.1302 -     * sign is returned.
  1.1303 -     * </ul>
  1.1304 -     *
  1.1305 -     * @param f number to be scaled by a power of two.
  1.1306 -     * @param scaleFactor power of 2 used to scale {@code f}
  1.1307 -     * @return {@code f} &times; 2<sup>{@code scaleFactor}</sup>
  1.1308 -     * @since 1.6
  1.1309 -     */
  1.1310 -//    public static float scalb(float f, int scaleFactor) {
  1.1311 -//        return sun.misc.FpUtils.scalb(f, scaleFactor);
  1.1312 -//    }
  1.1313 -}