rt/emul/mini/src/main/java/java/lang/Math.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 17 Jan 2017 07:04:06 +0100
changeset 1985 cd1cc103a03c
parent 772 d382dacfd73f
permissions -rw-r--r--
Implementation of ClassValue for bck2brwsr
     1 /*
     2  * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    25 
    26 package java.lang;
    27 
    28 import org.apidesign.bck2brwsr.core.ExtraJavaScript;
    29 import org.apidesign.bck2brwsr.core.JavaScriptBody;
    30 
    31 
    32 /**
    33  * The class {@code Math} contains methods for performing basic
    34  * numeric operations such as the elementary exponential, logarithm,
    35  * square root, and trigonometric functions.
    36  *
    37  * <p>Unlike some of the numeric methods of class
    38  * {@code StrictMath}, all implementations of the equivalent
    39  * functions of class {@code Math} are not defined to return the
    40  * bit-for-bit same results.  This relaxation permits
    41  * better-performing implementations where strict reproducibility is
    42  * not required.
    43  *
    44  * <p>By default many of the {@code Math} methods simply call
    45  * the equivalent method in {@code StrictMath} for their
    46  * implementation.  Code generators are encouraged to use
    47  * platform-specific native libraries or microprocessor instructions,
    48  * where available, to provide higher-performance implementations of
    49  * {@code Math} methods.  Such higher-performance
    50  * implementations still must conform to the specification for
    51  * {@code Math}.
    52  *
    53  * <p>The quality of implementation specifications concern two
    54  * properties, accuracy of the returned result and monotonicity of the
    55  * method.  Accuracy of the floating-point {@code Math} methods
    56  * is measured in terms of <i>ulps</i>, units in the last place.  For
    57  * a given floating-point format, an ulp of a specific real number
    58  * value is the distance between the two floating-point values
    59  * bracketing that numerical value.  When discussing the accuracy of a
    60  * method as a whole rather than at a specific argument, the number of
    61  * ulps cited is for the worst-case error at any argument.  If a
    62  * method always has an error less than 0.5 ulps, the method always
    63  * returns the floating-point number nearest the exact result; such a
    64  * method is <i>correctly rounded</i>.  A correctly rounded method is
    65  * generally the best a floating-point approximation can be; however,
    66  * it is impractical for many floating-point methods to be correctly
    67  * rounded.  Instead, for the {@code Math} class, a larger error
    68  * bound of 1 or 2 ulps is allowed for certain methods.  Informally,
    69  * with a 1 ulp error bound, when the exact result is a representable
    70  * number, the exact result should be returned as the computed result;
    71  * otherwise, either of the two floating-point values which bracket
    72  * the exact result may be returned.  For exact results large in
    73  * magnitude, one of the endpoints of the bracket may be infinite.
    74  * Besides accuracy at individual arguments, maintaining proper
    75  * relations between the method at different arguments is also
    76  * important.  Therefore, most methods with more than 0.5 ulp errors
    77  * are required to be <i>semi-monotonic</i>: whenever the mathematical
    78  * function is non-decreasing, so is the floating-point approximation,
    79  * likewise, whenever the mathematical function is non-increasing, so
    80  * is the floating-point approximation.  Not all approximations that
    81  * have 1 ulp accuracy will automatically meet the monotonicity
    82  * requirements.
    83  *
    84  * @author  unascribed
    85  * @author  Joseph D. Darcy
    86  * @since   JDK1.0
    87  */
    88 
    89 @ExtraJavaScript(
    90     resource="/org/apidesign/vm4brwsr/emul/lang/java_lang_Math.js",
    91     processByteCode=true
    92 )
    93 public final class Math {
    94 
    95     /**
    96      * Don't let anyone instantiate this class.
    97      */
    98     private Math() {}
    99 
   100     /**
   101      * The {@code double} value that is closer than any other to
   102      * <i>e</i>, the base of the natural logarithms.
   103      */
   104     public static final double E = 2.7182818284590452354;
   105 
   106     /**
   107      * The {@code double} value that is closer than any other to
   108      * <i>pi</i>, the ratio of the circumference of a circle to its
   109      * diameter.
   110      */
   111     public static final double PI = 3.14159265358979323846;
   112 
   113     /**
   114      * Returns the trigonometric sine of an angle.  Special cases:
   115      * <ul><li>If the argument is NaN or an infinity, then the
   116      * result is NaN.
   117      * <li>If the argument is zero, then the result is a zero with the
   118      * same sign as the argument.</ul>
   119      *
   120      * <p>The computed result must be within 1 ulp of the exact result.
   121      * Results must be semi-monotonic.
   122      *
   123      * @param   a   an angle, in radians.
   124      * @return  the sine of the argument.
   125      */
   126     @JavaScriptBody(args="a", body="return Math.sin(a);")
   127     public static double sin(double a) {
   128         throw new UnsupportedOperationException();
   129     }
   130 
   131     /**
   132      * Returns the trigonometric cosine of an angle. Special cases:
   133      * <ul><li>If the argument is NaN or an infinity, then the
   134      * result is NaN.</ul>
   135      *
   136      * <p>The computed result must be within 1 ulp of the exact result.
   137      * Results must be semi-monotonic.
   138      *
   139      * @param   a   an angle, in radians.
   140      * @return  the cosine of the argument.
   141      */
   142     @JavaScriptBody(args="a", body="return Math.cos(a);")
   143     public static double cos(double a) {
   144         throw new UnsupportedOperationException();
   145     }
   146 
   147     /**
   148      * Returns the trigonometric tangent of an angle.  Special cases:
   149      * <ul><li>If the argument is NaN or an infinity, then the result
   150      * is NaN.
   151      * <li>If the argument is zero, then the result is a zero with the
   152      * same sign as the argument.</ul>
   153      *
   154      * <p>The computed result must be within 1 ulp of the exact result.
   155      * Results must be semi-monotonic.
   156      *
   157      * @param   a   an angle, in radians.
   158      * @return  the tangent of the argument.
   159      */
   160     @JavaScriptBody(args="a", body="return Math.tan(a);")
   161     public static double tan(double a) {
   162         throw new UnsupportedOperationException();
   163     }
   164 
   165     /**
   166      * Returns the arc sine of a value; the returned angle is in the
   167      * range -<i>pi</i>/2 through <i>pi</i>/2.  Special cases:
   168      * <ul><li>If the argument is NaN or its absolute value is greater
   169      * than 1, then the result is NaN.
   170      * <li>If the argument is zero, then the result is a zero with the
   171      * same sign as the argument.</ul>
   172      *
   173      * <p>The computed result must be within 1 ulp of the exact result.
   174      * Results must be semi-monotonic.
   175      *
   176      * @param   a   the value whose arc sine is to be returned.
   177      * @return  the arc sine of the argument.
   178      */
   179     @JavaScriptBody(args="a", body="return Math.asin(a);")
   180     public static double asin(double a) {
   181         throw new UnsupportedOperationException();
   182     }
   183 
   184     /**
   185      * Returns the arc cosine of a value; the returned angle is in the
   186      * range 0.0 through <i>pi</i>.  Special case:
   187      * <ul><li>If the argument is NaN or its absolute value is greater
   188      * than 1, then the result is NaN.</ul>
   189      *
   190      * <p>The computed result must be within 1 ulp of the exact result.
   191      * Results must be semi-monotonic.
   192      *
   193      * @param   a   the value whose arc cosine is to be returned.
   194      * @return  the arc cosine of the argument.
   195      */
   196     @JavaScriptBody(args="a", body="return Math.acos(a);")
   197     public static double acos(double a) {
   198         throw new UnsupportedOperationException();
   199     }
   200 
   201     /**
   202      * Returns the arc tangent of a value; the returned angle is in the
   203      * range -<i>pi</i>/2 through <i>pi</i>/2.  Special cases:
   204      * <ul><li>If the argument is NaN, then the result is NaN.
   205      * <li>If the argument is zero, then the result is a zero with the
   206      * same sign as the argument.</ul>
   207      *
   208      * <p>The computed result must be within 1 ulp of the exact result.
   209      * Results must be semi-monotonic.
   210      *
   211      * @param   a   the value whose arc tangent is to be returned.
   212      * @return  the arc tangent of the argument.
   213      */
   214     @JavaScriptBody(args="a", body="return Math.atan(a);")
   215     public static double atan(double a) {
   216         throw new UnsupportedOperationException();
   217     }
   218 
   219     /**
   220      * Converts an angle measured in degrees to an approximately
   221      * equivalent angle measured in radians.  The conversion from
   222      * degrees to radians is generally inexact.
   223      *
   224      * @param   angdeg   an angle, in degrees
   225      * @return  the measurement of the angle {@code angdeg}
   226      *          in radians.
   227      * @since   1.2
   228      */
   229     public static double toRadians(double angdeg) {
   230         return angdeg / 180.0 * PI;
   231     }
   232 
   233     /**
   234      * Converts an angle measured in radians to an approximately
   235      * equivalent angle measured in degrees.  The conversion from
   236      * radians to degrees is generally inexact; users should
   237      * <i>not</i> expect {@code cos(toRadians(90.0))} to exactly
   238      * equal {@code 0.0}.
   239      *
   240      * @param   angrad   an angle, in radians
   241      * @return  the measurement of the angle {@code angrad}
   242      *          in degrees.
   243      * @since   1.2
   244      */
   245     public static double toDegrees(double angrad) {
   246         return angrad * 180.0 / PI;
   247     }
   248 
   249     /**
   250      * Returns Euler's number <i>e</i> raised to the power of a
   251      * {@code double} value.  Special cases:
   252      * <ul><li>If the argument is NaN, the result is NaN.
   253      * <li>If the argument is positive infinity, then the result is
   254      * positive infinity.
   255      * <li>If the argument is negative infinity, then the result is
   256      * positive zero.</ul>
   257      *
   258      * <p>The computed result must be within 1 ulp of the exact result.
   259      * Results must be semi-monotonic.
   260      *
   261      * @param   a   the exponent to raise <i>e</i> to.
   262      * @return  the value <i>e</i><sup>{@code a}</sup>,
   263      *          where <i>e</i> is the base of the natural logarithms.
   264      */
   265     @JavaScriptBody(args="a", body="return Math.exp(a);")
   266     public static double exp(double a) {
   267         throw new UnsupportedOperationException();
   268     }
   269 
   270     /**
   271      * Returns the natural logarithm (base <i>e</i>) of a {@code double}
   272      * value.  Special cases:
   273      * <ul><li>If the argument is NaN or less than zero, then the result
   274      * is NaN.
   275      * <li>If the argument is positive infinity, then the result is
   276      * positive infinity.
   277      * <li>If the argument is positive zero or negative zero, then the
   278      * result is negative infinity.</ul>
   279      *
   280      * <p>The computed result must be within 1 ulp of the exact result.
   281      * Results must be semi-monotonic.
   282      *
   283      * @param   a   a value
   284      * @return  the value ln&nbsp;{@code a}, the natural logarithm of
   285      *          {@code a}.
   286      */
   287     @JavaScriptBody(args="a", body="return Math.log(a);")
   288     public static double log(double a) {
   289         throw new UnsupportedOperationException();
   290     }
   291 
   292     /**
   293      * Returns the base 10 logarithm of a {@code double} value.
   294      * Special cases:
   295      *
   296      * <ul><li>If the argument is NaN or less than zero, then the result
   297      * is NaN.
   298      * <li>If the argument is positive infinity, then the result is
   299      * positive infinity.
   300      * <li>If the argument is positive zero or negative zero, then the
   301      * result is negative infinity.
   302      * <li> If the argument is equal to 10<sup><i>n</i></sup> for
   303      * integer <i>n</i>, then the result is <i>n</i>.
   304      * </ul>
   305      *
   306      * <p>The computed result must be within 1 ulp of the exact result.
   307      * Results must be semi-monotonic.
   308      *
   309      * @param   a   a value
   310      * @return  the base 10 logarithm of  {@code a}.
   311      * @since 1.5
   312      */
   313     @JavaScriptBody(args="a", body="return Math.log(a) / Math.LN10;")
   314     public static double log10(double a) {
   315         throw new UnsupportedOperationException();
   316     }
   317 
   318     /**
   319      * Returns the correctly rounded positive square root of a
   320      * {@code double} value.
   321      * Special cases:
   322      * <ul><li>If the argument is NaN or less than zero, then the result
   323      * is NaN.
   324      * <li>If the argument is positive infinity, then the result is positive
   325      * infinity.
   326      * <li>If the argument is positive zero or negative zero, then the
   327      * result is the same as the argument.</ul>
   328      * Otherwise, the result is the {@code double} value closest to
   329      * the true mathematical square root of the argument value.
   330      *
   331      * @param   a   a value.
   332      * @return  the positive square root of {@code a}.
   333      *          If the argument is NaN or less than zero, the result is NaN.
   334      */
   335     @JavaScriptBody(args="a", body="return Math.sqrt(a);")
   336     public static double sqrt(double a) {
   337         throw new UnsupportedOperationException();
   338     }
   339 
   340     /**
   341      * Returns the smallest (closest to negative infinity)
   342      * {@code double} value that is greater than or equal to the
   343      * argument and is equal to a mathematical integer. Special cases:
   344      * <ul><li>If the argument value is already equal to a
   345      * mathematical integer, then the result is the same as the
   346      * argument.  <li>If the argument is NaN or an infinity or
   347      * positive zero or negative zero, then the result is the same as
   348      * the argument.  <li>If the argument value is less than zero but
   349      * greater than -1.0, then the result is negative zero.</ul> Note
   350      * that the value of {@code Math.ceil(x)} is exactly the
   351      * value of {@code -Math.floor(-x)}.
   352      *
   353      *
   354      * @param   a   a value.
   355      * @return  the smallest (closest to negative infinity)
   356      *          floating-point value that is greater than or equal to
   357      *          the argument and is equal to a mathematical integer.
   358      */
   359     @JavaScriptBody(args="a", body="return Math.ceil(a);")
   360     public static double ceil(double a) {
   361         throw new UnsupportedOperationException();
   362     }
   363 
   364     /**
   365      * Returns the largest (closest to positive infinity)
   366      * {@code double} value that is less than or equal to the
   367      * argument and is equal to a mathematical integer. Special cases:
   368      * <ul><li>If the argument value is already equal to a
   369      * mathematical integer, then the result is the same as the
   370      * argument.  <li>If the argument is NaN or an infinity or
   371      * positive zero or negative zero, then the result is the same as
   372      * the argument.</ul>
   373      *
   374      * @param   a   a value.
   375      * @return  the largest (closest to positive infinity)
   376      *          floating-point value that less than or equal to the argument
   377      *          and is equal to a mathematical integer.
   378      */
   379     @JavaScriptBody(args="a", body="return Math.floor(a);")
   380     public static double floor(double a) {
   381         throw new UnsupportedOperationException();
   382     }
   383     /**
   384      * Computes the remainder operation on two arguments as prescribed
   385      * by the IEEE 754 standard.
   386      * The remainder value is mathematically equal to
   387      * <code>f1&nbsp;-&nbsp;f2</code>&nbsp;&times;&nbsp;<i>n</i>,
   388      * where <i>n</i> is the mathematical integer closest to the exact
   389      * mathematical value of the quotient {@code f1/f2}, and if two
   390      * mathematical integers are equally close to {@code f1/f2},
   391      * then <i>n</i> is the integer that is even. If the remainder is
   392      * zero, its sign is the same as the sign of the first argument.
   393      * Special cases:
   394      * <ul><li>If either argument is NaN, or the first argument is infinite,
   395      * or the second argument is positive zero or negative zero, then the
   396      * result is NaN.
   397      * <li>If the first argument is finite and the second argument is
   398      * infinite, then the result is the same as the first argument.</ul>
   399      *
   400      * @param   f1   the dividend.
   401      * @param   f2   the divisor.
   402      * @return  the remainder when {@code f1} is divided by
   403      *          {@code f2}.
   404      */
   405     public static double IEEEremainder(double f1, double f2) {
   406         return f1 - (f2 * Math.round(f1 / f2));
   407     }
   408 
   409     /**
   410      * Returns the {@code double} value that is closest in value
   411      * to the argument and is equal to a mathematical integer. If two
   412      * {@code double} values that are mathematical integers are
   413      * equally close, the result is the integer value that is
   414      * even. Special cases:
   415      * <ul><li>If the argument value is already equal to a mathematical
   416      * integer, then the result is the same as the argument.
   417      * <li>If the argument is NaN or an infinity or positive zero or negative
   418      * zero, then the result is the same as the argument.</ul>
   419      *
   420      * @param   a   a {@code double} value.
   421      * @return  the closest floating-point value to {@code a} that is
   422      *          equal to a mathematical integer.
   423      */
   424     public static double rint(double a) {
   425         double ceil = ceil(a);
   426         double floor = floor(a);
   427         
   428         double dc = ceil - a;
   429         double df = a - floor;
   430         
   431         if (dc < df) {
   432             return ceil;
   433         } else if (dc > df) {
   434             return floor;
   435         }
   436         
   437         int tenC = (int) (ceil % 10.0);
   438         
   439         if (tenC % 2 == 0) {
   440             return ceil;
   441         } else {
   442             return floor;
   443         }
   444     }
   445 
   446     /**
   447      * Returns the angle <i>theta</i> from the conversion of rectangular
   448      * coordinates ({@code x},&nbsp;{@code y}) to polar
   449      * coordinates (r,&nbsp;<i>theta</i>).
   450      * This method computes the phase <i>theta</i> by computing an arc tangent
   451      * of {@code y/x} in the range of -<i>pi</i> to <i>pi</i>. Special
   452      * cases:
   453      * <ul><li>If either argument is NaN, then the result is NaN.
   454      * <li>If the first argument is positive zero and the second argument
   455      * is positive, or the first argument is positive and finite and the
   456      * second argument is positive infinity, then the result is positive
   457      * zero.
   458      * <li>If the first argument is negative zero and the second argument
   459      * is positive, or the first argument is negative and finite and the
   460      * second argument is positive infinity, then the result is negative zero.
   461      * <li>If the first argument is positive zero and the second argument
   462      * is negative, or the first argument is positive and finite and the
   463      * second argument is negative infinity, then the result is the
   464      * {@code double} value closest to <i>pi</i>.
   465      * <li>If the first argument is negative zero and the second argument
   466      * is negative, or the first argument is negative and finite and the
   467      * second argument is negative infinity, then the result is the
   468      * {@code double} value closest to -<i>pi</i>.
   469      * <li>If the first argument is positive and the second argument is
   470      * positive zero or negative zero, or the first argument is positive
   471      * infinity and the second argument is finite, then the result is the
   472      * {@code double} value closest to <i>pi</i>/2.
   473      * <li>If the first argument is negative and the second argument is
   474      * positive zero or negative zero, or the first argument is negative
   475      * infinity and the second argument is finite, then the result is the
   476      * {@code double} value closest to -<i>pi</i>/2.
   477      * <li>If both arguments are positive infinity, then the result is the
   478      * {@code double} value closest to <i>pi</i>/4.
   479      * <li>If the first argument is positive infinity and the second argument
   480      * is negative infinity, then the result is the {@code double}
   481      * value closest to 3*<i>pi</i>/4.
   482      * <li>If the first argument is negative infinity and the second argument
   483      * is positive infinity, then the result is the {@code double} value
   484      * closest to -<i>pi</i>/4.
   485      * <li>If both arguments are negative infinity, then the result is the
   486      * {@code double} value closest to -3*<i>pi</i>/4.</ul>
   487      *
   488      * <p>The computed result must be within 2 ulps of the exact result.
   489      * Results must be semi-monotonic.
   490      *
   491      * @param   y   the ordinate coordinate
   492      * @param   x   the abscissa coordinate
   493      * @return  the <i>theta</i> component of the point
   494      *          (<i>r</i>,&nbsp;<i>theta</i>)
   495      *          in polar coordinates that corresponds to the point
   496      *          (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates.
   497      */
   498     @JavaScriptBody(args={"y", "x"}, body="return Math.atan2(y, x);")
   499     public static double atan2(double y, double x) {
   500         throw new UnsupportedOperationException();
   501     }
   502 
   503     /**
   504      * Returns the value of the first argument raised to the power of the
   505      * second argument. Special cases:
   506      *
   507      * <ul><li>If the second argument is positive or negative zero, then the
   508      * result is 1.0.
   509      * <li>If the second argument is 1.0, then the result is the same as the
   510      * first argument.
   511      * <li>If the second argument is NaN, then the result is NaN.
   512      * <li>If the first argument is NaN and the second argument is nonzero,
   513      * then the result is NaN.
   514      *
   515      * <li>If
   516      * <ul>
   517      * <li>the absolute value of the first argument is greater than 1
   518      * and the second argument is positive infinity, or
   519      * <li>the absolute value of the first argument is less than 1 and
   520      * the second argument is negative infinity,
   521      * </ul>
   522      * then the result is positive infinity.
   523      *
   524      * <li>If
   525      * <ul>
   526      * <li>the absolute value of the first argument is greater than 1 and
   527      * the second argument is negative infinity, or
   528      * <li>the absolute value of the
   529      * first argument is less than 1 and the second argument is positive
   530      * infinity,
   531      * </ul>
   532      * then the result is positive zero.
   533      *
   534      * <li>If the absolute value of the first argument equals 1 and the
   535      * second argument is infinite, then the result is NaN.
   536      *
   537      * <li>If
   538      * <ul>
   539      * <li>the first argument is positive zero and the second argument
   540      * is greater than zero, or
   541      * <li>the first argument is positive infinity and the second
   542      * argument is less than zero,
   543      * </ul>
   544      * then the result is positive zero.
   545      *
   546      * <li>If
   547      * <ul>
   548      * <li>the first argument is positive zero and the second argument
   549      * is less than zero, or
   550      * <li>the first argument is positive infinity and the second
   551      * argument is greater than zero,
   552      * </ul>
   553      * then the result is positive infinity.
   554      *
   555      * <li>If
   556      * <ul>
   557      * <li>the first argument is negative zero and the second argument
   558      * is greater than zero but not a finite odd integer, or
   559      * <li>the first argument is negative infinity and the second
   560      * argument is less than zero but not a finite odd integer,
   561      * </ul>
   562      * then the result is positive zero.
   563      *
   564      * <li>If
   565      * <ul>
   566      * <li>the first argument is negative zero and the second argument
   567      * is a positive finite odd integer, or
   568      * <li>the first argument is negative infinity and the second
   569      * argument is a negative finite odd integer,
   570      * </ul>
   571      * then the result is negative zero.
   572      *
   573      * <li>If
   574      * <ul>
   575      * <li>the first argument is negative zero and the second argument
   576      * is less than zero but not a finite odd integer, or
   577      * <li>the first argument is negative infinity and the second
   578      * argument is greater than zero but not a finite odd integer,
   579      * </ul>
   580      * then the result is positive infinity.
   581      *
   582      * <li>If
   583      * <ul>
   584      * <li>the first argument is negative zero and the second argument
   585      * is a negative finite odd integer, or
   586      * <li>the first argument is negative infinity and the second
   587      * argument is a positive finite odd integer,
   588      * </ul>
   589      * then the result is negative infinity.
   590      *
   591      * <li>If the first argument is finite and less than zero
   592      * <ul>
   593      * <li> if the second argument is a finite even integer, the
   594      * result is equal to the result of raising the absolute value of
   595      * the first argument to the power of the second argument
   596      *
   597      * <li>if the second argument is a finite odd integer, the result
   598      * is equal to the negative of the result of raising the absolute
   599      * value of the first argument to the power of the second
   600      * argument
   601      *
   602      * <li>if the second argument is finite and not an integer, then
   603      * the result is NaN.
   604      * </ul>
   605      *
   606      * <li>If both arguments are integers, then the result is exactly equal
   607      * to the mathematical result of raising the first argument to the power
   608      * of the second argument if that result can in fact be represented
   609      * exactly as a {@code double} value.</ul>
   610      *
   611      * <p>(In the foregoing descriptions, a floating-point value is
   612      * considered to be an integer if and only if it is finite and a
   613      * fixed point of the method {@link #ceil ceil} or,
   614      * equivalently, a fixed point of the method {@link #floor
   615      * floor}. A value is a fixed point of a one-argument
   616      * method if and only if the result of applying the method to the
   617      * value is equal to the value.)
   618      *
   619      * <p>The computed result must be within 1 ulp of the exact result.
   620      * Results must be semi-monotonic.
   621      *
   622      * @param   a   the base.
   623      * @param   b   the exponent.
   624      * @return  the value {@code a}<sup>{@code b}</sup>.
   625      */
   626     @JavaScriptBody(args={"a", "b"}, body="return Math.pow(a, b);")
   627     public static double pow(double a, double b) {
   628         throw new UnsupportedOperationException();
   629     }
   630 
   631     /**
   632      * Returns the closest {@code int} to the argument, with ties
   633      * rounding up.
   634      *
   635      * <p>
   636      * Special cases:
   637      * <ul><li>If the argument is NaN, the result is 0.
   638      * <li>If the argument is negative infinity or any value less than or
   639      * equal to the value of {@code Integer.MIN_VALUE}, the result is
   640      * equal to the value of {@code Integer.MIN_VALUE}.
   641      * <li>If the argument is positive infinity or any value greater than or
   642      * equal to the value of {@code Integer.MAX_VALUE}, the result is
   643      * equal to the value of {@code Integer.MAX_VALUE}.</ul>
   644      *
   645      * @param   a   a floating-point value to be rounded to an integer.
   646      * @return  the value of the argument rounded to the nearest
   647      *          {@code int} value.
   648      * @see     java.lang.Integer#MAX_VALUE
   649      * @see     java.lang.Integer#MIN_VALUE
   650      */
   651     public static int round(float a) {
   652         return (int)roundDbl(a);
   653     }
   654 
   655     /**
   656      * Returns the closest {@code long} to the argument, with ties
   657      * rounding up.
   658      *
   659      * <p>Special cases:
   660      * <ul><li>If the argument is NaN, the result is 0.
   661      * <li>If the argument is negative infinity or any value less than or
   662      * equal to the value of {@code Long.MIN_VALUE}, the result is
   663      * equal to the value of {@code Long.MIN_VALUE}.
   664      * <li>If the argument is positive infinity or any value greater than or
   665      * equal to the value of {@code Long.MAX_VALUE}, the result is
   666      * equal to the value of {@code Long.MAX_VALUE}.</ul>
   667      *
   668      * @param   a   a floating-point value to be rounded to a
   669      *          {@code long}.
   670      * @return  the value of the argument rounded to the nearest
   671      *          {@code long} value.
   672      * @see     java.lang.Long#MAX_VALUE
   673      * @see     java.lang.Long#MIN_VALUE
   674      */
   675     public static long round(double a) {
   676         return (long)roundDbl(a);
   677     }
   678     
   679     @JavaScriptBody(args="a", body="return Math.round(a);")
   680     private static native double roundDbl(double d);
   681 
   682 //    private static Random randomNumberGenerator;
   683 //
   684 //    private static synchronized Random initRNG() {
   685 //        Random rnd = randomNumberGenerator;
   686 //        return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
   687 //    }
   688 
   689     /**
   690      * Returns a {@code double} value with a positive sign, greater
   691      * than or equal to {@code 0.0} and less than {@code 1.0}.
   692      * Returned values are chosen pseudorandomly with (approximately)
   693      * uniform distribution from that range.
   694      *
   695      * <p>When this method is first called, it creates a single new
   696      * pseudorandom-number generator, exactly as if by the expression
   697      *
   698      * <blockquote>{@code new java.util.Random()}</blockquote>
   699      *
   700      * This new pseudorandom-number generator is used thereafter for
   701      * all calls to this method and is used nowhere else.
   702      *
   703      * <p>This method is properly synchronized to allow correct use by
   704      * more than one thread. However, if many threads need to generate
   705      * pseudorandom numbers at a great rate, it may reduce contention
   706      * for each thread to have its own pseudorandom-number generator.
   707      *
   708      * @return  a pseudorandom {@code double} greater than or equal
   709      * to {@code 0.0} and less than {@code 1.0}.
   710      * @see Random#nextDouble()
   711      */
   712     @JavaScriptBody(args={}, body="return Math.random();")
   713     public static double random() {
   714         throw new UnsupportedOperationException();
   715     }
   716 
   717     /**
   718      * Returns the absolute value of an {@code int} value.
   719      * If the argument is not negative, the argument is returned.
   720      * If the argument is negative, the negation of the argument is returned.
   721      *
   722      * <p>Note that if the argument is equal to the value of
   723      * {@link Integer#MIN_VALUE}, the most negative representable
   724      * {@code int} value, the result is that same value, which is
   725      * negative.
   726      *
   727      * @param   a   the argument whose absolute value is to be determined
   728      * @return  the absolute value of the argument.
   729      */
   730     public static int abs(int a) {
   731         return (a < 0) ? -a : a;
   732     }
   733 
   734     /**
   735      * Returns the absolute value of a {@code long} value.
   736      * If the argument is not negative, the argument is returned.
   737      * If the argument is negative, the negation of the argument is returned.
   738      *
   739      * <p>Note that if the argument is equal to the value of
   740      * {@link Long#MIN_VALUE}, the most negative representable
   741      * {@code long} value, the result is that same value, which
   742      * is negative.
   743      *
   744      * @param   a   the argument whose absolute value is to be determined
   745      * @return  the absolute value of the argument.
   746      */
   747     public static long abs(long a) {
   748         return (a < 0) ? -a : a;
   749     }
   750 
   751     /**
   752      * Returns the absolute value of a {@code float} value.
   753      * If the argument is not negative, the argument is returned.
   754      * If the argument is negative, the negation of the argument is returned.
   755      * Special cases:
   756      * <ul><li>If the argument is positive zero or negative zero, the
   757      * result is positive zero.
   758      * <li>If the argument is infinite, the result is positive infinity.
   759      * <li>If the argument is NaN, the result is NaN.</ul>
   760      * In other words, the result is the same as the value of the expression:
   761      * <p>{@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))}
   762      *
   763      * @param   a   the argument whose absolute value is to be determined
   764      * @return  the absolute value of the argument.
   765      */
   766     public static float abs(float a) {
   767         return (a <= 0.0F) ? 0.0F - a : a;
   768     }
   769 
   770     /**
   771      * Returns the absolute value of a {@code double} value.
   772      * If the argument is not negative, the argument is returned.
   773      * If the argument is negative, the negation of the argument is returned.
   774      * Special cases:
   775      * <ul><li>If the argument is positive zero or negative zero, the result
   776      * is positive zero.
   777      * <li>If the argument is infinite, the result is positive infinity.
   778      * <li>If the argument is NaN, the result is NaN.</ul>
   779      * In other words, the result is the same as the value of the expression:
   780      * <p>{@code Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)}
   781      *
   782      * @param   a   the argument whose absolute value is to be determined
   783      * @return  the absolute value of the argument.
   784      */
   785     public static double abs(double a) {
   786         return (a <= 0.0D) ? 0.0D - a : a;
   787     }
   788 
   789     /**
   790      * Returns the greater of two {@code int} values. That is, the
   791      * result is the argument closer to the value of
   792      * {@link Integer#MAX_VALUE}. If the arguments have the same value,
   793      * the result is that same value.
   794      *
   795      * @param   a   an argument.
   796      * @param   b   another argument.
   797      * @return  the larger of {@code a} and {@code b}.
   798      */
   799     public static int max(int a, int b) {
   800         return (a >= b) ? a : b;
   801     }
   802 
   803     /**
   804      * Returns the greater of two {@code long} values. That is, the
   805      * result is the argument closer to the value of
   806      * {@link Long#MAX_VALUE}. If the arguments have the same value,
   807      * the result is that same value.
   808      *
   809      * @param   a   an argument.
   810      * @param   b   another argument.
   811      * @return  the larger of {@code a} and {@code b}.
   812      */
   813     public static long max(long a, long b) {
   814         return (a >= b) ? a : b;
   815     }
   816 
   817     /**
   818      * Returns the greater of two {@code float} values.  That is,
   819      * the result is the argument closer to positive infinity. If the
   820      * arguments have the same value, the result is that same
   821      * value. If either value is NaN, then the result is NaN.  Unlike
   822      * the numerical comparison operators, this method considers
   823      * negative zero to be strictly smaller than positive zero. If one
   824      * argument is positive zero and the other negative zero, the
   825      * result is positive zero.
   826      *
   827      * @param   a   an argument.
   828      * @param   b   another argument.
   829      * @return  the larger of {@code a} and {@code b}.
   830      */
   831     @JavaScriptBody(args={"a", "b"},
   832         body="return Math.max(a,b);"
   833     )
   834     public static float max(float a, float b) {
   835         throw new UnsupportedOperationException();
   836     }
   837 
   838     /**
   839      * Returns the greater of two {@code double} values.  That
   840      * is, the result is the argument closer to positive infinity. If
   841      * the arguments have the same value, the result is that same
   842      * value. If either value is NaN, then the result is NaN.  Unlike
   843      * the numerical comparison operators, this method considers
   844      * negative zero to be strictly smaller than positive zero. If one
   845      * argument is positive zero and the other negative zero, the
   846      * result is positive zero.
   847      *
   848      * @param   a   an argument.
   849      * @param   b   another argument.
   850      * @return  the larger of {@code a} and {@code b}.
   851      */
   852     @JavaScriptBody(args={"a", "b"},
   853         body="return Math.max(a,b);"
   854     )
   855     public static double max(double a, double b) {
   856         throw new UnsupportedOperationException();
   857     }
   858 
   859     /**
   860      * Returns the smaller of two {@code int} values. That is,
   861      * the result the argument closer to the value of
   862      * {@link Integer#MIN_VALUE}.  If the arguments have the same
   863      * value, the result is that same value.
   864      *
   865      * @param   a   an argument.
   866      * @param   b   another argument.
   867      * @return  the smaller of {@code a} and {@code b}.
   868      */
   869     public static int min(int a, int b) {
   870         return (a <= b) ? a : b;
   871     }
   872 
   873     /**
   874      * Returns the smaller of two {@code long} values. That is,
   875      * the result is the argument closer to the value of
   876      * {@link Long#MIN_VALUE}. If the arguments have the same
   877      * value, the result is that same value.
   878      *
   879      * @param   a   an argument.
   880      * @param   b   another argument.
   881      * @return  the smaller of {@code a} and {@code b}.
   882      */
   883     public static long min(long a, long b) {
   884         return (a <= b) ? a : b;
   885     }
   886 
   887     /**
   888      * Returns the smaller of two {@code float} values.  That is,
   889      * the result is the value closer to negative infinity. If the
   890      * arguments have the same value, the result is that same
   891      * value. If either value is NaN, then the result is NaN.  Unlike
   892      * the numerical comparison operators, this method considers
   893      * negative zero to be strictly smaller than positive zero.  If
   894      * one argument is positive zero and the other is negative zero,
   895      * the result is negative zero.
   896      *
   897      * @param   a   an argument.
   898      * @param   b   another argument.
   899      * @return  the smaller of {@code a} and {@code b}.
   900      */
   901     @JavaScriptBody(args={"a", "b"},
   902         body="return Math.min(a,b);"
   903     )
   904     public static float min(float a, float b) {
   905         throw new UnsupportedOperationException();
   906     }
   907 
   908     /**
   909      * Returns the smaller of two {@code double} values.  That
   910      * is, the result is the value closer to negative infinity. If the
   911      * arguments have the same value, the result is that same
   912      * value. If either value is NaN, then the result is NaN.  Unlike
   913      * the numerical comparison operators, this method considers
   914      * negative zero to be strictly smaller than positive zero. If one
   915      * argument is positive zero and the other is negative zero, the
   916      * result is negative zero.
   917      *
   918      * @param   a   an argument.
   919      * @param   b   another argument.
   920      * @return  the smaller of {@code a} and {@code b}.
   921      */
   922     @JavaScriptBody(args={"a", "b"},
   923         body="return Math.min(a,b);"
   924     )
   925     public static double min(double a, double b) {
   926         throw new UnsupportedOperationException();
   927     }
   928 
   929     /**
   930      * Returns the size of an ulp of the argument.  An ulp of a
   931      * {@code double} value is the positive distance between this
   932      * floating-point value and the {@code double} value next
   933      * larger in magnitude.  Note that for non-NaN <i>x</i>,
   934      * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
   935      *
   936      * <p>Special Cases:
   937      * <ul>
   938      * <li> If the argument is NaN, then the result is NaN.
   939      * <li> If the argument is positive or negative infinity, then the
   940      * result is positive infinity.
   941      * <li> If the argument is positive or negative zero, then the result is
   942      * {@code Double.MIN_VALUE}.
   943      * <li> If the argument is &plusmn;{@code Double.MAX_VALUE}, then
   944      * the result is equal to 2<sup>971</sup>.
   945      * </ul>
   946      *
   947      * @param d the floating-point value whose ulp is to be returned
   948      * @return the size of an ulp of the argument
   949      * @author Joseph D. Darcy
   950      * @since 1.5
   951      */
   952 //    public static double ulp(double d) {
   953 //        return sun.misc.FpUtils.ulp(d);
   954 //    }
   955 
   956     /**
   957      * Returns the size of an ulp of the argument.  An ulp of a
   958      * {@code float} value is the positive distance between this
   959      * floating-point value and the {@code float} value next
   960      * larger in magnitude.  Note that for non-NaN <i>x</i>,
   961      * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
   962      *
   963      * <p>Special Cases:
   964      * <ul>
   965      * <li> If the argument is NaN, then the result is NaN.
   966      * <li> If the argument is positive or negative infinity, then the
   967      * result is positive infinity.
   968      * <li> If the argument is positive or negative zero, then the result is
   969      * {@code Float.MIN_VALUE}.
   970      * <li> If the argument is &plusmn;{@code Float.MAX_VALUE}, then
   971      * the result is equal to 2<sup>104</sup>.
   972      * </ul>
   973      *
   974      * @param f the floating-point value whose ulp is to be returned
   975      * @return the size of an ulp of the argument
   976      * @author Joseph D. Darcy
   977      * @since 1.5
   978      */
   979 //    public static float ulp(float f) {
   980 //        return sun.misc.FpUtils.ulp(f);
   981 //    }
   982 
   983     /**
   984      * Returns the signum function of the argument; zero if the argument
   985      * is zero, 1.0 if the argument is greater than zero, -1.0 if the
   986      * argument is less than zero.
   987      *
   988      * <p>Special Cases:
   989      * <ul>
   990      * <li> If the argument is NaN, then the result is NaN.
   991      * <li> If the argument is positive zero or negative zero, then the
   992      *      result is the same as the argument.
   993      * </ul>
   994      *
   995      * @param d the floating-point value whose signum is to be returned
   996      * @return the signum function of the argument
   997      * @author Joseph D. Darcy
   998      * @since 1.5
   999      */
  1000     public static double signum(double d) {
  1001         if (d < 0.0) { return -1.0; }
  1002         if (d > 0.0) { return 1.0; }
  1003         return d;
  1004     }
  1005 
  1006     /**
  1007      * Returns the signum function of the argument; zero if the argument
  1008      * is zero, 1.0f if the argument is greater than zero, -1.0f if the
  1009      * argument is less than zero.
  1010      *
  1011      * <p>Special Cases:
  1012      * <ul>
  1013      * <li> If the argument is NaN, then the result is NaN.
  1014      * <li> If the argument is positive zero or negative zero, then the
  1015      *      result is the same as the argument.
  1016      * </ul>
  1017      *
  1018      * @param f the floating-point value whose signum is to be returned
  1019      * @return the signum function of the argument
  1020      * @author Joseph D. Darcy
  1021      * @since 1.5
  1022      */
  1023     public static float signum(float f) {
  1024         if (f < 0.0f) { return -1.0f; }
  1025         if (f > 0.0f) { return 1.0f; }
  1026         return f;
  1027     }
  1028 
  1029     /**
  1030      * Returns the first floating-point argument with the sign of the
  1031      * second floating-point argument.  Note that unlike the {@link
  1032      * StrictMath#copySign(double, double) StrictMath.copySign}
  1033      * method, this method does not require NaN {@code sign}
  1034      * arguments to be treated as positive values; implementations are
  1035      * permitted to treat some NaN arguments as positive and other NaN
  1036      * arguments as negative to allow greater performance.
  1037      *
  1038      * @param magnitude  the parameter providing the magnitude of the result
  1039      * @param sign   the parameter providing the sign of the result
  1040      * @return a value with the magnitude of {@code magnitude}
  1041      * and the sign of {@code sign}.
  1042      * @since 1.6
  1043      */
  1044 //    public static double copySign(double magnitude, double sign) {
  1045 //        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
  1046 //    }
  1047 
  1048     /**
  1049      * Returns the first floating-point argument with the sign of the
  1050      * second floating-point argument.  Note that unlike the {@link
  1051      * StrictMath#copySign(float, float) StrictMath.copySign}
  1052      * method, this method does not require NaN {@code sign}
  1053      * arguments to be treated as positive values; implementations are
  1054      * permitted to treat some NaN arguments as positive and other NaN
  1055      * arguments as negative to allow greater performance.
  1056      *
  1057      * @param magnitude  the parameter providing the magnitude of the result
  1058      * @param sign   the parameter providing the sign of the result
  1059      * @return a value with the magnitude of {@code magnitude}
  1060      * and the sign of {@code sign}.
  1061      * @since 1.6
  1062      */
  1063 //    public static float copySign(float magnitude, float sign) {
  1064 //        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
  1065 //    }
  1066 
  1067     /**
  1068      * Returns the unbiased exponent used in the representation of a
  1069      * {@code float}.  Special cases:
  1070      *
  1071      * <ul>
  1072      * <li>If the argument is NaN or infinite, then the result is
  1073      * {@link Float#MAX_EXPONENT} + 1.
  1074      * <li>If the argument is zero or subnormal, then the result is
  1075      * {@link Float#MIN_EXPONENT} -1.
  1076      * </ul>
  1077      * @param f a {@code float} value
  1078      * @return the unbiased exponent of the argument
  1079      * @since 1.6
  1080      */
  1081 //    public static int getExponent(float f) {
  1082 //        return sun.misc.FpUtils.getExponent(f);
  1083 //    }
  1084 
  1085     /**
  1086      * Returns the unbiased exponent used in the representation of a
  1087      * {@code double}.  Special cases:
  1088      *
  1089      * <ul>
  1090      * <li>If the argument is NaN or infinite, then the result is
  1091      * {@link Double#MAX_EXPONENT} + 1.
  1092      * <li>If the argument is zero or subnormal, then the result is
  1093      * {@link Double#MIN_EXPONENT} -1.
  1094      * </ul>
  1095      * @param d a {@code double} value
  1096      * @return the unbiased exponent of the argument
  1097      * @since 1.6
  1098      */
  1099 //    public static int getExponent(double d) {
  1100 //        return sun.misc.FpUtils.getExponent(d);
  1101 //    }
  1102 
  1103     /**
  1104      * Returns the floating-point number adjacent to the first
  1105      * argument in the direction of the second argument.  If both
  1106      * arguments compare as equal the second argument is returned.
  1107      *
  1108      * <p>
  1109      * Special cases:
  1110      * <ul>
  1111      * <li> If either argument is a NaN, then NaN is returned.
  1112      *
  1113      * <li> If both arguments are signed zeros, {@code direction}
  1114      * is returned unchanged (as implied by the requirement of
  1115      * returning the second argument if the arguments compare as
  1116      * equal).
  1117      *
  1118      * <li> If {@code start} is
  1119      * &plusmn;{@link Double#MIN_VALUE} and {@code direction}
  1120      * has a value such that the result should have a smaller
  1121      * magnitude, then a zero with the same sign as {@code start}
  1122      * is returned.
  1123      *
  1124      * <li> If {@code start} is infinite and
  1125      * {@code direction} has a value such that the result should
  1126      * have a smaller magnitude, {@link Double#MAX_VALUE} with the
  1127      * same sign as {@code start} is returned.
  1128      *
  1129      * <li> If {@code start} is equal to &plusmn;
  1130      * {@link Double#MAX_VALUE} and {@code direction} has a
  1131      * value such that the result should have a larger magnitude, an
  1132      * infinity with same sign as {@code start} is returned.
  1133      * </ul>
  1134      *
  1135      * @param start  starting floating-point value
  1136      * @param direction value indicating which of
  1137      * {@code start}'s neighbors or {@code start} should
  1138      * be returned
  1139      * @return The floating-point number adjacent to {@code start} in the
  1140      * direction of {@code direction}.
  1141      * @since 1.6
  1142      */
  1143 //    public static double nextAfter(double start, double direction) {
  1144 //        return sun.misc.FpUtils.nextAfter(start, direction);
  1145 //    }
  1146 
  1147     /**
  1148      * Returns the floating-point number adjacent to the first
  1149      * argument in the direction of the second argument.  If both
  1150      * arguments compare as equal a value equivalent to the second argument
  1151      * is returned.
  1152      *
  1153      * <p>
  1154      * Special cases:
  1155      * <ul>
  1156      * <li> If either argument is a NaN, then NaN is returned.
  1157      *
  1158      * <li> If both arguments are signed zeros, a value equivalent
  1159      * to {@code direction} is returned.
  1160      *
  1161      * <li> If {@code start} is
  1162      * &plusmn;{@link Float#MIN_VALUE} and {@code direction}
  1163      * has a value such that the result should have a smaller
  1164      * magnitude, then a zero with the same sign as {@code start}
  1165      * is returned.
  1166      *
  1167      * <li> If {@code start} is infinite and
  1168      * {@code direction} has a value such that the result should
  1169      * have a smaller magnitude, {@link Float#MAX_VALUE} with the
  1170      * same sign as {@code start} is returned.
  1171      *
  1172      * <li> If {@code start} is equal to &plusmn;
  1173      * {@link Float#MAX_VALUE} and {@code direction} has a
  1174      * value such that the result should have a larger magnitude, an
  1175      * infinity with same sign as {@code start} is returned.
  1176      * </ul>
  1177      *
  1178      * @param start  starting floating-point value
  1179      * @param direction value indicating which of
  1180      * {@code start}'s neighbors or {@code start} should
  1181      * be returned
  1182      * @return The floating-point number adjacent to {@code start} in the
  1183      * direction of {@code direction}.
  1184      * @since 1.6
  1185      */
  1186 //    public static float nextAfter(float start, double direction) {
  1187 //        return sun.misc.FpUtils.nextAfter(start, direction);
  1188 //    }
  1189 
  1190     /**
  1191      * Returns the floating-point value adjacent to {@code d} in
  1192      * the direction of positive infinity.  This method is
  1193      * semantically equivalent to {@code nextAfter(d,
  1194      * Double.POSITIVE_INFINITY)}; however, a {@code nextUp}
  1195      * implementation may run faster than its equivalent
  1196      * {@code nextAfter} call.
  1197      *
  1198      * <p>Special Cases:
  1199      * <ul>
  1200      * <li> If the argument is NaN, the result is NaN.
  1201      *
  1202      * <li> If the argument is positive infinity, the result is
  1203      * positive infinity.
  1204      *
  1205      * <li> If the argument is zero, the result is
  1206      * {@link Double#MIN_VALUE}
  1207      *
  1208      * </ul>
  1209      *
  1210      * @param d starting floating-point value
  1211      * @return The adjacent floating-point value closer to positive
  1212      * infinity.
  1213      * @since 1.6
  1214      */
  1215 //    public static double nextUp(double d) {
  1216 //        return sun.misc.FpUtils.nextUp(d);
  1217 //    }
  1218 
  1219     /**
  1220      * Returns the floating-point value adjacent to {@code f} in
  1221      * the direction of positive infinity.  This method is
  1222      * semantically equivalent to {@code nextAfter(f,
  1223      * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
  1224      * implementation may run faster than its equivalent
  1225      * {@code nextAfter} call.
  1226      *
  1227      * <p>Special Cases:
  1228      * <ul>
  1229      * <li> If the argument is NaN, the result is NaN.
  1230      *
  1231      * <li> If the argument is positive infinity, the result is
  1232      * positive infinity.
  1233      *
  1234      * <li> If the argument is zero, the result is
  1235      * {@link Float#MIN_VALUE}
  1236      *
  1237      * </ul>
  1238      *
  1239      * @param f starting floating-point value
  1240      * @return The adjacent floating-point value closer to positive
  1241      * infinity.
  1242      * @since 1.6
  1243      */
  1244 //    public static float nextUp(float f) {
  1245 //        return sun.misc.FpUtils.nextUp(f);
  1246 //    }
  1247 
  1248 
  1249     /**
  1250      * Return {@code d} &times;
  1251      * 2<sup>{@code scaleFactor}</sup> rounded as if performed
  1252      * by a single correctly rounded floating-point multiply to a
  1253      * member of the double value set.  See the Java
  1254      * Language Specification for a discussion of floating-point
  1255      * value sets.  If the exponent of the result is between {@link
  1256      * Double#MIN_EXPONENT} and {@link Double#MAX_EXPONENT}, the
  1257      * answer is calculated exactly.  If the exponent of the result
  1258      * would be larger than {@code Double.MAX_EXPONENT}, an
  1259      * infinity is returned.  Note that if the result is subnormal,
  1260      * precision may be lost; that is, when {@code scalb(x, n)}
  1261      * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
  1262      * <i>x</i>.  When the result is non-NaN, the result has the same
  1263      * sign as {@code d}.
  1264      *
  1265      * <p>Special cases:
  1266      * <ul>
  1267      * <li> If the first argument is NaN, NaN is returned.
  1268      * <li> If the first argument is infinite, then an infinity of the
  1269      * same sign is returned.
  1270      * <li> If the first argument is zero, then a zero of the same
  1271      * sign is returned.
  1272      * </ul>
  1273      *
  1274      * @param d number to be scaled by a power of two.
  1275      * @param scaleFactor power of 2 used to scale {@code d}
  1276      * @return {@code d} &times; 2<sup>{@code scaleFactor}</sup>
  1277      * @since 1.6
  1278      */
  1279 //    public static double scalb(double d, int scaleFactor) {
  1280 //        return sun.misc.FpUtils.scalb(d, scaleFactor);
  1281 //    }
  1282 
  1283     /**
  1284      * Return {@code f} &times;
  1285      * 2<sup>{@code scaleFactor}</sup> rounded as if performed
  1286      * by a single correctly rounded floating-point multiply to a
  1287      * member of the float value set.  See the Java
  1288      * Language Specification for a discussion of floating-point
  1289      * value sets.  If the exponent of the result is between {@link
  1290      * Float#MIN_EXPONENT} and {@link Float#MAX_EXPONENT}, the
  1291      * answer is calculated exactly.  If the exponent of the result
  1292      * would be larger than {@code Float.MAX_EXPONENT}, an
  1293      * infinity is returned.  Note that if the result is subnormal,
  1294      * precision may be lost; that is, when {@code scalb(x, n)}
  1295      * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
  1296      * <i>x</i>.  When the result is non-NaN, the result has the same
  1297      * sign as {@code f}.
  1298      *
  1299      * <p>Special cases:
  1300      * <ul>
  1301      * <li> If the first argument is NaN, NaN is returned.
  1302      * <li> If the first argument is infinite, then an infinity of the
  1303      * same sign is returned.
  1304      * <li> If the first argument is zero, then a zero of the same
  1305      * sign is returned.
  1306      * </ul>
  1307      *
  1308      * @param f number to be scaled by a power of two.
  1309      * @param scaleFactor power of 2 used to scale {@code f}
  1310      * @return {@code f} &times; 2<sup>{@code scaleFactor}</sup>
  1311      * @since 1.6
  1312      */
  1313 //    public static float scalb(float f, int scaleFactor) {
  1314 //        return sun.misc.FpUtils.scalb(f, scaleFactor);
  1315 //    }
  1316 }