emul/mini/src/main/java/java/lang/Math.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 26 Jan 2013 08:47:05 +0100
changeset 592 5e13b1ac2886
parent 551 ca781bc82662
child 600 4ff4e27465e0
permissions -rw-r--r--
In order to support fields of the same name in subclasses we are now prefixing them with name of the class that defines them. To provide convenient way to access them from generated bytecode and also directly from JavaScript, there is a getter/setter function for each field. It starts with _ followed by the field name. If called with a parameter, it sets the field, with a parameter it just returns it.
     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     /**
   380      * Returns the angle <i>theta</i> from the conversion of rectangular
   381      * coordinates ({@code x},&nbsp;{@code y}) to polar
   382      * coordinates (r,&nbsp;<i>theta</i>).
   383      * This method computes the phase <i>theta</i> by computing an arc tangent
   384      * of {@code y/x} in the range of -<i>pi</i> to <i>pi</i>. Special
   385      * cases:
   386      * <ul><li>If either argument is NaN, then the result is NaN.
   387      * <li>If the first argument is positive zero and the second argument
   388      * is positive, or the first argument is positive and finite and the
   389      * second argument is positive infinity, then the result is positive
   390      * zero.
   391      * <li>If the first argument is negative zero and the second argument
   392      * is positive, or the first argument is negative and finite and the
   393      * second argument is positive infinity, then the result is negative zero.
   394      * <li>If the first argument is positive zero and the second argument
   395      * is negative, or the first argument is positive and finite and the
   396      * second argument is negative infinity, then the result is the
   397      * {@code double} value closest to <i>pi</i>.
   398      * <li>If the first argument is negative zero and the second argument
   399      * is negative, or the first argument is negative and finite and the
   400      * second argument is negative infinity, then the result is the
   401      * {@code double} value closest to -<i>pi</i>.
   402      * <li>If the first argument is positive and the second argument is
   403      * positive zero or negative zero, or the first argument is positive
   404      * infinity and the second argument is finite, then the result is the
   405      * {@code double} value closest to <i>pi</i>/2.
   406      * <li>If the first argument is negative and the second argument is
   407      * positive zero or negative zero, or the first argument is negative
   408      * infinity and the second argument is finite, then the result is the
   409      * {@code double} value closest to -<i>pi</i>/2.
   410      * <li>If both arguments are positive infinity, then the result is the
   411      * {@code double} value closest to <i>pi</i>/4.
   412      * <li>If the first argument is positive infinity and the second argument
   413      * is negative infinity, then the result is the {@code double}
   414      * value closest to 3*<i>pi</i>/4.
   415      * <li>If the first argument is negative infinity and the second argument
   416      * is positive infinity, then the result is the {@code double} value
   417      * closest to -<i>pi</i>/4.
   418      * <li>If both arguments are negative infinity, then the result is the
   419      * {@code double} value closest to -3*<i>pi</i>/4.</ul>
   420      *
   421      * <p>The computed result must be within 2 ulps of the exact result.
   422      * Results must be semi-monotonic.
   423      *
   424      * @param   y   the ordinate coordinate
   425      * @param   x   the abscissa coordinate
   426      * @return  the <i>theta</i> component of the point
   427      *          (<i>r</i>,&nbsp;<i>theta</i>)
   428      *          in polar coordinates that corresponds to the point
   429      *          (<i>x</i>,&nbsp;<i>y</i>) in Cartesian coordinates.
   430      */
   431     @JavaScriptBody(args={"y", "x"}, body="return Math.atan2(y, x);")
   432     public static double atan2(double y, double x) {
   433         throw new UnsupportedOperationException();
   434     }
   435 
   436     /**
   437      * Returns the value of the first argument raised to the power of the
   438      * second argument. Special cases:
   439      *
   440      * <ul><li>If the second argument is positive or negative zero, then the
   441      * result is 1.0.
   442      * <li>If the second argument is 1.0, then the result is the same as the
   443      * first argument.
   444      * <li>If the second argument is NaN, then the result is NaN.
   445      * <li>If the first argument is NaN and the second argument is nonzero,
   446      * then the result is NaN.
   447      *
   448      * <li>If
   449      * <ul>
   450      * <li>the absolute value of the first argument is greater than 1
   451      * and the second argument is positive infinity, or
   452      * <li>the absolute value of the first argument is less than 1 and
   453      * the second argument is negative infinity,
   454      * </ul>
   455      * then the result is positive infinity.
   456      *
   457      * <li>If
   458      * <ul>
   459      * <li>the absolute value of the first argument is greater than 1 and
   460      * the second argument is negative infinity, or
   461      * <li>the absolute value of the
   462      * first argument is less than 1 and the second argument is positive
   463      * infinity,
   464      * </ul>
   465      * then the result is positive zero.
   466      *
   467      * <li>If the absolute value of the first argument equals 1 and the
   468      * second argument is infinite, then the result is NaN.
   469      *
   470      * <li>If
   471      * <ul>
   472      * <li>the first argument is positive zero and the second argument
   473      * is greater than zero, or
   474      * <li>the first argument is positive infinity and the second
   475      * argument is less than zero,
   476      * </ul>
   477      * then the result is positive zero.
   478      *
   479      * <li>If
   480      * <ul>
   481      * <li>the first argument is positive zero and the second argument
   482      * is less than zero, or
   483      * <li>the first argument is positive infinity and the second
   484      * argument is greater than zero,
   485      * </ul>
   486      * then the result is positive infinity.
   487      *
   488      * <li>If
   489      * <ul>
   490      * <li>the first argument is negative zero and the second argument
   491      * is greater than zero but not a finite odd integer, or
   492      * <li>the first argument is negative infinity and the second
   493      * argument is less than zero but not a finite odd integer,
   494      * </ul>
   495      * then the result is positive zero.
   496      *
   497      * <li>If
   498      * <ul>
   499      * <li>the first argument is negative zero and the second argument
   500      * is a positive finite odd integer, or
   501      * <li>the first argument is negative infinity and the second
   502      * argument is a negative finite odd integer,
   503      * </ul>
   504      * then the result is negative zero.
   505      *
   506      * <li>If
   507      * <ul>
   508      * <li>the first argument is negative zero and the second argument
   509      * is less than zero but not a finite odd integer, or
   510      * <li>the first argument is negative infinity and the second
   511      * argument is greater than zero but not a finite odd integer,
   512      * </ul>
   513      * then the result is positive infinity.
   514      *
   515      * <li>If
   516      * <ul>
   517      * <li>the first argument is negative zero and the second argument
   518      * is a negative finite odd integer, or
   519      * <li>the first argument is negative infinity and the second
   520      * argument is a positive finite odd integer,
   521      * </ul>
   522      * then the result is negative infinity.
   523      *
   524      * <li>If the first argument is finite and less than zero
   525      * <ul>
   526      * <li> if the second argument is a finite even integer, the
   527      * result is equal to the result of raising the absolute value of
   528      * the first argument to the power of the second argument
   529      *
   530      * <li>if the second argument is a finite odd integer, the result
   531      * is equal to the negative of the result of raising the absolute
   532      * value of the first argument to the power of the second
   533      * argument
   534      *
   535      * <li>if the second argument is finite and not an integer, then
   536      * the result is NaN.
   537      * </ul>
   538      *
   539      * <li>If both arguments are integers, then the result is exactly equal
   540      * to the mathematical result of raising the first argument to the power
   541      * of the second argument if that result can in fact be represented
   542      * exactly as a {@code double} value.</ul>
   543      *
   544      * <p>(In the foregoing descriptions, a floating-point value is
   545      * considered to be an integer if and only if it is finite and a
   546      * fixed point of the method {@link #ceil ceil} or,
   547      * equivalently, a fixed point of the method {@link #floor
   548      * floor}. A value is a fixed point of a one-argument
   549      * method if and only if the result of applying the method to the
   550      * value is equal to the value.)
   551      *
   552      * <p>The computed result must be within 1 ulp of the exact result.
   553      * Results must be semi-monotonic.
   554      *
   555      * @param   a   the base.
   556      * @param   b   the exponent.
   557      * @return  the value {@code a}<sup>{@code b}</sup>.
   558      */
   559     @JavaScriptBody(args={"a", "b"}, body="return Math.pow(a, b);")
   560     public static double pow(double a, double b) {
   561         throw new UnsupportedOperationException();
   562     }
   563 
   564     /**
   565      * Returns the closest {@code int} to the argument, with ties
   566      * rounding up.
   567      *
   568      * <p>
   569      * Special cases:
   570      * <ul><li>If the argument is NaN, the result is 0.
   571      * <li>If the argument is negative infinity or any value less than or
   572      * equal to the value of {@code Integer.MIN_VALUE}, the result is
   573      * equal to the value of {@code Integer.MIN_VALUE}.
   574      * <li>If the argument is positive infinity or any value greater than or
   575      * equal to the value of {@code Integer.MAX_VALUE}, the result is
   576      * equal to the value of {@code Integer.MAX_VALUE}.</ul>
   577      *
   578      * @param   a   a floating-point value to be rounded to an integer.
   579      * @return  the value of the argument rounded to the nearest
   580      *          {@code int} value.
   581      * @see     java.lang.Integer#MAX_VALUE
   582      * @see     java.lang.Integer#MIN_VALUE
   583      */
   584     @JavaScriptBody(args="a", body="return Math.round(a);")
   585     public static int round(float a) {
   586         throw new UnsupportedOperationException();
   587     }
   588 
   589     /**
   590      * Returns the closest {@code long} to the argument, with ties
   591      * rounding up.
   592      *
   593      * <p>Special cases:
   594      * <ul><li>If the argument is NaN, the result is 0.
   595      * <li>If the argument is negative infinity or any value less than or
   596      * equal to the value of {@code Long.MIN_VALUE}, the result is
   597      * equal to the value of {@code Long.MIN_VALUE}.
   598      * <li>If the argument is positive infinity or any value greater than or
   599      * equal to the value of {@code Long.MAX_VALUE}, the result is
   600      * equal to the value of {@code Long.MAX_VALUE}.</ul>
   601      *
   602      * @param   a   a floating-point value to be rounded to a
   603      *          {@code long}.
   604      * @return  the value of the argument rounded to the nearest
   605      *          {@code long} value.
   606      * @see     java.lang.Long#MAX_VALUE
   607      * @see     java.lang.Long#MIN_VALUE
   608      */
   609     @JavaScriptBody(args="a", body="return Math.round(a);")
   610     public static long round(double a) {
   611         throw new UnsupportedOperationException();
   612     }
   613 
   614 //    private static Random randomNumberGenerator;
   615 //
   616 //    private static synchronized Random initRNG() {
   617 //        Random rnd = randomNumberGenerator;
   618 //        return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
   619 //    }
   620 
   621     /**
   622      * Returns a {@code double} value with a positive sign, greater
   623      * than or equal to {@code 0.0} and less than {@code 1.0}.
   624      * Returned values are chosen pseudorandomly with (approximately)
   625      * uniform distribution from that range.
   626      *
   627      * <p>When this method is first called, it creates a single new
   628      * pseudorandom-number generator, exactly as if by the expression
   629      *
   630      * <blockquote>{@code new java.util.Random()}</blockquote>
   631      *
   632      * This new pseudorandom-number generator is used thereafter for
   633      * all calls to this method and is used nowhere else.
   634      *
   635      * <p>This method is properly synchronized to allow correct use by
   636      * more than one thread. However, if many threads need to generate
   637      * pseudorandom numbers at a great rate, it may reduce contention
   638      * for each thread to have its own pseudorandom-number generator.
   639      *
   640      * @return  a pseudorandom {@code double} greater than or equal
   641      * to {@code 0.0} and less than {@code 1.0}.
   642      * @see Random#nextDouble()
   643      */
   644     @JavaScriptBody(args={}, body="return Math.random();")
   645     public static double random() {
   646         throw new UnsupportedOperationException();
   647     }
   648 
   649     /**
   650      * Returns the absolute value of an {@code int} value.
   651      * If the argument is not negative, the argument is returned.
   652      * If the argument is negative, the negation of the argument is returned.
   653      *
   654      * <p>Note that if the argument is equal to the value of
   655      * {@link Integer#MIN_VALUE}, the most negative representable
   656      * {@code int} value, the result is that same value, which is
   657      * negative.
   658      *
   659      * @param   a   the argument whose absolute value is to be determined
   660      * @return  the absolute value of the argument.
   661      */
   662     public static int abs(int a) {
   663         return (a < 0) ? -a : a;
   664     }
   665 
   666     /**
   667      * Returns the absolute value of a {@code long} value.
   668      * If the argument is not negative, the argument is returned.
   669      * If the argument is negative, the negation of the argument is returned.
   670      *
   671      * <p>Note that if the argument is equal to the value of
   672      * {@link Long#MIN_VALUE}, the most negative representable
   673      * {@code long} value, the result is that same value, which
   674      * is negative.
   675      *
   676      * @param   a   the argument whose absolute value is to be determined
   677      * @return  the absolute value of the argument.
   678      */
   679     public static long abs(long a) {
   680         return (a < 0) ? -a : a;
   681     }
   682 
   683     /**
   684      * Returns the absolute value of a {@code float} value.
   685      * If the argument is not negative, the argument is returned.
   686      * If the argument is negative, the negation of the argument is returned.
   687      * Special cases:
   688      * <ul><li>If the argument is positive zero or negative zero, the
   689      * result is positive zero.
   690      * <li>If the argument is infinite, the result is positive infinity.
   691      * <li>If the argument is NaN, the result is NaN.</ul>
   692      * In other words, the result is the same as the value of the expression:
   693      * <p>{@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))}
   694      *
   695      * @param   a   the argument whose absolute value is to be determined
   696      * @return  the absolute value of the argument.
   697      */
   698     public static float abs(float a) {
   699         return (a <= 0.0F) ? 0.0F - a : a;
   700     }
   701 
   702     /**
   703      * Returns the absolute value of a {@code double} value.
   704      * If the argument is not negative, the argument is returned.
   705      * If the argument is negative, the negation of the argument is returned.
   706      * Special cases:
   707      * <ul><li>If the argument is positive zero or negative zero, the result
   708      * is positive zero.
   709      * <li>If the argument is infinite, the result is positive infinity.
   710      * <li>If the argument is NaN, the result is NaN.</ul>
   711      * In other words, the result is the same as the value of the expression:
   712      * <p>{@code Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)}
   713      *
   714      * @param   a   the argument whose absolute value is to be determined
   715      * @return  the absolute value of the argument.
   716      */
   717     public static double abs(double a) {
   718         return (a <= 0.0D) ? 0.0D - a : a;
   719     }
   720 
   721     /**
   722      * Returns the greater of two {@code int} values. That is, the
   723      * result is the argument closer to the value of
   724      * {@link Integer#MAX_VALUE}. If the arguments have the same value,
   725      * the result is that same value.
   726      *
   727      * @param   a   an argument.
   728      * @param   b   another argument.
   729      * @return  the larger of {@code a} and {@code b}.
   730      */
   731     public static int max(int a, int b) {
   732         return (a >= b) ? a : b;
   733     }
   734 
   735     /**
   736      * Returns the greater of two {@code long} values. That is, the
   737      * result is the argument closer to the value of
   738      * {@link Long#MAX_VALUE}. If the arguments have the same value,
   739      * the result is that same value.
   740      *
   741      * @param   a   an argument.
   742      * @param   b   another argument.
   743      * @return  the larger of {@code a} and {@code b}.
   744      */
   745     public static long max(long a, long b) {
   746         return (a >= b) ? a : b;
   747     }
   748 
   749     /**
   750      * Returns the greater of two {@code float} values.  That is,
   751      * the result is the argument closer to positive infinity. If the
   752      * arguments have the same value, the result is that same
   753      * value. If either value is NaN, then the result is NaN.  Unlike
   754      * the numerical comparison operators, this method considers
   755      * negative zero to be strictly smaller than positive zero. If one
   756      * argument is positive zero and the other negative zero, the
   757      * result is positive zero.
   758      *
   759      * @param   a   an argument.
   760      * @param   b   another argument.
   761      * @return  the larger of {@code a} and {@code b}.
   762      */
   763     @JavaScriptBody(args={"a", "b"},
   764         body="return Math.max(a,b);"
   765     )
   766     public static float max(float a, float b) {
   767         throw new UnsupportedOperationException();
   768     }
   769 
   770     /**
   771      * Returns the greater of two {@code double} values.  That
   772      * is, the result is the argument closer to positive infinity. If
   773      * the arguments have the same value, the result is that same
   774      * value. If either value is NaN, then the result is NaN.  Unlike
   775      * the numerical comparison operators, this method considers
   776      * negative zero to be strictly smaller than positive zero. If one
   777      * argument is positive zero and the other negative zero, the
   778      * result is positive zero.
   779      *
   780      * @param   a   an argument.
   781      * @param   b   another argument.
   782      * @return  the larger of {@code a} and {@code b}.
   783      */
   784     @JavaScriptBody(args={"a", "b"},
   785         body="return Math.max(a,b);"
   786     )
   787     public static double max(double a, double b) {
   788         throw new UnsupportedOperationException();
   789     }
   790 
   791     /**
   792      * Returns the smaller of two {@code int} values. That is,
   793      * the result the argument closer to the value of
   794      * {@link Integer#MIN_VALUE}.  If the arguments have the same
   795      * value, the result is that same value.
   796      *
   797      * @param   a   an argument.
   798      * @param   b   another argument.
   799      * @return  the smaller of {@code a} and {@code b}.
   800      */
   801     public static int min(int a, int b) {
   802         return (a <= b) ? a : b;
   803     }
   804 
   805     /**
   806      * Returns the smaller of two {@code long} values. That is,
   807      * the result is the argument closer to the value of
   808      * {@link Long#MIN_VALUE}. If the arguments have the same
   809      * value, the result is that same value.
   810      *
   811      * @param   a   an argument.
   812      * @param   b   another argument.
   813      * @return  the smaller of {@code a} and {@code b}.
   814      */
   815     public static long min(long a, long b) {
   816         return (a <= b) ? a : b;
   817     }
   818 
   819     /**
   820      * Returns the smaller of two {@code float} values.  That is,
   821      * the result is the value closer to negative infinity. If the
   822      * arguments have the same value, the result is that same
   823      * value. If either value is NaN, then the result is NaN.  Unlike
   824      * the numerical comparison operators, this method considers
   825      * negative zero to be strictly smaller than positive zero.  If
   826      * one argument is positive zero and the other is negative zero,
   827      * the result is negative zero.
   828      *
   829      * @param   a   an argument.
   830      * @param   b   another argument.
   831      * @return  the smaller of {@code a} and {@code b}.
   832      */
   833     @JavaScriptBody(args={"a", "b"},
   834         body="return Math.min(a,b);"
   835     )
   836     public static float min(float a, float b) {
   837         throw new UnsupportedOperationException();
   838     }
   839 
   840     /**
   841      * Returns the smaller of two {@code double} values.  That
   842      * is, the result is the value closer to negative infinity. If the
   843      * arguments have the same value, the result is that same
   844      * value. If either value is NaN, then the result is NaN.  Unlike
   845      * the numerical comparison operators, this method considers
   846      * negative zero to be strictly smaller than positive zero. If one
   847      * argument is positive zero and the other is negative zero, the
   848      * result is negative zero.
   849      *
   850      * @param   a   an argument.
   851      * @param   b   another argument.
   852      * @return  the smaller of {@code a} and {@code b}.
   853      */
   854     @JavaScriptBody(args={"a", "b"},
   855         body="return Math.min(a,b);"
   856     )
   857     public static double min(double a, double b) {
   858         throw new UnsupportedOperationException();
   859     }
   860 
   861     /**
   862      * Returns the size of an ulp of the argument.  An ulp of a
   863      * {@code double} value is the positive distance between this
   864      * floating-point value and the {@code double} value next
   865      * larger in magnitude.  Note that for non-NaN <i>x</i>,
   866      * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
   867      *
   868      * <p>Special Cases:
   869      * <ul>
   870      * <li> If the argument is NaN, then the result is NaN.
   871      * <li> If the argument is positive or negative infinity, then the
   872      * result is positive infinity.
   873      * <li> If the argument is positive or negative zero, then the result is
   874      * {@code Double.MIN_VALUE}.
   875      * <li> If the argument is &plusmn;{@code Double.MAX_VALUE}, then
   876      * the result is equal to 2<sup>971</sup>.
   877      * </ul>
   878      *
   879      * @param d the floating-point value whose ulp is to be returned
   880      * @return the size of an ulp of the argument
   881      * @author Joseph D. Darcy
   882      * @since 1.5
   883      */
   884 //    public static double ulp(double d) {
   885 //        return sun.misc.FpUtils.ulp(d);
   886 //    }
   887 
   888     /**
   889      * Returns the size of an ulp of the argument.  An ulp of a
   890      * {@code float} value is the positive distance between this
   891      * floating-point value and the {@code float} value next
   892      * larger in magnitude.  Note that for non-NaN <i>x</i>,
   893      * <code>ulp(-<i>x</i>) == ulp(<i>x</i>)</code>.
   894      *
   895      * <p>Special Cases:
   896      * <ul>
   897      * <li> If the argument is NaN, then the result is NaN.
   898      * <li> If the argument is positive or negative infinity, then the
   899      * result is positive infinity.
   900      * <li> If the argument is positive or negative zero, then the result is
   901      * {@code Float.MIN_VALUE}.
   902      * <li> If the argument is &plusmn;{@code Float.MAX_VALUE}, then
   903      * the result is equal to 2<sup>104</sup>.
   904      * </ul>
   905      *
   906      * @param f the floating-point value whose ulp is to be returned
   907      * @return the size of an ulp of the argument
   908      * @author Joseph D. Darcy
   909      * @since 1.5
   910      */
   911 //    public static float ulp(float f) {
   912 //        return sun.misc.FpUtils.ulp(f);
   913 //    }
   914 
   915     /**
   916      * Returns the signum function of the argument; zero if the argument
   917      * is zero, 1.0 if the argument is greater than zero, -1.0 if the
   918      * argument is less than zero.
   919      *
   920      * <p>Special Cases:
   921      * <ul>
   922      * <li> If the argument is NaN, then the result is NaN.
   923      * <li> If the argument is positive zero or negative zero, then the
   924      *      result is the same as the argument.
   925      * </ul>
   926      *
   927      * @param d the floating-point value whose signum is to be returned
   928      * @return the signum function of the argument
   929      * @author Joseph D. Darcy
   930      * @since 1.5
   931      */
   932 //    public static double signum(double d) {
   933 //        return sun.misc.FpUtils.signum(d);
   934 //    }
   935 
   936     /**
   937      * Returns the signum function of the argument; zero if the argument
   938      * is zero, 1.0f if the argument is greater than zero, -1.0f if the
   939      * argument is less than zero.
   940      *
   941      * <p>Special Cases:
   942      * <ul>
   943      * <li> If the argument is NaN, then the result is NaN.
   944      * <li> If the argument is positive zero or negative zero, then the
   945      *      result is the same as the argument.
   946      * </ul>
   947      *
   948      * @param f the floating-point value whose signum is to be returned
   949      * @return the signum function of the argument
   950      * @author Joseph D. Darcy
   951      * @since 1.5
   952      */
   953 //    public static float signum(float f) {
   954 //        return sun.misc.FpUtils.signum(f);
   955 //    }
   956 
   957     /**
   958      * Returns the first floating-point argument with the sign of the
   959      * second floating-point argument.  Note that unlike the {@link
   960      * StrictMath#copySign(double, double) StrictMath.copySign}
   961      * method, this method does not require NaN {@code sign}
   962      * arguments to be treated as positive values; implementations are
   963      * permitted to treat some NaN arguments as positive and other NaN
   964      * arguments as negative to allow greater performance.
   965      *
   966      * @param magnitude  the parameter providing the magnitude of the result
   967      * @param sign   the parameter providing the sign of the result
   968      * @return a value with the magnitude of {@code magnitude}
   969      * and the sign of {@code sign}.
   970      * @since 1.6
   971      */
   972 //    public static double copySign(double magnitude, double sign) {
   973 //        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
   974 //    }
   975 
   976     /**
   977      * Returns the first floating-point argument with the sign of the
   978      * second floating-point argument.  Note that unlike the {@link
   979      * StrictMath#copySign(float, float) StrictMath.copySign}
   980      * method, this method does not require NaN {@code sign}
   981      * arguments to be treated as positive values; implementations are
   982      * permitted to treat some NaN arguments as positive and other NaN
   983      * arguments as negative to allow greater performance.
   984      *
   985      * @param magnitude  the parameter providing the magnitude of the result
   986      * @param sign   the parameter providing the sign of the result
   987      * @return a value with the magnitude of {@code magnitude}
   988      * and the sign of {@code sign}.
   989      * @since 1.6
   990      */
   991 //    public static float copySign(float magnitude, float sign) {
   992 //        return sun.misc.FpUtils.rawCopySign(magnitude, sign);
   993 //    }
   994 
   995     /**
   996      * Returns the unbiased exponent used in the representation of a
   997      * {@code float}.  Special cases:
   998      *
   999      * <ul>
  1000      * <li>If the argument is NaN or infinite, then the result is
  1001      * {@link Float#MAX_EXPONENT} + 1.
  1002      * <li>If the argument is zero or subnormal, then the result is
  1003      * {@link Float#MIN_EXPONENT} -1.
  1004      * </ul>
  1005      * @param f a {@code float} value
  1006      * @return the unbiased exponent of the argument
  1007      * @since 1.6
  1008      */
  1009 //    public static int getExponent(float f) {
  1010 //        return sun.misc.FpUtils.getExponent(f);
  1011 //    }
  1012 
  1013     /**
  1014      * Returns the unbiased exponent used in the representation of a
  1015      * {@code double}.  Special cases:
  1016      *
  1017      * <ul>
  1018      * <li>If the argument is NaN or infinite, then the result is
  1019      * {@link Double#MAX_EXPONENT} + 1.
  1020      * <li>If the argument is zero or subnormal, then the result is
  1021      * {@link Double#MIN_EXPONENT} -1.
  1022      * </ul>
  1023      * @param d a {@code double} value
  1024      * @return the unbiased exponent of the argument
  1025      * @since 1.6
  1026      */
  1027 //    public static int getExponent(double d) {
  1028 //        return sun.misc.FpUtils.getExponent(d);
  1029 //    }
  1030 
  1031     /**
  1032      * Returns the floating-point number adjacent to the first
  1033      * argument in the direction of the second argument.  If both
  1034      * arguments compare as equal the second argument is returned.
  1035      *
  1036      * <p>
  1037      * Special cases:
  1038      * <ul>
  1039      * <li> If either argument is a NaN, then NaN is returned.
  1040      *
  1041      * <li> If both arguments are signed zeros, {@code direction}
  1042      * is returned unchanged (as implied by the requirement of
  1043      * returning the second argument if the arguments compare as
  1044      * equal).
  1045      *
  1046      * <li> If {@code start} is
  1047      * &plusmn;{@link Double#MIN_VALUE} and {@code direction}
  1048      * has a value such that the result should have a smaller
  1049      * magnitude, then a zero with the same sign as {@code start}
  1050      * is returned.
  1051      *
  1052      * <li> If {@code start} is infinite and
  1053      * {@code direction} has a value such that the result should
  1054      * have a smaller magnitude, {@link Double#MAX_VALUE} with the
  1055      * same sign as {@code start} is returned.
  1056      *
  1057      * <li> If {@code start} is equal to &plusmn;
  1058      * {@link Double#MAX_VALUE} and {@code direction} has a
  1059      * value such that the result should have a larger magnitude, an
  1060      * infinity with same sign as {@code start} is returned.
  1061      * </ul>
  1062      *
  1063      * @param start  starting floating-point value
  1064      * @param direction value indicating which of
  1065      * {@code start}'s neighbors or {@code start} should
  1066      * be returned
  1067      * @return The floating-point number adjacent to {@code start} in the
  1068      * direction of {@code direction}.
  1069      * @since 1.6
  1070      */
  1071 //    public static double nextAfter(double start, double direction) {
  1072 //        return sun.misc.FpUtils.nextAfter(start, direction);
  1073 //    }
  1074 
  1075     /**
  1076      * Returns the floating-point number adjacent to the first
  1077      * argument in the direction of the second argument.  If both
  1078      * arguments compare as equal a value equivalent to the second argument
  1079      * is returned.
  1080      *
  1081      * <p>
  1082      * Special cases:
  1083      * <ul>
  1084      * <li> If either argument is a NaN, then NaN is returned.
  1085      *
  1086      * <li> If both arguments are signed zeros, a value equivalent
  1087      * to {@code direction} is returned.
  1088      *
  1089      * <li> If {@code start} is
  1090      * &plusmn;{@link Float#MIN_VALUE} and {@code direction}
  1091      * has a value such that the result should have a smaller
  1092      * magnitude, then a zero with the same sign as {@code start}
  1093      * is returned.
  1094      *
  1095      * <li> If {@code start} is infinite and
  1096      * {@code direction} has a value such that the result should
  1097      * have a smaller magnitude, {@link Float#MAX_VALUE} with the
  1098      * same sign as {@code start} is returned.
  1099      *
  1100      * <li> If {@code start} is equal to &plusmn;
  1101      * {@link Float#MAX_VALUE} and {@code direction} has a
  1102      * value such that the result should have a larger magnitude, an
  1103      * infinity with same sign as {@code start} is returned.
  1104      * </ul>
  1105      *
  1106      * @param start  starting floating-point value
  1107      * @param direction value indicating which of
  1108      * {@code start}'s neighbors or {@code start} should
  1109      * be returned
  1110      * @return The floating-point number adjacent to {@code start} in the
  1111      * direction of {@code direction}.
  1112      * @since 1.6
  1113      */
  1114 //    public static float nextAfter(float start, double direction) {
  1115 //        return sun.misc.FpUtils.nextAfter(start, direction);
  1116 //    }
  1117 
  1118     /**
  1119      * Returns the floating-point value adjacent to {@code d} in
  1120      * the direction of positive infinity.  This method is
  1121      * semantically equivalent to {@code nextAfter(d,
  1122      * Double.POSITIVE_INFINITY)}; however, a {@code nextUp}
  1123      * implementation may run faster than its equivalent
  1124      * {@code nextAfter} call.
  1125      *
  1126      * <p>Special Cases:
  1127      * <ul>
  1128      * <li> If the argument is NaN, the result is NaN.
  1129      *
  1130      * <li> If the argument is positive infinity, the result is
  1131      * positive infinity.
  1132      *
  1133      * <li> If the argument is zero, the result is
  1134      * {@link Double#MIN_VALUE}
  1135      *
  1136      * </ul>
  1137      *
  1138      * @param d starting floating-point value
  1139      * @return The adjacent floating-point value closer to positive
  1140      * infinity.
  1141      * @since 1.6
  1142      */
  1143 //    public static double nextUp(double d) {
  1144 //        return sun.misc.FpUtils.nextUp(d);
  1145 //    }
  1146 
  1147     /**
  1148      * Returns the floating-point value adjacent to {@code f} in
  1149      * the direction of positive infinity.  This method is
  1150      * semantically equivalent to {@code nextAfter(f,
  1151      * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
  1152      * implementation may run faster than its equivalent
  1153      * {@code nextAfter} call.
  1154      *
  1155      * <p>Special Cases:
  1156      * <ul>
  1157      * <li> If the argument is NaN, the result is NaN.
  1158      *
  1159      * <li> If the argument is positive infinity, the result is
  1160      * positive infinity.
  1161      *
  1162      * <li> If the argument is zero, the result is
  1163      * {@link Float#MIN_VALUE}
  1164      *
  1165      * </ul>
  1166      *
  1167      * @param f starting floating-point value
  1168      * @return The adjacent floating-point value closer to positive
  1169      * infinity.
  1170      * @since 1.6
  1171      */
  1172 //    public static float nextUp(float f) {
  1173 //        return sun.misc.FpUtils.nextUp(f);
  1174 //    }
  1175 
  1176 
  1177     /**
  1178      * Return {@code d} &times;
  1179      * 2<sup>{@code scaleFactor}</sup> rounded as if performed
  1180      * by a single correctly rounded floating-point multiply to a
  1181      * member of the double value set.  See the Java
  1182      * Language Specification for a discussion of floating-point
  1183      * value sets.  If the exponent of the result is between {@link
  1184      * Double#MIN_EXPONENT} and {@link Double#MAX_EXPONENT}, the
  1185      * answer is calculated exactly.  If the exponent of the result
  1186      * would be larger than {@code Double.MAX_EXPONENT}, an
  1187      * infinity is returned.  Note that if the result is subnormal,
  1188      * precision may be lost; that is, when {@code scalb(x, n)}
  1189      * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
  1190      * <i>x</i>.  When the result is non-NaN, the result has the same
  1191      * sign as {@code d}.
  1192      *
  1193      * <p>Special cases:
  1194      * <ul>
  1195      * <li> If the first argument is NaN, NaN is returned.
  1196      * <li> If the first argument is infinite, then an infinity of the
  1197      * same sign is returned.
  1198      * <li> If the first argument is zero, then a zero of the same
  1199      * sign is returned.
  1200      * </ul>
  1201      *
  1202      * @param d number to be scaled by a power of two.
  1203      * @param scaleFactor power of 2 used to scale {@code d}
  1204      * @return {@code d} &times; 2<sup>{@code scaleFactor}</sup>
  1205      * @since 1.6
  1206      */
  1207 //    public static double scalb(double d, int scaleFactor) {
  1208 //        return sun.misc.FpUtils.scalb(d, scaleFactor);
  1209 //    }
  1210 
  1211     /**
  1212      * Return {@code f} &times;
  1213      * 2<sup>{@code scaleFactor}</sup> rounded as if performed
  1214      * by a single correctly rounded floating-point multiply to a
  1215      * member of the float value set.  See the Java
  1216      * Language Specification for a discussion of floating-point
  1217      * value sets.  If the exponent of the result is between {@link
  1218      * Float#MIN_EXPONENT} and {@link Float#MAX_EXPONENT}, the
  1219      * answer is calculated exactly.  If the exponent of the result
  1220      * would be larger than {@code Float.MAX_EXPONENT}, an
  1221      * infinity is returned.  Note that if the result is subnormal,
  1222      * precision may be lost; that is, when {@code scalb(x, n)}
  1223      * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
  1224      * <i>x</i>.  When the result is non-NaN, the result has the same
  1225      * sign as {@code f}.
  1226      *
  1227      * <p>Special cases:
  1228      * <ul>
  1229      * <li> If the first argument is NaN, NaN is returned.
  1230      * <li> If the first argument is infinite, then an infinity of the
  1231      * same sign is returned.
  1232      * <li> If the first argument is zero, then a zero of the same
  1233      * sign is returned.
  1234      * </ul>
  1235      *
  1236      * @param f number to be scaled by a power of two.
  1237      * @param scaleFactor power of 2 used to scale {@code f}
  1238      * @return {@code f} &times; 2<sup>{@code scaleFactor}</sup>
  1239      * @since 1.6
  1240      */
  1241 //    public static float scalb(float f, int scaleFactor) {
  1242 //        return sun.misc.FpUtils.scalb(f, scaleFactor);
  1243 //    }
  1244 }