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