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