| 1 |
#Region "Microsoft.VisualBasic::c9ce132914c40c893fde261e8b474bc9, Microsoft.VisualBasic.Core\Language\Language\Java\JavaMath.vb"
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
#End Region
|
| 53 |
|
| 54 |
Imports sys = System.Math
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
Namespace Language.Java
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
Unlike some of the numeric methods of class
|
| 88 |
{@code StrictMath}, all implementations of the equivalent
|
| 89 |
functions of class {@code Math} are not defined to return the
|
| 90 |
bit-for-bit same results. This relaxation permits
|
| 91 |
better-performing implementations where strict reproducibility is
|
| 92 |
not required.
|
| 93 |
|
| 94 |
By default many of the {@code Math} methods simply call
|
| 95 |
the equivalent method in {@code StrictMath} for their
|
| 96 |
implementation. Code generators are encouraged to use
|
| 97 |
platform-specific native libraries or microprocessor instructions,
|
| 98 |
where available, to provide higher-performance implementations of
|
| 99 |
{@code Math} methods. Such higher-performance
|
| 100 |
implementations still must conform to the specification for
|
| 101 |
{@code Math}.
|
| 102 |
|
| 103 |
The quality of implementation specifications concern two
|
| 104 |
properties, accuracy of the returned result and monotonicity of the
|
| 105 |
method. Accuracy of the floating-point {@code Math} methods is
|
| 106 |
measured in terms of _ulps_, units in the last place. For a
|
| 107 |
given floating-point format, an #ulp(double) ulp of a
|
| 108 |
specific real number value is the distance between the two
|
| 109 |
floating-point values bracketing that numerical value. When
|
| 110 |
discussing the accuracy of a method as a whole rather than at a
|
| 111 |
specific argument, the number of ulps cited is for the worst-case
|
| 112 |
error at any argument. If a method always has an error less than
|
| 113 |
0.5 ulps, the method always returns the floating-point number
|
| 114 |
nearest the exact result; such a method is _correctly
|
| 115 |
rounded_. A correctly rounded method is generally the best a
|
| 116 |
floating-point approximation can be; however, it is impractical for
|
| 117 |
many floating-point methods to be correctly rounded. Instead, for
|
| 118 |
the {@code Math} [Class], a larger error bound of 1 or 2 ulps is
|
| 119 |
allowed for certain methods. Informally, with a 1 ulp error bound,
|
| 120 |
when the exact result is a representable number, the exact result
|
| 121 |
should be returned as the computed result; otherwise, either of the
|
| 122 |
two floating-point values which bracket the exact result may be
|
| 123 |
returned. For exact results large in magnitude, one of the
|
| 124 |
endpoints of the bracket may be infinite. Besides accuracy at
|
| 125 |
individual arguments, maintaining proper relations between the
|
| 126 |
method at different arguments is also important. Therefore, most
|
| 127 |
methods with more than 0.5 ulp errors are required to be
|
| 128 |
_semi-monotonic_: whenever the mathematical function is
|
| 129 |
non-decreasing, so is the floating-point approximation, likewise,
|
| 130 |
whenever the mathematical function is non-increasing, so is the
|
| 131 |
floating-point approximation. Not all approximations that have 1
|
| 132 |
ulp accuracy will automatically meet the monotonicity requirements.
|
| 133 |
|
| 134 |
|
| 135 |
The platform uses signed two
|
| 136 |
int and long primitive types. The developer should choose
|
| 137 |
the primitive type to ensure that arithmetic operations consistently
|
| 138 |
produce correct results, which in some cases means the operations
|
| 139 |
will not overflow the range of values of the computation.
|
| 140 |
The best practice is to choose the primitive type and algorithm to avoid
|
| 141 |
overflow. In cases where the size is {@code int} or {@code long} and
|
| 142 |
overflow errors need to be detected, the methods {@code addExact},
|
| 143 |
{@code subtractExact}, {@code multiplyExact}, and {@code toIntExact}
|
| 144 |
throw an {@code ArithmeticException} when the results overflow.
|
| 145 |
For other arithmetic operations such as divide, absolute value,
|
| 146 |
increment, decrement, and negation overflow occurs only with
|
| 147 |
a specific minimum or maximum value and should be checked against
|
| 148 |
the minimum or maximum as appropriate.
|
| 149 |
|
| 150 |
@author unascribed
|
| 151 |
@author Joseph D. Darcy
|
| 152 |
@since JDK1.0
|
| 153 |
</summary>
|
| 154 |
Public Module JavaMath
|
| 155 |
|
| 156 |
|
| 157 |
The {@code double} value that is closer than any other to
|
| 158 |
_e_, the base of the natural logarithms.
|
| 159 |
</summary>
|
| 160 |
Public Const E As Double = 2.7182818284590451
|
| 161 |
|
| 162 |
|
| 163 |
The {@code double} value that is closer than any other to
|
| 164 |
_pi_, the ratio of the circumference of a circle to its
|
| 165 |
diameter.
|
| 166 |
</summary>
|
| 167 |
Public Const PI As Double = 3.1415926535897931
|
| 168 |
|
| 169 |
|
| 170 |
Returns the trigonometric sine of an angle. Special cases:
|
| 171 |
+ If the argument is NaN or an infinity, then the
|
| 172 |
result is NaN.
|
| 173 |
+ If the argument is zero, then the result is a zero with the
|
| 174 |
same sign as the argument.
|
| 175 |
|
| 176 |
The computed result must be within 1 ulp of the exact result.
|
| 177 |
Results must be semi-monotonic.
|
| 178 |
</summary>
|
| 179 |
<param name="a"> an angle, in radians. </param>
|
| 180 |
<returns> the sine of the argument. </returns>
|
| 181 |
Public Function sin(a As Double) As Double
|
| 182 |
Return sys.Sin(a) default impl. delegates to StrictMath
|
| 183 |
End Function
|
| 184 |
|
| 185 |
|
| 186 |
Returns the trigonometric cosine of an angle. Special cases:
|
| 187 |
+ If the argument is NaN or an infinity, then the
|
| 188 |
result is NaN.
|
| 189 |
|
| 190 |
The computed result must be within 1 ulp of the exact result.
|
| 191 |
Results must be semi-monotonic.
|
| 192 |
</summary>
|
| 193 |
<param name="a"> an angle, in radians. </param>
|
| 194 |
<returns> the cosine of the argument. </returns>
|
| 195 |
Public Function cos(a As Double) As Double
|
| 196 |
Return sys.Cos(a) default impl. delegates to StrictMath
|
| 197 |
End Function
|
| 198 |
|
| 199 |
|
| 200 |
Returns the trigonometric tangent of an angle. Special cases:
|
| 201 |
+ If the argument is NaN or an infinity, then the result
|
| 202 |
is NaN.
|
| 203 |
+ If the argument is zero, then the result is a zero with the
|
| 204 |
same sign as the argument.
|
| 205 |
|
| 206 |
The computed result must be within 1 ulp of the exact result.
|
| 207 |
Results must be semi-monotonic.
|
| 208 |
</summary>
|
| 209 |
<param name="a"> an angle, in radians. </param>
|
| 210 |
<returns> the tangent of the argument. </returns>
|
| 211 |
Public Function tan(a As Double) As Double
|
| 212 |
Return sys.Tan(a) default impl. delegates to StrictMath
|
| 213 |
End Function
|
| 214 |
|
| 215 |
|
| 216 |
Returns the arc sine of a value; the returned angle is in the
|
| 217 |
range -_pi_/2 through _pi_/2. Special cases:
|
| 218 |
+ If the argument is NaN or its absolute value is greater
|
| 219 |
than 1, then the result is NaN.
|
| 220 |
+ If the argument is zero, then the result is a zero with the
|
| 221 |
same sign as the argument.
|
| 222 |
|
| 223 |
The computed result must be within 1 ulp of the exact result.
|
| 224 |
Results must be semi-monotonic.
|
| 225 |
</summary>
|
| 226 |
<param name="a"> the value whose arc sine is to be returned. </param>
|
| 227 |
<returns> the arc sine of the argument. </returns>
|
| 228 |
Public Function asin(a As Double) As Double
|
| 229 |
Return sys.Asin(a) default impl. delegates to StrictMath
|
| 230 |
End Function
|
| 231 |
|
| 232 |
|
| 233 |
Returns the arc cosine of a value; the returned angle is in the
|
| 234 |
range 0.0 through _pi_. Special case:
|
| 235 |
+ If the argument is NaN or its absolute value is greater
|
| 236 |
than 1, then the result is NaN.
|
| 237 |
|
| 238 |
The computed result must be within 1 ulp of the exact result.
|
| 239 |
Results must be semi-monotonic.
|
| 240 |
</summary>
|
| 241 |
<param name="a"> the value whose arc cosine is to be returned. </param>
|
| 242 |
<returns> the arc cosine of the argument. </returns>
|
| 243 |
Public Function acos(a As Double) As Double
|
| 244 |
Return sys.Acos(a) default impl. delegates to StrictMath
|
| 245 |
End Function
|
| 246 |
|
| 247 |
|
| 248 |
Returns the arc tangent of a value; the returned angle is in the
|
| 249 |
range -_pi_/2 through _pi_/2. Special cases:
|
| 250 |
+ If the argument is NaN, then the result is NaN.
|
| 251 |
+ If the argument is zero, then the result is a zero with the
|
| 252 |
same sign as the argument.
|
| 253 |
|
| 254 |
The computed result must be within 1 ulp of the exact result.
|
| 255 |
Results must be semi-monotonic.
|
| 256 |
</summary>
|
| 257 |
<param name="a"> the value whose arc tangent is to be returned. </param>
|
| 258 |
<returns> the arc tangent of the argument. </returns>
|
| 259 |
Public Function atan(a As Double) As Double
|
| 260 |
Return sys.Atan(a) default impl. delegates to StrictMath
|
| 261 |
End Function
|
| 262 |
|
| 263 |
|
| 264 |
Converts an angle measured in degrees to an approximately
|
| 265 |
equivalent angle measured in radians. The conversion from
|
| 266 |
degrees to radians is generally inexact.
|
| 267 |
</summary>
|
| 268 |
<param name="angdeg"> an angle, in degrees </param>
|
| 269 |
<returns> the measurement of the angle {@code angdeg}
|
| 270 |
in radians.
|
| 271 |
@since 1.2 </returns>
|
| 272 |
Public Function toRadians(angdeg As Double) As Double
|
| 273 |
Return angdeg / 180.0 * PI
|
| 274 |
End Function
|
| 275 |
|
| 276 |
|
| 277 |
Converts an angle measured in radians to an approximately
|
| 278 |
equivalent angle measured in degrees. The conversion from
|
| 279 |
radians to degrees is generally inexact; users should
|
| 280 |
_not_ expect {@code cos(toRadians(90.0))} to exactly
|
| 281 |
equal {@code 0.0}.
|
| 282 |
</summary>
|
| 283 |
<param name="angrad"> an angle, in radians </param>
|
| 284 |
<returns> the measurement of the angle {@code angrad}
|
| 285 |
in degrees.
|
| 286 |
@since 1.2 </returns>
|
| 287 |
Public Function toDegrees(angrad As Double) As Double
|
| 288 |
Return angrad * 180.0 / PI
|
| 289 |
End Function
|
| 290 |
|
| 291 |
|
| 292 |
Returns Euler
|
| 293 |
{@code double} value. Special cases:
|
| 294 |
+ If the argument is NaN, the result is NaN.
|
| 295 |
+ If the argument is positive infinity, then the result is
|
| 296 |
positive infinity.
|
| 297 |
+ If the argument is negative infinity, then the result is
|
| 298 |
positive zero.
|
| 299 |
|
| 300 |
The computed result must be within 1 ulp of the exact result.
|
| 301 |
Results must be semi-monotonic.
|
| 302 |
</summary>
|
| 303 |
<param name="a"> the exponent to raise _e_ to. </param>
|
| 304 |
<returns> the value _e_{@code a},
|
| 305 |
where _e_ is the base of the natural logarithms. </returns>
|
| 306 |
Public Function exp(a As Double) As Double
|
| 307 |
Return sys.Exp(a) default impl. delegates to StrictMath
|
| 308 |
End Function
|
| 309 |
|
| 310 |
|
| 311 |
Returns the natural logarithm (base _e_) of a {@code double}
|
| 312 |
value. Special cases:
|
| 313 |
+ If the argument is NaN or less than zero, then the result
|
| 314 |
is NaN.
|
| 315 |
+ If the argument is positive infinity, then the result is
|
| 316 |
positive infinity.
|
| 317 |
+ If the argument is positive zero or negative zero, then the
|
| 318 |
result is negative infinity.
|
| 319 |
|
| 320 |
The computed result must be within 1 ulp of the exact result.
|
| 321 |
Results must be semi-monotonic.
|
| 322 |
</summary>
|
| 323 |
<param name="a"> a value </param>
|
| 324 |
<returns> the value ln {@code a}, the natural logarithm of
|
| 325 |
{@code a}. </returns>
|
| 326 |
Public Function log(a As Double) As Double
|
| 327 |
Return sys.Log(a) default impl. delegates to StrictMath
|
| 328 |
End Function
|
| 329 |
|
| 330 |
|
| 331 |
Returns the base 10 logarithm of a {@code double} value.
|
| 332 |
Special cases:
|
| 333 |
|
| 334 |
+ If the argument is NaN or less than zero, then the result
|
| 335 |
is NaN.
|
| 336 |
+ If the argument is positive infinity, then the result is
|
| 337 |
positive infinity.
|
| 338 |
+ If the argument is positive zero or negative zero, then the
|
| 339 |
result is negative infinity.
|
| 340 |
+ If the argument is equal to 10<sup>_n_</sup> for
|
| 341 |
integer _n_, then the result is _n_.
|
| 342 |
|
| 343 |
|
| 344 |
The computed result must be within 1 ulp of the exact result.
|
| 345 |
Results must be semi-monotonic.
|
| 346 |
</summary>
|
| 347 |
<param name="a"> a value </param>
|
| 348 |
<returns> the base 10 logarithm of {@code a}.
|
| 349 |
@since 1.5 </returns>
|
| 350 |
Public Function log10(a As Double) As Double
|
| 351 |
Return sys.Log10(a) default impl. delegates to StrictMath
|
| 352 |
End Function
|
| 353 |
|
| 354 |
|
| 355 |
Returns the correctly rounded positive square root of a
|
| 356 |
{@code double} value.
|
| 357 |
Special cases:
|
| 358 |
+ If the argument is NaN or less than zero, then the result
|
| 359 |
is NaN.
|
| 360 |
+ If the argument is positive infinity, then the result is positive
|
| 361 |
infinity.
|
| 362 |
+ If the argument is positive zero or negative zero, then the
|
| 363 |
result is the same as the argument.
|
| 364 |
Otherwise, the result is the {@code double} value closest to
|
| 365 |
the true mathematical square root of the argument value.
|
| 366 |
</summary>
|
| 367 |
<param name="a"> a value. </param>
|
| 368 |
<returns> the positive square root of {@code a}.
|
| 369 |
If the argument is NaN or less than zero, the result is NaN. </returns>
|
| 370 |
Public Function sqrt(a As Double) As Double
|
| 371 |
Return sys.Sqrt(a) default impl. delegates to StrictMath
|
| 372 |
Note that hardware sqrt instructions
|
| 373 |
frequently can be directly used by JITs
|
| 374 |
and should be much faster than doing
|
| 375 |
sys.sqrt in software.
|
| 376 |
End Function
|
| 377 |
|
| 378 |
'
|
| 379 |
'Returns the cube root of a {@code double} value. For
|
| 380 |
'positive finite {@code x}, {@code cbrt(-x) ==
|
| 381 |
'-cbrt(x)}; that is, the cube root of a negative value is
|
| 382 |
'the negative of the cube root of that value's magnitude.
|
| 383 |
'
|
| 384 |
'Special cases:
|
| 385 |
'
|
| 386 |
'
|
| 387 |
'
|
| 388 |
'+ If the argument is NaN, then the result is NaN.
|
| 389 |
'
|
| 390 |
'+ If the argument is infinite, then the result is an infinity
|
| 391 |
'with the same sign as the argument.
|
| 392 |
'
|
| 393 |
'+ If the argument is zero, then the result is a zero with the
|
| 394 |
'same sign as the argument.
|
| 395 |
'
|
| 396 |
'
|
| 397 |
'
|
| 398 |
'The computed result must be within 1 ulp of the exact result.
|
| 399 |
'</summary>
|
| 400 |
'<param name="a"> a value. </param>
|
| 401 |
'<returns> the cube root of {@code a}.
|
| 402 |
'@since 1.5 </returns>
|
| 403 |
|
| 404 |
Return sys.cbrt(a)
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
Computes the remainder operation on two arguments as prescribed
|
| 409 |
by the IEEE 754 standard.
|
| 410 |
The remainder value is mathematically equal to
|
| 411 |
``f1 - f2`` x _n_,
|
| 412 |
where _n_ is the mathematical integer closest to the exact
|
| 413 |
mathematical value of the quotient {@code f1/f2}, and if two
|
| 414 |
mathematical integers are equally close to {@code f1/f2},
|
| 415 |
then _n_ is the integer that is even. If the remainder is
|
| 416 |
zero, its sign is the same as the sign of the first argument.
|
| 417 |
Special cases:
|
| 418 |
+ If either argument is NaN, or the first argument is infinite,
|
| 419 |
or the second argument is positive zero or negative zero, then the
|
| 420 |
result is NaN.
|
| 421 |
+ If the first argument is finite and the second argument is
|
| 422 |
infinite, then the result is the same as the first argument.
|
| 423 |
</summary>
|
| 424 |
<param name="f1"> the dividend. </param>
|
| 425 |
<param name="f2"> the divisor. </param>
|
| 426 |
<returns> the remainder when {@code f1} is divided by
|
| 427 |
{@code f2}. </returns>
|
| 428 |
Public Function IEEEremainder(f1 As Double, f2 As Double) As Double
|
| 429 |
Return sys.IEEERemainder(f1, f2) delegate to StrictMath
|
| 430 |
End Function
|
| 431 |
|
| 432 |
|
| 433 |
Returns the smallest (closest to negative infinity)
|
| 434 |
{@code double} value that is greater than or equal to the
|
| 435 |
argument and is equal to a mathematical java.lang.[Integer]. Special cases:
|
| 436 |
+ If the argument value is already equal to a
|
| 437 |
mathematical integer, then the result is the same as the
|
| 438 |
argument. + If the argument is NaN or an infinity or
|
| 439 |
positive zero or negative zero, then the result is the same as
|
| 440 |
the argument. + If the argument value is less than zero but
|
| 441 |
greater than -1.0, then the result is negative zero. Note
|
| 442 |
that the value of {@code sys.ceil(x)} is exactly the
|
| 443 |
value of {@code -Math.floor(-x)}.
|
| 444 |
|
| 445 |
</summary>
|
| 446 |
<param name="a"> a value. </param>
|
| 447 |
<returns> the smallest (closest to negative infinity)
|
| 448 |
floating-point value that is greater than or equal to
|
| 449 |
the argument and is equal to a mathematical java.lang.[Integer]. </returns>
|
| 450 |
Public Function ceil(a As Double) As Double
|
| 451 |
Return sys.Ceiling(a) default impl. delegates to StrictMath
|
| 452 |
End Function
|
| 453 |
|
| 454 |
|
| 455 |
Returns the largest (closest to positive infinity)
|
| 456 |
{@code double} value that is less than or equal to the
|
| 457 |
argument and is equal to a mathematical java.lang.[Integer]. Special cases:
|
| 458 |
+ If the argument value is already equal to a
|
| 459 |
mathematical integer, then the result is the same as the
|
| 460 |
argument. + If the argument is NaN or an infinity or
|
| 461 |
positive zero or negative zero, then the result is the same as
|
| 462 |
the argument.
|
| 463 |
</summary>
|
| 464 |
<param name="a"> a value. </param>
|
| 465 |
<returns> the largest (closest to positive infinity)
|
| 466 |
floating-point value that less than or equal to the argument
|
| 467 |
and is equal to a mathematical java.lang.[Integer]. </returns>
|
| 468 |
Public Function floor(a As Double) As Double
|
| 469 |
Return sys.Floor(a) default impl. delegates to StrictMath
|
| 470 |
End Function
|
| 471 |
|
| 472 |
'
|
| 473 |
'Returns the {@code double} value that is closest in value
|
| 474 |
'to the argument and is equal to a mathematical java.lang.[Integer]. If two
|
| 475 |
'{@code double} values that are mathematical integers are
|
| 476 |
'equally close, the result is the integer value that is
|
| 477 |
'even. Special cases:
|
| 478 |
'+ If the argument value is already equal to a mathematical
|
| 479 |
'integer, then the result is the same as the argument.
|
| 480 |
'+ If the argument is NaN or an infinity or positive zero or negative
|
| 481 |
'zero, then the result is the same as the argument.
|
| 482 |
'</summary>
|
| 483 |
'<param name="a"> a {@code double} value. </param>
|
| 484 |
'<returns> the closest floating-point value to {@code a} that is
|
| 485 |
' equal to a mathematical java.lang.[Integer]. </returns>
|
| 486 |
|
| 487 |
Return sys.rint(a) default impl. delegates to StrictMath
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
Returns the angle _theta_ from the conversion of rectangular
|
| 492 |
coordinates ({@code x}, {@code y}) to polar
|
| 493 |
coordinates (r, _theta_).
|
| 494 |
This method computes the phase _theta_ by computing an arc tangent
|
| 495 |
of {@code y/x} in the range of -_pi_ to _pi_. Special
|
| 496 |
cases:
|
| 497 |
+ If either argument is NaN, then the result is NaN.
|
| 498 |
+ If the first argument is positive zero and the second argument
|
| 499 |
is positive, or the first argument is positive and finite and the
|
| 500 |
second argument is positive infinity, then the result is positive
|
| 501 |
zero.
|
| 502 |
+ If the first argument is negative zero and the second argument
|
| 503 |
is positive, or the first argument is negative and finite and the
|
| 504 |
second argument is positive infinity, then the result is negative zero.
|
| 505 |
+ If the first argument is positive zero and the second argument
|
| 506 |
is negative, or the first argument is positive and finite and the
|
| 507 |
second argument is negative infinity, then the result is the
|
| 508 |
{@code double} value closest to _pi_.
|
| 509 |
+ If the first argument is negative zero and the second argument
|
| 510 |
is negative, or the first argument is negative and finite and the
|
| 511 |
second argument is negative infinity, then the result is the
|
| 512 |
{@code double} value closest to -_pi_.
|
| 513 |
+ If the first argument is positive and the second argument is
|
| 514 |
positive zero or negative zero, or the first argument is positive
|
| 515 |
infinity and the second argument is finite, then the result is the
|
| 516 |
{@code double} value closest to _pi_/2.
|
| 517 |
+ If the first argument is negative and the second argument is
|
| 518 |
positive zero or negative zero, or the first argument is negative
|
| 519 |
infinity and the second argument is finite, then the result is the
|
| 520 |
{@code double} value closest to -_pi_/2.
|
| 521 |
+ If both arguments are positive infinity, then the result is the
|
| 522 |
{@code double} value closest to _pi_/4.
|
| 523 |
+ If the first argument is positive infinity and the second argument
|
| 524 |
is negative infinity, then the result is the {@code double}
|
| 525 |
value closest to 3*_pi_/4.
|
| 526 |
+ If the first argument is negative infinity and the second argument
|
| 527 |
is positive infinity, then the result is the {@code double} value
|
| 528 |
closest to -_pi_/4.
|
| 529 |
+ If both arguments are negative infinity, then the result is the
|
| 530 |
{@code double} value closest to -3*_pi_/4.
|
| 531 |
|
| 532 |
The computed result must be within 2 ulps of the exact result.
|
| 533 |
Results must be semi-monotonic.
|
| 534 |
</summary>
|
| 535 |
<param name="y"> the ordinate coordinate </param>
|
| 536 |
<param name="x"> the abscissa coordinate </param>
|
| 537 |
<returns> the _theta_ component of the point
|
| 538 |
(_r_, _theta_)
|
| 539 |
in polar coordinates that corresponds to the point
|
| 540 |
(_x_, _y_) in Cartesian coordinates. </returns>
|
| 541 |
Public Function atan2(y As Double, x As Double) As Double
|
| 542 |
Return sys.Atan2(y, x) default impl. delegates to StrictMath
|
| 543 |
End Function
|
| 544 |
|
| 545 |
|
| 546 |
Returns the value of the first argument raised to the power of the
|
| 547 |
second argument. Special cases:
|
| 548 |
|
| 549 |
+ If the second argument is positive or negative zero, then the
|
| 550 |
result is 1.0.
|
| 551 |
+ If the second argument is 1.0, then the result is the same as the
|
| 552 |
first argument.
|
| 553 |
+ If the second argument is NaN, then the result is NaN.
|
| 554 |
+ If the first argument is NaN and the second argument is nonzero,
|
| 555 |
then the result is NaN.
|
| 556 |
|
| 557 |
+ If
|
| 558 |
|
| 559 |
+ the absolute value of the first argument is greater than 1
|
| 560 |
and the second argument is positive infinity, or
|
| 561 |
+ the absolute value of the first argument is less than 1 and
|
| 562 |
the second argument is negative infinity,
|
| 563 |
|
| 564 |
then the result is positive infinity.
|
| 565 |
|
| 566 |
+ If
|
| 567 |
|
| 568 |
+ the absolute value of the first argument is greater than 1 and
|
| 569 |
the second argument is negative infinity, or
|
| 570 |
+ the absolute value of the
|
| 571 |
first argument is less than 1 and the second argument is positive
|
| 572 |
infinity,
|
| 573 |
|
| 574 |
then the result is positive zero.
|
| 575 |
|
| 576 |
+ If the absolute value of the first argument equals 1 and the
|
| 577 |
second argument is infinite, then the result is NaN.
|
| 578 |
|
| 579 |
+ If
|
| 580 |
|
| 581 |
+ the first argument is positive zero and the second argument
|
| 582 |
is greater than zero, or
|
| 583 |
+ the first argument is positive infinity and the second
|
| 584 |
argument is less than zero,
|
| 585 |
|
| 586 |
then the result is positive zero.
|
| 587 |
|
| 588 |
+ If
|
| 589 |
|
| 590 |
+ the first argument is positive zero and the second argument
|
| 591 |
is less than zero, or
|
| 592 |
+ the first argument is positive infinity and the second
|
| 593 |
argument is greater than zero,
|
| 594 |
|
| 595 |
then the result is positive infinity.
|
| 596 |
|
| 597 |
+ If
|
| 598 |
|
| 599 |
+ the first argument is negative zero and the second argument
|
| 600 |
is greater than zero but not a finite odd integer, or
|
| 601 |
+ the first argument is negative infinity and the second
|
| 602 |
argument is less than zero but not a finite odd integer,
|
| 603 |
|
| 604 |
then the result is positive zero.
|
| 605 |
|
| 606 |
+ If
|
| 607 |
|
| 608 |
+ the first argument is negative zero and the second argument
|
| 609 |
is a positive finite odd integer, or
|
| 610 |
+ the first argument is negative infinity and the second
|
| 611 |
argument is a negative finite odd integer,
|
| 612 |
|
| 613 |
then the result is negative zero.
|
| 614 |
|
| 615 |
+ If
|
| 616 |
|
| 617 |
+ the first argument is negative zero and the second argument
|
| 618 |
is less than zero but not a finite odd integer, or
|
| 619 |
+ the first argument is negative infinity and the second
|
| 620 |
argument is greater than zero but not a finite odd integer,
|
| 621 |
|
| 622 |
then the result is positive infinity.
|
| 623 |
|
| 624 |
+ If
|
| 625 |
|
| 626 |
+ the first argument is negative zero and the second argument
|
| 627 |
is a negative finite odd integer, or
|
| 628 |
+ the first argument is negative infinity and the second
|
| 629 |
argument is a positive finite odd integer,
|
| 630 |
|
| 631 |
then the result is negative infinity.
|
| 632 |
|
| 633 |
+ If the first argument is finite and less than zero
|
| 634 |
|
| 635 |
+ if the second argument is a finite even integer, the
|
| 636 |
result is equal to the result of raising the absolute value of
|
| 637 |
the first argument to the power of the second argument
|
| 638 |
|
| 639 |
+ if the second argument is a finite odd integer, the result
|
| 640 |
is equal to the negative of the result of raising the absolute
|
| 641 |
value of the first argument to the power of the second
|
| 642 |
argument
|
| 643 |
|
| 644 |
+ if the second argument is finite and not an integer, then
|
| 645 |
the result is NaN.
|
| 646 |
|
| 647 |
|
| 648 |
+ If both arguments are integers, then the result is exactly equal
|
| 649 |
to the mathematical result of raising the first argument to the power
|
| 650 |
of the second argument if that result can in fact be represented
|
| 651 |
exactly as a {@code double} value.
|
| 652 |
|
| 653 |
(In the foregoing descriptions, a floating-point value is
|
| 654 |
considered to be an integer if and only if it is finite and a
|
| 655 |
fixed point of the method #ceil ceil or,
|
| 656 |
equivalently, a fixed point of the method {@link #floor
|
| 657 |
floor}. A value is a fixed point of a one-argument
|
| 658 |
method if and only if the result of applying the method to the
|
| 659 |
value is equal to the value.)
|
| 660 |
|
| 661 |
The computed result must be within 1 ulp of the exact result.
|
| 662 |
Results must be semi-monotonic.
|
| 663 |
</summary>
|
| 664 |
<param name="a"> the base. </param>
|
| 665 |
<param name="b"> the exponent. </param>
|
| 666 |
<returns> the value {@code a}<sup>{@code b}</sup>. </returns>
|
| 667 |
Public Function pow(a As Double, b As Double) As Double
|
| 668 |
Return sys.Pow(a, b) default impl. delegates to StrictMath
|
| 669 |
End Function
|
| 670 |
|
| 671 |
'
|
| 672 |
'Returns the closest {@code int} to the argument, with ties
|
| 673 |
'rounding to positive infinity.
|
| 674 |
'
|
| 675 |
'
|
| 676 |
'Special cases:
|
| 677 |
'+ If the argument is NaN, the result is 0.
|
| 678 |
'+ If the argument is negative infinity or any value less than or
|
| 679 |
'equal to the value of {@code java.lang.[Integer].MIN_VALUE}, the result is
|
| 680 |
'equal to the value of {@code java.lang.[Integer].MIN_VALUE}.
|
| 681 |
'+ If the argument is positive infinity or any value greater than or
|
| 682 |
'equal to the value of {@code java.lang.[Integer].MAX_VALUE}, the result is
|
| 683 |
'equal to the value of {@code java.lang.[Integer].MAX_VALUE}.
|
| 684 |
'</summary>
|
| 685 |
'<param name="a"> a floating-point value to be rounded to an java.lang.[Integer]. </param>
|
| 686 |
'<returns> the value of the argument rounded to the nearest
|
| 687 |
' {@code int} value. </returns>
|
| 688 |
'<seealso cref= java.lang.Integer#MAX_VALUE </seealso>
|
| 689 |
'<seealso cref= java.lang.Integer#MIN_VALUE </seealso>
|
| 690 |
|
| 691 |
Dim intBits As Integer = Float.floatToRawIntBits(a)
|
| 692 |
Dim biasedExp As Integer = (intBits And sun.misc.FloatConsts.EXP_BIT_MASK) >> (sun.misc.FloatConsts.SIGNIFICAND_WIDTH - 1)
|
| 693 |
Dim shift As Integer = (sun.misc.FloatConsts.SIGNIFICAND_WIDTH - 2 + sun.misc.FloatConsts.EXP_BIAS) - biasedExp
|
| 694 |
If (shift And -32) = 0 Then shift >= 0 && shift < 32
|
| 695 |
a is a finite number such that pow(2,-32) <= ulp(a) < 1
|
| 696 |
Dim r As Integer = ((intBits And sun.misc.FloatConsts.SIGNIF_BIT_MASK) Or (sun.misc.FloatConsts.SIGNIF_BIT_MASK + 1))
|
| 697 |
If intBits < 0 Then r = -r
|
| 698 |
In the comments below each Java expression evaluates to the value
|
| 699 |
the corresponding mathematical expression:
|
| 700 |
(r) evaluates to a / ulp(a)
|
| 701 |
(r >> shift) evaluates to floor(a * 2)
|
| 702 |
((r >> shift) + 1) evaluates to floor((a + 1/2) * 2)
|
| 703 |
(((r >> shift) + 1) >> 1) evaluates to floor(a + 1/2)
|
| 704 |
Return ((r >> shift) + 1) >> 1
|
| 705 |
Else
|
| 706 |
a is either
|
| 707 |
- a finite number with abs(a) < exp(2,FloatConsts.SIGNIFICAND_WIDTH-32) < 1/2
|
| 708 |
- a finite number with ulp(a) >= 1 and hence a is a mathematical integer
|
| 709 |
- an infinity or NaN
|
| 710 |
Return CInt(Fix(a))
|
| 711 |
End If
|
| 712 |
|
| 713 |
|
| 714 |
'
|
| 715 |
'Returns the closest {@code long} to the argument, with ties
|
| 716 |
'rounding to positive infinity.
|
| 717 |
'
|
| 718 |
'Special cases:
|
| 719 |
'+ If the argument is NaN, the result is 0.
|
| 720 |
'+ If the argument is negative infinity or any value less than or
|
| 721 |
'equal to the value of {@code java.lang.[Long].MIN_VALUE}, the result is
|
| 722 |
'equal to the value of {@code java.lang.[Long].MIN_VALUE}.
|
| 723 |
'+ If the argument is positive infinity or any value greater than or
|
| 724 |
'equal to the value of {@code java.lang.[Long].MAX_VALUE}, the result is
|
| 725 |
'equal to the value of {@code java.lang.[Long].MAX_VALUE}.
|
| 726 |
'</summary>
|
| 727 |
'<param name="a"> a floating-point value to be rounded to a
|
| 728 |
' {@code long}. </param>
|
| 729 |
'<returns> the value of the argument rounded to the nearest
|
| 730 |
' {@code long} value. </returns>
|
| 731 |
'<seealso cref= java.lang.Long#MAX_VALUE </seealso>
|
| 732 |
'<seealso cref= java.lang.Long#MIN_VALUE </seealso>
|
| 733 |
|
| 734 |
Dim longBits As Long = Java.lang.[Double].doubleToRawLongBits(a)
|
| 735 |
Dim biasedExp As Long = (longBits And sun.misc.DoubleConsts.EXP_BIT_MASK) >> (sun.misc.DoubleConsts.SIGNIFICAND_WIDTH - 1)
|
| 736 |
Dim shift As Long = (sun.misc.DoubleConsts.SIGNIFICAND_WIDTH - 2 + sun.misc.DoubleConsts.EXP_BIAS) - biasedExp
|
| 737 |
If (shift And -64) = 0 Then shift >= 0 && shift < 64
|
| 738 |
a is a finite number such that pow(2,-64) <= ulp(a) < 1
|
| 739 |
Dim r As Long = ((longBits And sun.misc.DoubleConsts.SIGNIF_BIT_MASK) Or (sun.misc.DoubleConsts.SIGNIF_BIT_MASK + 1))
|
| 740 |
If longBits < 0 Then r = -r
|
| 741 |
In the comments below each Java expression evaluates to the value
|
| 742 |
the corresponding mathematical expression:
|
| 743 |
(r) evaluates to a / ulp(a)
|
| 744 |
(r >> shift) evaluates to floor(a * 2)
|
| 745 |
((r >> shift) + 1) evaluates to floor((a + 1/2) * 2)
|
| 746 |
(((r >> shift) + 1) >> 1) evaluates to floor(a + 1/2)
|
| 747 |
Return ((r >> shift) + 1) >> 1
|
| 748 |
Else
|
| 749 |
a is either
|
| 750 |
- a finite number with abs(a) < exp(2,DoubleConsts.SIGNIFICAND_WIDTH-64) < 1/2
|
| 751 |
- a finite number with ulp(a) >= 1 and hence a is a mathematical integer
|
| 752 |
- an infinity or NaN
|
| 753 |
Return CLng(Fix(a))
|
| 754 |
End If
|
| 755 |
|
| 756 |
|
| 757 |
Private NotInheritable Class RandomNumberGeneratorHolder
|
| 758 |
Friend Shared ReadOnly randomNumberGenerator As New Random
|
| 759 |
End Class
|
| 760 |
|
| 761 |
|
| 762 |
Returns a {@code double} value with a positive sign, greater
|
| 763 |
than or equal to {@code 0.0} and less than {@code 1.0}.
|
| 764 |
Returned values are chosen pseudorandomly with (approximately)
|
| 765 |
uniform distribution from that range.
|
| 766 |
|
| 767 |
When this method is first called, it creates a single new
|
| 768 |
pseudorandom-number generator, exactly as if by the expression
|
| 769 |
|
| 770 |
<blockquote>{@code new java.util.Random()}</blockquote>
|
| 771 |
|
| 772 |
This new pseudorandom-number generator is used thereafter for
|
| 773 |
all calls to this method and is used nowhere else.
|
| 774 |
|
| 775 |
This method is properly synchronized to allow correct use by
|
| 776 |
more than one thread. However, if many threads need to generate
|
| 777 |
pseudorandom numbers at a great rate, it may reduce contention
|
| 778 |
for each thread to have its own pseudorandom-number generator.
|
| 779 |
</summary>
|
| 780 |
<returns> a pseudorandom {@code double} greater than or equal
|
| 781 |
to {@code 0.0} and less than {@code 1.0}. </returns>
|
| 782 |
Public Function random() As Double
|
| 783 |
Return RandomNumberGeneratorHolder.randomNumberGenerator.NextDouble()
|
| 784 |
End Function
|
| 785 |
|
| 786 |
|
| 787 |
Returns the sum of its arguments,
|
| 788 |
throwing an exception if the result overflows an {@code int}.
|
| 789 |
</summary>
|
| 790 |
<param name="x"> the first value </param>
|
| 791 |
<param name="y"> the second value </param>
|
| 792 |
<returns> the result </returns>
|
| 793 |
<exception cref="ArithmeticException"> if the result overflows an int
|
| 794 |
@since 1.8 </exception>
|
| 795 |
Public Function addExact(x As Integer, y As Integer) As Integer
|
| 796 |
Dim r As Integer = x + y
|
| 797 |
HD 2-12 Overflow iff both arguments have the opposite sign of the result
|
| 798 |
If ((x Xor r) And (y Xor r)) < 0 Then Throw New ArithmeticException("integer overflow")
|
| 799 |
Return r
|
| 800 |
End Function
|
| 801 |
|
| 802 |
|
| 803 |
Returns the sum of its arguments,
|
| 804 |
throwing an exception if the result overflows a {@code long}.
|
| 805 |
</summary>
|
| 806 |
<param name="x"> the first value </param>
|
| 807 |
<param name="y"> the second value </param>
|
| 808 |
<returns> the result </returns>
|
| 809 |
<exception cref="ArithmeticException"> if the result overflows a long
|
| 810 |
@since 1.8 </exception>
|
| 811 |
Public Function addExact(x As Long, y As Long) As Long
|
| 812 |
Dim r As Long = x + y
|
| 813 |
HD 2-12 Overflow iff both arguments have the opposite sign of the result
|
| 814 |
If ((x Xor r) And (y Xor r)) < 0 Then Throw New ArithmeticException("long overflow")
|
| 815 |
Return r
|
| 816 |
End Function
|
| 817 |
|
| 818 |
|
| 819 |
Returns the difference of the arguments,
|
| 820 |
throwing an exception if the result overflows an {@code int}.
|
| 821 |
</summary>
|
| 822 |
<param name="x"> the first value </param>
|
| 823 |
<param name="y"> the second value to subtract from the first </param>
|
| 824 |
<returns> the result </returns>
|
| 825 |
<exception cref="ArithmeticException"> if the result overflows an int
|
| 826 |
@since 1.8 </exception>
|
| 827 |
Public Function subtractExact(x As Integer, y As Integer) As Integer
|
| 828 |
Dim r As Integer = x - y
|
| 829 |
HD 2-12 Overflow iff the arguments have different signs and
|
| 830 |
the sign of the result is different than the sign of x
|
| 831 |
If ((x Xor y) And (x Xor r)) < 0 Then Throw New ArithmeticException("integer overflow")
|
| 832 |
Return r
|
| 833 |
End Function
|
| 834 |
|
| 835 |
|
| 836 |
Returns the difference of the arguments,
|
| 837 |
throwing an exception if the result overflows a {@code long}.
|
| 838 |
</summary>
|
| 839 |
<param name="x"> the first value </param>
|
| 840 |
<param name="y"> the second value to subtract from the first </param>
|
| 841 |
<returns> the result </returns>
|
| 842 |
<exception cref="ArithmeticException"> if the result overflows a long
|
| 843 |
@since 1.8 </exception>
|
| 844 |
Public Function subtractExact(x As Long, y As Long) As Long
|
| 845 |
Dim r As Long = x - y
|
| 846 |
HD 2-12 Overflow iff the arguments have different signs and
|
| 847 |
the sign of the result is different than the sign of x
|
| 848 |
If ((x Xor y) And (x Xor r)) < 0 Then Throw New ArithmeticException("long overflow")
|
| 849 |
Return r
|
| 850 |
End Function
|
| 851 |
|
| 852 |
|
| 853 |
Returns the product of the arguments,
|
| 854 |
throwing an exception if the result overflows an {@code int}.
|
| 855 |
</summary>
|
| 856 |
<param name="x"> the first value </param>
|
| 857 |
<param name="y"> the second value </param>
|
| 858 |
<returns> the result </returns>
|
| 859 |
<exception cref="ArithmeticException"> if the result overflows an int
|
| 860 |
@since 1.8 </exception>
|
| 861 |
Public Function multiplyExact(x As Integer, y As Integer) As Integer
|
| 862 |
Dim r As Long = CLng(x) * CLng(y)
|
| 863 |
If CInt(r) <> r Then Throw New ArithmeticException("integer overflow")
|
| 864 |
Return CInt(r)
|
| 865 |
End Function
|
| 866 |
|
| 867 |
|
| 868 |
Returns the product of the arguments,
|
| 869 |
throwing an exception if the result overflows a {@code long}.
|
| 870 |
</summary>
|
| 871 |
<param name="x"> the first value </param>
|
| 872 |
<param name="y"> the second value </param>
|
| 873 |
<returns> the result </returns>
|
| 874 |
<exception cref="ArithmeticException"> if the result overflows a long
|
| 875 |
@since 1.8 </exception>
|
| 876 |
Public Function multiplyExact(x As Long, y As Long) As Long
|
| 877 |
Dim r As Long = x * y
|
| 878 |
Dim ax As Long = sys.Abs(x)
|
| 879 |
Dim ay As Long = sys.Abs(y)
|
| 880 |
If (CInt(CUInt((ax Or ay)) >> 31 <> 0)) Then
|
| 881 |
Some bits greater than 2^31 that might cause overflow
|
| 882 |
Check the result using the divide operator
|
| 883 |
and check for the special case of java.lang.[Long].MIN_VALUE * -1
|
| 884 |
If ((y <> 0) AndAlso (r \ y <> x)) OrElse (x = [Int64].MinValue AndAlso y = -1) Then Throw New ArithmeticException("long overflow")
|
| 885 |
End If
|
| 886 |
Return r
|
| 887 |
End Function
|
| 888 |
|
| 889 |
|
| 890 |
Returns the argument incremented by one, throwing an exception if the
|
| 891 |
result overflows an {@code int}.
|
| 892 |
</summary>
|
| 893 |
<param name="a"> the value to increment </param>
|
| 894 |
<returns> the result </returns>
|
| 895 |
<exception cref="ArithmeticException"> if the result overflows an int
|
| 896 |
@since 1.8 </exception>
|
| 897 |
Public Function incrementExact(a As Integer) As Integer
|
| 898 |
If a = [Int32].MaxValue Then Throw New ArithmeticException("integer overflow")
|
| 899 |
|
| 900 |
Return a + 1
|
| 901 |
End Function
|
| 902 |
|
| 903 |
|
| 904 |
Returns the argument incremented by one, throwing an exception if the
|
| 905 |
result overflows a {@code long}.
|
| 906 |
</summary>
|
| 907 |
<param name="a"> the value to increment </param>
|
| 908 |
<returns> the result </returns>
|
| 909 |
<exception cref="ArithmeticException"> if the result overflows a long
|
| 910 |
@since 1.8 </exception>
|
| 911 |
Public Function incrementExact(a As Long) As Long
|
| 912 |
If a = [Int64].MaxValue Then Throw New ArithmeticException("long overflow")
|
| 913 |
|
| 914 |
Return a + 1L
|
| 915 |
End Function
|
| 916 |
|
| 917 |
|
| 918 |
Returns the argument decremented by one, throwing an exception if the
|
| 919 |
result overflows an {@code int}.
|
| 920 |
</summary>
|
| 921 |
<param name="a"> the value to decrement </param>
|
| 922 |
<returns> the result </returns>
|
| 923 |
<exception cref="ArithmeticException"> if the result overflows an int
|
| 924 |
@since 1.8 </exception>
|
| 925 |
Public Function decrementExact(a As Integer) As Integer
|
| 926 |
If a = [Int32].MinValue Then Throw New ArithmeticException("integer overflow")
|
| 927 |
|
| 928 |
Return a - 1
|
| 929 |
End Function
|
| 930 |
|
| 931 |
|
| 932 |
Returns the argument decremented by one, throwing an exception if the
|
| 933 |
result overflows a {@code long}.
|
| 934 |
</summary>
|
| 935 |
<param name="a"> the value to decrement </param>
|
| 936 |
<returns> the result </returns>
|
| 937 |
<exception cref="ArithmeticException"> if the result overflows a long
|
| 938 |
@since 1.8 </exception>
|
| 939 |
Public Function decrementExact(a As Long) As Long
|
| 940 |
If a = [Int64].MinValue Then Throw New ArithmeticException("long overflow")
|
| 941 |
|
| 942 |
Return a - 1L
|
| 943 |
End Function
|
| 944 |
|
| 945 |
|
| 946 |
Returns the negation of the argument, throwing an exception if the
|
| 947 |
result overflows an {@code int}.
|
| 948 |
</summary>
|
| 949 |
<param name="a"> the value to negate </param>
|
| 950 |
<returns> the result </returns>
|
| 951 |
<exception cref="ArithmeticException"> if the result overflows an int
|
| 952 |
@since 1.8 </exception>
|
| 953 |
Public Function negateExact(a As Integer) As Integer
|
| 954 |
If a = [Int32].MinValue Then Throw New ArithmeticException("integer overflow")
|
| 955 |
|
| 956 |
Return -a
|
| 957 |
End Function
|
| 958 |
|
| 959 |
|
| 960 |
Returns the negation of the argument, throwing an exception if the
|
| 961 |
result overflows a {@code long}.
|
| 962 |
</summary>
|
| 963 |
<param name="a"> the value to negate </param>
|
| 964 |
<returns> the result </returns>
|
| 965 |
<exception cref="ArithmeticException"> if the result overflows a long
|
| 966 |
@since 1.8 </exception>
|
| 967 |
Public Function negateExact(a As Long) As Long
|
| 968 |
If a = [Int64].MinValue Then Throw New ArithmeticException("long overflow")
|
| 969 |
|
| 970 |
Return -a
|
| 971 |
End Function
|
| 972 |
|
| 973 |
|
| 974 |
Returns the value of the {@code long} argument;
|
| 975 |
throwing an exception if the value overflows an {@code int}.
|
| 976 |
</summary>
|
| 977 |
<param name="value"> the long value </param>
|
| 978 |
<returns> the argument as an int </returns>
|
| 979 |
<exception cref="ArithmeticException"> if the {@code argument} overflows an int
|
| 980 |
@since 1.8 </exception>
|
| 981 |
Public Function toIntExact(value As Long) As Integer
|
| 982 |
If CInt(value) <> value Then Throw New ArithmeticException("integer overflow")
|
| 983 |
Return CInt(value)
|
| 984 |
End Function
|
| 985 |
|
| 986 |
|
| 987 |
Returns the largest (closest to positive infinity)
|
| 988 |
{@code int} value that is less than or equal to the algebraic quotient.
|
| 989 |
There is one special case, if the dividend is the
|
| 990 |
Integer#MIN_VALUE java.lang.[Integer].MIN_VALUE"/> and the divisor is {@code -1},
|
| 991 |
then integer overflow occurs and
|
| 992 |
the result is equal to the {@code java.lang.[Integer].MIN_VALUE}.
|
| 993 |
|
| 994 |
Normal integer division operates under the round to zero rounding mode
|
| 995 |
(truncation). This operation instead acts under the round toward
|
| 996 |
negative infinity (floor) rounding mode.
|
| 997 |
The floor rounding mode gives different results than truncation
|
| 998 |
when the exact result is negative.
|
| 999 |
|
| 1000 |
+ If the signs of the arguments are the same, the results of
|
| 1001 |
{@code floorDiv} and the {@code /} operator are the same.
|
| 1002 |
For example, {@code floorDiv(4, 3) == 1} and {@code (4 / 3) == 1}.
|
| 1003 |
+ If the signs of the arguments are different, the quotient is negative and
|
| 1004 |
{@code floorDiv} returns the integer less than or equal to the quotient
|
| 1005 |
and the {@code /} operator returns the integer closest to zero.
|
| 1006 |
For example, {@code floorDiv(-4, 3) == -2},
|
| 1007 |
whereas {@code (-4 / 3) == -1}.
|
| 1008 |
</summary>
|
| 1009 |
<param name="x"> the dividend </param>
|
| 1010 |
<param name="y"> the divisor </param>
|
| 1011 |
<returns> the largest (closest to positive infinity)
|
| 1012 |
{@code int} value that is less than or equal to the algebraic quotient. </returns>
|
| 1013 |
<exception cref="ArithmeticException"> if the divisor {@code y} is zero </exception>
|
| 1014 |
Public Function floorDiv(x As Integer, y As Integer) As Integer
|
| 1015 |
Dim r As Integer = x \ y
|
| 1016 |
if the signs are different and modulo not zero, round down
|
| 1017 |
If (x Xor y) < 0 AndAlso (r * y <> x) Then r -= 1
|
| 1018 |
Return r
|
| 1019 |
End Function
|
| 1020 |
|
| 1021 |
|
| 1022 |
Returns the largest (closest to positive infinity)
|
| 1023 |
{@code long} value that is less than or equal to the algebraic quotient.
|
| 1024 |
There is one special case, if the dividend is the
|
| 1025 |
Long#MIN_VALUE java.lang.[Long].MIN_VALUE"/> and the divisor is {@code -1},
|
| 1026 |
then integer overflow occurs and
|
| 1027 |
the result is equal to the {@code java.lang.[Long].MIN_VALUE}.
|
| 1028 |
|
| 1029 |
Normal integer division operates under the round to zero rounding mode
|
| 1030 |
(truncation). This operation instead acts under the round toward
|
| 1031 |
negative infinity (floor) rounding mode.
|
| 1032 |
The floor rounding mode gives different results than truncation
|
| 1033 |
when the exact result is negative.
|
| 1034 |
|
| 1035 |
For examples, see #floorDiv(int, int)"/>.
|
| 1036 |
</summary>
|
| 1037 |
<param name="x"> the dividend </param>
|
| 1038 |
<param name="y"> the divisor </param>
|
| 1039 |
<returns> the largest (closest to positive infinity)
|
| 1040 |
{@code long} value that is less than or equal to the algebraic quotient. </returns>
|
| 1041 |
<exception cref="ArithmeticException"> if the divisor {@code y} is zero </exception>
|
| 1042 |
Public Function floorDiv(x As Long, y As Long) As Long
|
| 1043 |
Dim r As Long = x \ y
|
| 1044 |
if the signs are different and modulo not zero, round down
|
| 1045 |
If (x Xor y) < 0 AndAlso (r * y <> x) Then r -= 1
|
| 1046 |
Return r
|
| 1047 |
End Function
|
| 1048 |
|
| 1049 |
|
| 1050 |
Returns the floor modulus of the {@code int} arguments.
|
| 1051 |
|
| 1052 |
The floor modulus is {@code x - (floorDiv(x, y) * y)},
|
| 1053 |
has the same sign as the divisor {@code y}, and
|
| 1054 |
is in the range of {@code -abs(y) < r < +abs(y)}.
|
| 1055 |
|
| 1056 |
|
| 1057 |
The relationship between {@code floorDiv} and {@code floorMod} is such that:
|
| 1058 |
|
| 1059 |
+ {@code floorDiv(x, y) * y + floorMod(x, y) == x}
|
| 1060 |
|
| 1061 |
|
| 1062 |
The difference in values between {@code floorMod} and
|
| 1063 |
the {@code %} operator is due to the difference between
|
| 1064 |
{@code floorDiv} that returns the integer less than or equal to the quotient
|
| 1065 |
and the {@code /} operator that returns the integer closest to zero.
|
| 1066 |
|
| 1067 |
Examples:
|
| 1068 |
|
| 1069 |
+ If the signs of the arguments are the same, the results
|
| 1070 |
of {@code floorMod} and the {@code %} operator are the same.
|
| 1071 |
|
| 1072 |
+ {@code floorMod(4, 3) == 1}; and {@code (4 % 3) == 1}
|
| 1073 |
|
| 1074 |
+ If the signs of the arguments are different, the results differ from the {@code %} operator.
|
| 1075 |
|
| 1076 |
+ {@code floorMod(+4, -3) == -2}; and {@code (+4 % -3) == +1}
|
| 1077 |
+ {@code floorMod(-4, +3) == +2}; and {@code (-4 % +3) == -1}
|
| 1078 |
+ {@code floorMod(-4, -3) == -1}; and {@code (-4 % -3) == -1 }
|
| 1079 |
|
| 1080 |
|
| 1081 |
|
| 1082 |
|
| 1083 |
If the signs of arguments are unknown and a positive modulus
|
| 1084 |
is needed it can be computed as {@code (floorMod(x, y) + abs(y)) % abs(y)}.
|
| 1085 |
</summary>
|
| 1086 |
<param name="x"> the dividend </param>
|
| 1087 |
<param name="y"> the divisor </param>
|
| 1088 |
<returns> the floor modulus {@code x - (floorDiv(x, y) * y)} </returns>
|
| 1089 |
<exception cref="ArithmeticException"> if the divisor {@code y} is zero </exception>
|
| 1090 |
Public Function floorMod(x As Integer, y As Integer) As Integer
|
| 1091 |
Dim r As Integer = x - floorDiv(x, y) * y
|
| 1092 |
Return r
|
| 1093 |
End Function
|
| 1094 |
|
| 1095 |
|
| 1096 |
Returns the floor modulus of the {@code long} arguments.
|
| 1097 |
|
| 1098 |
The floor modulus is {@code x - (floorDiv(x, y) * y)},
|
| 1099 |
has the same sign as the divisor {@code y}, and
|
| 1100 |
is in the range of {@code -abs(y) < r < +abs(y)}.
|
| 1101 |
|
| 1102 |
|
| 1103 |
The relationship between {@code floorDiv} and {@code floorMod} is such that:
|
| 1104 |
|
| 1105 |
+ {@code floorDiv(x, y) * y + floorMod(x, y) == x}
|
| 1106 |
|
| 1107 |
|
| 1108 |
For examples, see #floorMod(int, int)"/>.
|
| 1109 |
</summary>
|
| 1110 |
<param name="x"> the dividend </param>
|
| 1111 |
<param name="y"> the divisor </param>
|
| 1112 |
<returns> the floor modulus {@code x - (floorDiv(x, y) * y)} </returns>
|
| 1113 |
<exception cref="ArithmeticException"> if the divisor {@code y} is zero </exception>
|
| 1114 |
Public Function floorMod(x As Long, y As Long) As Long
|
| 1115 |
Return x - floorDiv(x, y) * y
|
| 1116 |
End Function
|
| 1117 |
|
| 1118 |
|
| 1119 |
Returns the absolute value of an {@code int} value.
|
| 1120 |
If the argument is not negative, the argument is returned.
|
| 1121 |
If the argument is negative, the negation of the argument is returned.
|
| 1122 |
|
| 1123 |
Note that if the argument is equal to the value of
|
| 1124 |
Integer#MIN_VALUE"/>, the most negative representable
|
| 1125 |
{@code int} value, the result is that same value, which is
|
| 1126 |
negative.
|
| 1127 |
</summary>
|
| 1128 |
<param name="a"> the argument whose absolute value is to be determined </param>
|
| 1129 |
<returns> the absolute value of the argument. </returns>
|
| 1130 |
Public Function abs(a As Integer) As Integer
|
| 1131 |
Return If(a < 0, -a, a)
|
| 1132 |
End Function
|
| 1133 |
|
| 1134 |
|
| 1135 |
Returns the absolute value of a {@code long} value.
|
| 1136 |
If the argument is not negative, the argument is returned.
|
| 1137 |
If the argument is negative, the negation of the argument is returned.
|
| 1138 |
|
| 1139 |
Note that if the argument is equal to the value of
|
| 1140 |
Long#MIN_VALUE"/>, the most negative representable
|
| 1141 |
{@code long} value, the result is that same value, which
|
| 1142 |
is negative.
|
| 1143 |
</summary>
|
| 1144 |
<param name="a"> the argument whose absolute value is to be determined </param>
|
| 1145 |
<returns> the absolute value of the argument. </returns>
|
| 1146 |
Public Function abs(a As Long) As Long
|
| 1147 |
Return If(a < 0, -a, a)
|
| 1148 |
End Function
|
| 1149 |
|
| 1150 |
|
| 1151 |
Returns the absolute value of a {@code float} value.
|
| 1152 |
If the argument is not negative, the argument is returned.
|
| 1153 |
If the argument is negative, the negation of the argument is returned.
|
| 1154 |
Special cases:
|
| 1155 |
+ If the argument is positive zero or negative zero, the
|
| 1156 |
result is positive zero.
|
| 1157 |
+ If the argument is infinite, the result is positive infinity.
|
| 1158 |
+ If the argument is NaN, the result is NaN.
|
| 1159 |
In other words, the result is the same as the value of the expression:
|
| 1160 |
{@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))}
|
| 1161 |
</summary>
|
| 1162 |
<param name="a"> the argument whose absolute value is to be determined </param>
|
| 1163 |
<returns> the absolute value of the argument. </returns>
|
| 1164 |
Public Function abs(a As Single) As Single
|
| 1165 |
Return If(a <= 0.0F, 0.0F - a, a)
|
| 1166 |
End Function
|
| 1167 |
|
| 1168 |
|
| 1169 |
Returns the absolute value of a {@code double} value.
|
| 1170 |
If the argument is not negative, the argument is returned.
|
| 1171 |
If the argument is negative, the negation of the argument is returned.
|
| 1172 |
Special cases:
|
| 1173 |
+ If the argument is positive zero or negative zero, the result
|
| 1174 |
is positive zero.
|
| 1175 |
+ If the argument is infinite, the result is positive infinity.
|
| 1176 |
+ If the argument is NaN, the result is NaN.
|
| 1177 |
In other words, the result is the same as the value of the expression:
|
| 1178 |
{@code java.lang.[Double].longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)}
|
| 1179 |
</summary>
|
| 1180 |
<param name="a"> the argument whose absolute value is to be determined </param>
|
| 1181 |
<returns> the absolute value of the argument. </returns>
|
| 1182 |
Public Function abs(a As Double) As Double
|
| 1183 |
Return If(a <= 0.0R, 0.0R - a, a)
|
| 1184 |
End Function
|
| 1185 |
|
| 1186 |
|
| 1187 |
Returns the greater of two {@code int} values. That is, the
|
| 1188 |
result is the argument closer to the value of
|
| 1189 |
Integer#MAX_VALUE"/>. If the arguments have the same value,
|
| 1190 |
the result is that same value.
|
| 1191 |
</summary>
|
| 1192 |
<param name="a"> an argument. </param>
|
| 1193 |
<param name="b"> another argument. </param>
|
| 1194 |
<returns> the larger of {@code a} and {@code b}. </returns>
|
| 1195 |
Public Function max(a As Integer, b As Integer) As Integer
|
| 1196 |
Return If(a >= b, a, b)
|
| 1197 |
End Function
|
| 1198 |
|
| 1199 |
|
| 1200 |
Returns the greater of two {@code long} values. That is, the
|
| 1201 |
result is the argument closer to the value of
|
| 1202 |
Long#MAX_VALUE"/>. If the arguments have the same value,
|
| 1203 |
the result is that same value.
|
| 1204 |
</summary>
|
| 1205 |
<param name="a"> an argument. </param>
|
| 1206 |
<param name="b"> another argument. </param>
|
| 1207 |
<returns> the larger of {@code a} and {@code b}. </returns>
|
| 1208 |
Public Function max(a As Long, b As Long) As Long
|
| 1209 |
Return If(a >= b, a, b)
|
| 1210 |
End Function
|
| 1211 |
|
| 1212 |
'Use raw bit-wise conversions on guaranteed non-NaN arguments.
|
| 1213 |
|
| 1214 |
|
| 1215 |
|
| 1216 |
'
|
| 1217 |
'Returns the greater of two {@code float} values. That is,
|
| 1218 |
'the result is the argument closer to positive infinity. If the
|
| 1219 |
'arguments have the same value, the result is that same
|
| 1220 |
'value. If either value is NaN, then the result is NaN. Unlike
|
| 1221 |
'the numerical comparison operators, this method considers
|
| 1222 |
'negative zero to be strictly smaller than positive zero. If one
|
| 1223 |
'argument is positive zero and the other negative zero, the
|
| 1224 |
'result is positive zero.
|
| 1225 |
'</summary>
|
| 1226 |
'<param name="a"> an argument. </param>
|
| 1227 |
'<param name="b"> another argument. </param>
|
| 1228 |
'<returns> the larger of {@code a} and {@code b}. </returns>
|
| 1229 |
|
| 1230 |
If a <> a Then Return a a is NaN
|
| 1231 |
If (a = 0.0F) AndAlso (b = 0.0F) AndAlso (Float.floatToRawIntBits(a) = negativeZeroFloatBits) Then Return b
|
| 1232 |
Return If(a >= b, a, b)
|
| 1233 |
|
| 1234 |
|
| 1235 |
'
|
| 1236 |
'Returns the greater of two {@code double} values. That
|
| 1237 |
'is, the result is the argument closer to positive infinity. If
|
| 1238 |
'the arguments have the same value, the result is that same
|
| 1239 |
'value. If either value is NaN, then the result is NaN. Unlike
|
| 1240 |
'the numerical comparison operators, this method considers
|
| 1241 |
'negative zero to be strictly smaller than positive zero. If one
|
| 1242 |
'argument is positive zero and the other negative zero, the
|
| 1243 |
'result is positive zero.
|
| 1244 |
'</summary>
|
| 1245 |
'<param name="a"> an argument. </param>
|
| 1246 |
'<param name="b"> another argument. </param>
|
| 1247 |
'<returns> the larger of {@code a} and {@code b}. </returns>
|
| 1248 |
|
| 1249 |
If a <> a Then Return a a is NaN
|
| 1250 |
If (a = 0.0R) AndAlso (b = 0.0R) AndAlso (Double.doubleToRawLongBits(a) = negativeZeroDoubleBits) Then Return b
|
| 1251 |
Return If(a >= b, a, b)
|
| 1252 |
|
| 1253 |
|
| 1254 |
|
| 1255 |
Returns the smaller of two {@code int} values. That is,
|
| 1256 |
the result the argument closer to the value of
|
| 1257 |
Integer#MIN_VALUE"/>. If the arguments have the same
|
| 1258 |
value, the result is that same value.
|
| 1259 |
</summary>
|
| 1260 |
<param name="a"> an argument. </param>
|
| 1261 |
<param name="b"> another argument. </param>
|
| 1262 |
<returns> the smaller of {@code a} and {@code b}. </returns>
|
| 1263 |
Public Function min(a As Integer, b As Integer) As Integer
|
| 1264 |
Return If(a <= b, a, b)
|
| 1265 |
End Function
|
| 1266 |
|
| 1267 |
|
| 1268 |
Returns the smaller of two {@code long} values. That is,
|
| 1269 |
the result is the argument closer to the value of
|
| 1270 |
Long#MIN_VALUE"/>. If the arguments have the same
|
| 1271 |
value, the result is that same value.
|
| 1272 |
</summary>
|
| 1273 |
<param name="a"> an argument. </param>
|
| 1274 |
<param name="b"> another argument. </param>
|
| 1275 |
<returns> the smaller of {@code a} and {@code b}. </returns>
|
| 1276 |
Public Function min(a As Long, b As Long) As Long
|
| 1277 |
Return If(a <= b, a, b)
|
| 1278 |
End Function
|
| 1279 |
|
| 1280 |
'
|
| 1281 |
'Returns the smaller of two {@code float} values. That is,
|
| 1282 |
'the result is the value closer to negative infinity. If the
|
| 1283 |
'arguments have the same value, the result is that same
|
| 1284 |
'value. If either value is NaN, then the result is NaN. Unlike
|
| 1285 |
'the numerical comparison operators, this method considers
|
| 1286 |
'negative zero to be strictly smaller than positive zero. If
|
| 1287 |
'one argument is positive zero and the other is negative zero,
|
| 1288 |
'the result is negative zero.
|
| 1289 |
'</summary>
|
| 1290 |
'<param name="a"> an argument. </param>
|
| 1291 |
'<param name="b"> another argument. </param>
|
| 1292 |
'<returns> the smaller of {@code a} and {@code b}. </returns>
|
| 1293 |
|
| 1294 |
If a <> a Then Return a a is NaN
|
| 1295 |
If (a = 0.0F) AndAlso (b = 0.0F) AndAlso (Float.floatToRawIntBits(b) = negativeZeroFloatBits) Then Return b
|
| 1296 |
Return If(a <= b, a, b)
|
| 1297 |
|
| 1298 |
|
| 1299 |
'
|
| 1300 |
'Returns the smaller of two {@code double} values. That
|
| 1301 |
'is, the result is the value closer to negative infinity. If the
|
| 1302 |
'arguments have the same value, the result is that same
|
| 1303 |
'value. If either value is NaN, then the result is NaN. Unlike
|
| 1304 |
'the numerical comparison operators, this method considers
|
| 1305 |
'negative zero to be strictly smaller than positive zero. If one
|
| 1306 |
'argument is positive zero and the other is negative zero, the
|
| 1307 |
'result is negative zero.
|
| 1308 |
'</summary>
|
| 1309 |
'<param name="a"> an argument. </param>
|
| 1310 |
'<param name="b"> another argument. </param>
|
| 1311 |
'<returns> the smaller of {@code a} and {@code b}. </returns>
|
| 1312 |
|
| 1313 |
If a <> a Then Return a a is NaN
|
| 1314 |
If (a = 0.0R) AndAlso (b = 0.0R) AndAlso (Double.doubleToRawLongBits(b) = negativeZeroDoubleBits) Then Return b
|
| 1315 |
Return If(a <= b, a, b)
|
| 1316 |
|
| 1317 |
|
| 1318 |
'
|
| 1319 |
'Returns the size of an ulp of the argument. An ulp, unit in
|
| 1320 |
'the last place, of a {@code double} value is the positive
|
| 1321 |
'distance between this floating-point value and the {@code
|
| 1322 |
'double} value next larger in magnitude. Note that for non-NaN
|
| 1323 |
'_x_, <code>ulp(-_x_) == ulp(_x_)</code>.
|
| 1324 |
'
|
| 1325 |
'Special Cases:
|
| 1326 |
'
|
| 1327 |
'+ If the argument is NaN, then the result is NaN.
|
| 1328 |
'+ If the argument is positive or negative infinity, then the
|
| 1329 |
'result is positive infinity.
|
| 1330 |
'+ If the argument is positive or negative zero, then the result is
|
| 1331 |
'{@code java.lang.[Double].MIN_VALUE}.
|
| 1332 |
'+ If the argument is ±{@code java.lang.[Double].MAX_VALUE}, then
|
| 1333 |
'the result is equal to 2<sup>971</sup>.
|
| 1334 |
'
|
| 1335 |
'</summary>
|
| 1336 |
'<param name="d"> the floating-point value whose ulp is to be returned </param>
|
| 1337 |
'<returns> the size of an ulp of the argument
|
| 1338 |
'@author Joseph D. Darcy
|
| 1339 |
'@since 1.5 </returns>
|
| 1340 |
|
| 1341 |
Dim exp As Integer = getExponent(d)
|
| 1342 |
|
| 1343 |
Select Case exp
|
| 1344 |
Case sun.misc.DoubleConsts.MAX_EXPONENT + 1 NaN or infinity
|
| 1345 |
Return sys.Abs(d)
|
| 1346 |
|
| 1347 |
Case sun.misc.DoubleConsts.MIN_EXPONENT - 1 zero or subnormal
|
| 1348 |
Return Java.lang.[Double].MIN_VALUE
|
| 1349 |
|
| 1350 |
Case Else
|
| 1351 |
Debug.Assert(exp <= sun.misc.DoubleConsts.MAX_EXPONENT AndAlso exp >= sun.misc.DoubleConsts.MIN_EXPONENT)
|
| 1352 |
|
| 1353 |
ulp(x) is usually 2^(SIGNIFICAND_WIDTH-1)*(2^ilogb(x))
|
| 1354 |
exp = exp - (sun.misc.DoubleConsts.SIGNIFICAND_WIDTH - 1)
|
| 1355 |
If exp >= sun.misc.DoubleConsts.MIN_EXPONENT Then
|
| 1356 |
Return powerOfTwoD(exp)
|
| 1357 |
Else
|
| 1358 |
return a subnormal result; left shift integer
|
| 1359 |
representation of java.lang.[Double].MIN_VALUE appropriate
|
| 1360 |
number of positions
|
| 1361 |
Return Java.lang.[Double].longBitsToDouble(1L << (exp - (sun.misc.DoubleConsts.MIN_EXPONENT - (sun.misc.DoubleConsts.SIGNIFICAND_WIDTH - 1))))
|
| 1362 |
End If
|
| 1363 |
End Select
|
| 1364 |
|
| 1365 |
|
| 1366 |
'
|
| 1367 |
'Returns the size of an ulp of the argument. An ulp, unit in
|
| 1368 |
'the last place, of a {@code float} value is the positive
|
| 1369 |
'distance between this floating-point value and the {@code
|
| 1370 |
'float} value next larger in magnitude. Note that for non-NaN
|
| 1371 |
'_x_, <code>ulp(-_x_) == ulp(_x_)</code>.
|
| 1372 |
'
|
| 1373 |
'Special Cases:
|
| 1374 |
'
|
| 1375 |
'+ If the argument is NaN, then the result is NaN.
|
| 1376 |
'+ If the argument is positive or negative infinity, then the
|
| 1377 |
'result is positive infinity.
|
| 1378 |
'+ If the argument is positive or negative zero, then the result is
|
| 1379 |
'{@code Float.MIN_VALUE}.
|
| 1380 |
'+ If the argument is ±{@code Float.MAX_VALUE}, then
|
| 1381 |
'the result is equal to 2<sup>104</sup>.
|
| 1382 |
'
|
| 1383 |
'</summary>
|
| 1384 |
'<param name="f"> the floating-point value whose ulp is to be returned </param>
|
| 1385 |
'<returns> the size of an ulp of the argument
|
| 1386 |
'@author Joseph D. Darcy
|
| 1387 |
'@since 1.5 </returns>
|
| 1388 |
|
| 1389 |
Dim exp As Integer = getExponent(f)
|
| 1390 |
|
| 1391 |
Select Case exp
|
| 1392 |
Case sun.misc.FloatConsts.MAX_EXPONENT + 1 NaN or infinity
|
| 1393 |
Return sys.Abs(f)
|
| 1394 |
|
| 1395 |
Case sun.misc.FloatConsts.MIN_EXPONENT - 1 zero or subnormal
|
| 1396 |
Return sun.misc.FloatConsts.MIN_VALUE
|
| 1397 |
|
| 1398 |
Case Else
|
| 1399 |
Debug.Assert(exp <= sun.misc.FloatConsts.MAX_EXPONENT AndAlso exp >= sun.misc.FloatConsts.MIN_EXPONENT)
|
| 1400 |
|
| 1401 |
ulp(x) is usually 2^(SIGNIFICAND_WIDTH-1)*(2^ilogb(x))
|
| 1402 |
exp = exp - (sun.misc.FloatConsts.SIGNIFICAND_WIDTH - 1)
|
| 1403 |
If exp >= sun.misc.FloatConsts.MIN_EXPONENT Then
|
| 1404 |
Return powerOfTwoF(exp)
|
| 1405 |
Else
|
| 1406 |
return a subnormal result; left shift integer
|
| 1407 |
representation of FloatConsts.MIN_VALUE appropriate
|
| 1408 |
number of positions
|
| 1409 |
Return Float.intBitsToFloat(1 << (exp - (sun.misc.FloatConsts.MIN_EXPONENT - (sun.misc.FloatConsts.SIGNIFICAND_WIDTH - 1))))
|
| 1410 |
End If
|
| 1411 |
End Select
|
| 1412 |
|
| 1413 |
|
| 1414 |
'
|
| 1415 |
'Returns the signum function of the argument; zero if the argument
|
| 1416 |
'is zero, 1.0 if the argument is greater than zero, -1.0 if the
|
| 1417 |
'argument is less than zero.
|
| 1418 |
'
|
| 1419 |
'Special Cases:
|
| 1420 |
'
|
| 1421 |
'+ If the argument is NaN, then the result is NaN.
|
| 1422 |
'+ If the argument is positive zero or negative zero, then the
|
| 1423 |
' result is the same as the argument.
|
| 1424 |
'
|
| 1425 |
'</summary>
|
| 1426 |
'<param name="d"> the floating-point value whose signum is to be returned </param>
|
| 1427 |
'<returns> the signum function of the argument
|
| 1428 |
'@author Joseph D. Darcy
|
| 1429 |
'@since 1.5 </returns>
|
| 1430 |
|
| 1431 |
Return If(d = 0.0 OrElse [Double].IsNaN(d), d, copySign(1.0, d))
|
| 1432 |
|
| 1433 |
|
| 1434 |
'
|
| 1435 |
'Returns the signum function of the argument; zero if the argument
|
| 1436 |
'is zero, 1.0f if the argument is greater than zero, -1.0f if the
|
| 1437 |
'argument is less than zero.
|
| 1438 |
'
|
| 1439 |
'Special Cases:
|
| 1440 |
'
|
| 1441 |
'+ If the argument is NaN, then the result is NaN.
|
| 1442 |
'+ If the argument is positive zero or negative zero, then the
|
| 1443 |
' result is the same as the argument.
|
| 1444 |
'
|
| 1445 |
'</summary>
|
| 1446 |
'<param name="f"> the floating-point value whose signum is to be returned </param>
|
| 1447 |
'<returns> the signum function of the argument
|
| 1448 |
'@author Joseph D. Darcy
|
| 1449 |
'@since 1.5 </returns>
|
| 1450 |
|
| 1451 |
Return If(f = 0.0F OrElse Single.IsNaN(f), f, copySign(1.0F, f))
|
| 1452 |
|
| 1453 |
|
| 1454 |
|
| 1455 |
Returns the hyperbolic sine of a {@code double} value.
|
| 1456 |
The hyperbolic sine of _x_ is defined to be
|
| 1457 |
(_e<sup>x</sup> - e<sup>-x</sup>_)/2
|
| 1458 |
where _e_ is Math#E Euler
|
| 1459 |
|
| 1460 |
Special cases:
|
| 1461 |
|
| 1462 |
|
| 1463 |
+ If the argument is NaN, then the result is NaN.
|
| 1464 |
|
| 1465 |
+ If the argument is infinite, then the result is an infinity
|
| 1466 |
with the same sign as the argument.
|
| 1467 |
|
| 1468 |
+ If the argument is zero, then the result is a zero with the
|
| 1469 |
same sign as the argument.
|
| 1470 |
|
| 1471 |
|
| 1472 |
|
| 1473 |
The computed result must be within 2.5 ulps of the exact result.
|
| 1474 |
</summary>
|
| 1475 |
<param name="x"> The number whose hyperbolic sine is to be returned. </param>
|
| 1476 |
<returns> The hyperbolic sine of {@code x}.
|
| 1477 |
@since 1.5 </returns>
|
| 1478 |
Public Function sinh(x As Double) As Double
|
| 1479 |
Return sys.Sinh(x)
|
| 1480 |
End Function
|
| 1481 |
|
| 1482 |
|
| 1483 |
Returns the hyperbolic cosine of a {@code double} value.
|
| 1484 |
The hyperbolic cosine of _x_ is defined to be
|
| 1485 |
(_e<sup>x</sup> + e<sup>-x</sup>_)/2
|
| 1486 |
where _e_ is Math#E Euler
|
| 1487 |
|
| 1488 |
Special cases:
|
| 1489 |
|
| 1490 |
|
| 1491 |
+ If the argument is NaN, then the result is NaN.
|
| 1492 |
|
| 1493 |
+ If the argument is infinite, then the result is positive
|
| 1494 |
infinity.
|
| 1495 |
|
| 1496 |
+ If the argument is zero, then the result is {@code 1.0}.
|
| 1497 |
|
| 1498 |
|
| 1499 |
|
| 1500 |
The computed result must be within 2.5 ulps of the exact result.
|
| 1501 |
</summary>
|
| 1502 |
<param name="x"> The number whose hyperbolic cosine is to be returned. </param>
|
| 1503 |
<returns> The hyperbolic cosine of {@code x}.
|
| 1504 |
@since 1.5 </returns>
|
| 1505 |
Public Function cosh(x As Double) As Double
|
| 1506 |
Return sys.Cosh(x)
|
| 1507 |
End Function
|
| 1508 |
|
| 1509 |
|
| 1510 |
Returns the hyperbolic tangent of a {@code double} value.
|
| 1511 |
The hyperbolic tangent of _x_ is defined to be
|
| 1512 |
(_e<sup>x</sup> - e<sup>-x</sup>_)/(_e<sup>x</sup> + e<sup>-x</sup>_),
|
| 1513 |
in other words, {@link Math#sinh
|
| 1514 |
sinh(_x_)}/ Math#cosh cosh(_x_)"/>. Note
|
| 1515 |
that the absolute value of the exact tanh is always less than
|
| 1516 |
1.
|
| 1517 |
|
| 1518 |
Special cases:
|
| 1519 |
|
| 1520 |
|
| 1521 |
+ If the argument is NaN, then the result is NaN.
|
| 1522 |
|
| 1523 |
+ If the argument is zero, then the result is a zero with the
|
| 1524 |
same sign as the argument.
|
| 1525 |
|
| 1526 |
+ If the argument is positive infinity, then the result is
|
| 1527 |
{@code +1.0}.
|
| 1528 |
|
| 1529 |
+ If the argument is negative infinity, then the result is
|
| 1530 |
{@code -1.0}.
|
| 1531 |
|
| 1532 |
|
| 1533 |
|
| 1534 |
The computed result must be within 2.5 ulps of the exact result.
|
| 1535 |
The result of {@code tanh} for any finite input must have
|
| 1536 |
an absolute value less than or equal to 1. Note that once the
|
| 1537 |
exact result of tanh is within 1/2 of an ulp of the limit value
|
| 1538 |
of 1, correctly signed {@code 1.0} should be returned.
|
| 1539 |
</summary>
|
| 1540 |
<param name="x"> The number whose hyperbolic tangent is to be returned. </param>
|
| 1541 |
<returns> The hyperbolic tangent of {@code x}.
|
| 1542 |
@since 1.5 </returns>
|
| 1543 |
Public Function tanh(x As Double) As Double
|
| 1544 |
Return sys.Tanh(x)
|
| 1545 |
End Function
|
| 1546 |
|
| 1547 |
'
|
| 1548 |
'Returns sqrt(_x_<sup>2</sup> +_y_<sup>2</sup>)
|
| 1549 |
'without intermediate overflow or underflow.
|
| 1550 |
'
|
| 1551 |
'Special cases:
|
| 1552 |
'
|
| 1553 |
'
|
| 1554 |
'+ If either argument is infinite, then the result
|
| 1555 |
'is positive infinity.
|
| 1556 |
'
|
| 1557 |
'+ If either argument is NaN and neither argument is infinite,
|
| 1558 |
'then the result is NaN.
|
| 1559 |
'
|
| 1560 |
'
|
| 1561 |
'
|
| 1562 |
'The computed result must be within 1 ulp of the exact
|
| 1563 |
'result. If one parameter is held constant, the results must be
|
| 1564 |
'semi-monotonic in the other parameter.
|
| 1565 |
'</summary>
|
| 1566 |
'<param name="x"> a value </param>
|
| 1567 |
'<param name="y"> a value </param>
|
| 1568 |
'<returns> sqrt(_x_<sup>2</sup> +_y_<sup>2</sup>)
|
| 1569 |
'without intermediate overflow or underflow
|
| 1570 |
'@since 1.5 </returns>
|
| 1571 |
|
| 1572 |
Return sys.hypot(x, y)
|
| 1573 |
|
| 1574 |
|
| 1575 |
'
|
| 1576 |
'Returns _e_<sup>x</sup> -1. Note that for values of
|
| 1577 |
'_x_ near 0, the exact sum of
|
| 1578 |
'{@code expm1(x)} + 1 is much closer to the true
|
| 1579 |
'result of _e_<sup>x</sup> than {@code exp(x)}.
|
| 1580 |
'
|
| 1581 |
'Special cases:
|
| 1582 |
'
|
| 1583 |
'+ If the argument is NaN, the result is NaN.
|
| 1584 |
'
|
| 1585 |
'+ If the argument is positive infinity, then the result is
|
| 1586 |
'positive infinity.
|
| 1587 |
'
|
| 1588 |
'+ If the argument is negative infinity, then the result is
|
| 1589 |
'-1.0.
|
| 1590 |
'
|
| 1591 |
'+ If the argument is zero, then the result is a zero with the
|
| 1592 |
'same sign as the argument.
|
| 1593 |
'
|
| 1594 |
'
|
| 1595 |
'
|
| 1596 |
'The computed result must be within 1 ulp of the exact result.
|
| 1597 |
'Results must be semi-monotonic. The result of
|
| 1598 |
'{@code expm1} for any finite input must be greater than or
|
| 1599 |
'equal to {@code -1.0}. Note that once the exact result of
|
| 1600 |
'_e_<sup>{@code x}</sup> - 1 is within 1/2
|
| 1601 |
'ulp of the limit value -1, {@code -1.0} should be
|
| 1602 |
'returned.
|
| 1603 |
'</summary>
|
| 1604 |
'<param name="x"> the exponent to raise _e_ to in the computation of
|
| 1605 |
' _e_<sup>{@code x}</sup> -1. </param>
|
| 1606 |
'<returns> the value _e_<sup>{@code x}</sup> - 1.
|
| 1607 |
'@since 1.5 </returns>
|
| 1608 |
|
| 1609 |
Return sys.expm1(x)
|
| 1610 |
|
| 1611 |
|
| 1612 |
|
| 1613 |
Returns the natural logarithm of the sum of the argument and 1.
|
| 1614 |
Note that for small values {@code x}, the result of
|
| 1615 |
{@code log1p(x)} is much closer to the true result of ln(1
|
| 1616 |
+ {@code x}) than the floating-point evaluation of
|
| 1617 |
{@code log(1.0+x)}.
|
| 1618 |
|
| 1619 |
Special cases:
|
| 1620 |
|
| 1621 |
|
| 1622 |
|
| 1623 |
+ If the argument is NaN or less than -1, then the result is
|
| 1624 |
NaN.
|
| 1625 |
|
| 1626 |
+ If the argument is positive infinity, then the result is
|
| 1627 |
positive infinity.
|
| 1628 |
|
| 1629 |
+ If the argument is negative one, then the result is
|
| 1630 |
negative infinity.
|
| 1631 |
|
| 1632 |
+ If the argument is zero, then the result is a zero with the
|
| 1633 |
same sign as the argument.
|
| 1634 |
|
| 1635 |
|
| 1636 |
|
| 1637 |
The computed result must be within 1 ulp of the exact result.
|
| 1638 |
Results must be semi-monotonic.
|
| 1639 |
</summary>
|
| 1640 |
<param name="x"> a value </param>
|
| 1641 |
<returns> the value ln({@code x} + 1), the natural
|
| 1642 |
log of {@code x} + 1
|
| 1643 |
@since 1.5 </returns>
|
| 1644 |
<remarks>http://www.johndcook.com/csharp_log_one_plus_x.html</remarks>
|
| 1645 |
Public Function log1p(x As Double) As Double
|
| 1646 |
If x <= -1.0 Then
|
| 1647 |
Return [Double].NaN
|
| 1648 |
End If
|
| 1649 |
|
| 1650 |
If sys.Abs(x) > 0.0001 Then
|
| 1651 |
Return sys.Log(1.0 + x)
|
| 1652 |
End If
|
| 1653 |
|
| 1654 |
Use Taylor approx. log(1 + x) = x - x^2/2 with error roughly x^3/3
|
| 1655 |
Since |x| < 10^-4, |x|^3 < 10^-12, relative error less than 10^-8
|
| 1656 |
Return (-0.5 * x + 1.0) * x
|
| 1657 |
End Function
|
| 1658 |
|
| 1659 |
|
| 1660 |
Computes log(1-x) without losing precision for small values of x.
|
| 1661 |
</summary>
|
| 1662 |
|
| 1663 |
Public Function Log1m(x As Double) As Double
|
| 1664 |
If x >= 1.0 Then
|
| 1665 |
Return [Double].NaN
|
| 1666 |
End If
|
| 1667 |
|
| 1668 |
If sys.Abs(x) > 0.0001 Then
|
| 1669 |
Return sys.Log(1.0 - x)
|
| 1670 |
End If
|
| 1671 |
|
| 1672 |
Use Taylor approx. log(1 + x) = x - x^2/2 with error roughly x^3/3
|
| 1673 |
Since |x| < 10^-4, |x|^3 < 10^-12, relative error less than 10^-8
|
| 1674 |
Return -(0.5 * x + 1.0) * x
|
| 1675 |
End Function
|
| 1676 |
|
| 1677 |
'
|
| 1678 |
'Returns the first floating-point argument with the sign of the
|
| 1679 |
'second floating-point argument. Note that unlike the {@link
|
| 1680 |
'StrictMath#copySign(double, double) StrictMath.copySign}
|
| 1681 |
'method, this method does not require NaN {@code sign}
|
| 1682 |
'arguments to be treated as positive values; implementations are
|
| 1683 |
'permitted to treat some NaN arguments as positive and other NaN
|
| 1684 |
'arguments as negative to allow greater performance.
|
| 1685 |
'</summary>
|
| 1686 |
'<param name="magnitude"> the parameter providing the magnitude of the result </param>
|
| 1687 |
'<span class="xml_comment">''</span><param name="sign"> the parameter providing the sign of the result </param>
|
| 1688 |
'<span class="xml_comment">''</span><returns> a value with the magnitude of {@code magnitude}
|
| 1689 |
'<span class="xml_comment">''</span>and the sign of {@code sign}.
|
| 1690 |
'<span class="xml_comment">''</span>@since 1.6 </returns>
|
| 1691 |
|
| 1692 |
Return Java.lang.[Double].longBitsToDouble((Double.doubleToRawLongBits(sign) And (sun.misc.DoubleConsts.SIGN_BIT_MASK)) Or (Double.doubleToRawLongBits(magnitude) And (sun.misc.DoubleConsts.EXP_BIT_MASK Or sun.misc.DoubleConsts.SIGNIF_BIT_MASK)))
|
| 1693 |
|
| 1694 |
|
| 1695 |
'<span class="xml_comment">''<summary></span>
|
| 1696 |
'<span class="xml_comment">''</span>Returns the first floating-point argument with the sign of the
|
| 1697 |
'<span class="xml_comment">''</span>second floating-point argument. Note that unlike the {@link
|
| 1698 |
'<span class="xml_comment">''</span>StrictMath#copySign(float, float) StrictMath.copySign}
|
| 1699 |
'<span class="xml_comment">''</span>method, this method does not require NaN {@code sign}
|
| 1700 |
'<span class="xml_comment">''</span>arguments to be treated as positive values; implementations are
|
| 1701 |
'<span class="xml_comment">''</span>permitted to treat some NaN arguments as positive and other NaN
|
| 1702 |
'<span class="xml_comment">''</span>arguments as negative to allow greater performance.
|
| 1703 |
'<span class="xml_comment">''</span></summary>
|
| 1704 |
'<span class="xml_comment">''</span><param name="magnitude"> the parameter providing the magnitude of the result </param>
|
| 1705 |
'<span class="xml_comment">''</span><param name="sign"> the parameter providing the sign of the result </param>
|
| 1706 |
'<span class="xml_comment">''</span><returns> a value with the magnitude of {@code magnitude}
|
| 1707 |
'<span class="xml_comment">''</span>and the sign of {@code sign}.
|
| 1708 |
'<span class="xml_comment">''</span>@since 1.6 </returns>
|
| 1709 |
|
| 1710 |
Return Float.intBitsToFloat((Float.floatToRawIntBits(sign) And (sun.misc.FloatConsts.SIGN_BIT_MASK)) Or (Float.floatToRawIntBits(magnitude) And (sun.misc.FloatConsts.EXP_BIT_MASK Or sun.misc.FloatConsts.SIGNIF_BIT_MASK)))
|
| 1711 |
|
| 1712 |
|
| 1713 |
'<span class="xml_comment">''<summary></span>
|
| 1714 |
'<span class="xml_comment">''</span>Returns the unbiased exponent used in the representation of a
|
| 1715 |
'<span class="xml_comment">''</span>{@code float}. Special cases:
|
| 1716 |
'<span class="xml_comment">''</span>
|
| 1717 |
'<span class="xml_comment">''</span>
|
| 1718 |
'<span class="xml_comment">''</span>+ If the argument is NaN or infinite, then the result is
|
| 1719 |
'<span class="xml_comment">''</span> Float#MAX_EXPONENT"/> + 1.
|
| 1720 |
'+ If the argument is zero or subnormal, then the result is
|
| 1721 |
' Float#MIN_EXPONENT"/> -1.
|
| 1722 |
' </summary>
|
| 1723 |
'<param name="f"> a {@code float} value </param>
|
| 1724 |
'<returns> the unbiased exponent of the argument
|
| 1725 |
'@since 1.6 </returns>
|
| 1726 |
|
| 1727 |
|
| 1728 |
* Bitwise convert f to integer, mask out exponent bits, shift
|
| 1729 |
* to the right and then subtract out float's bias adjust to
|
| 1730 |
* get true exponent value
|
| 1731 |
|
| 1732 |
Return ((Float.floatToRawIntBits(f) And sun.misc.FloatConsts.EXP_BIT_MASK) >> (sun.misc.FloatConsts.SIGNIFICAND_WIDTH - 1)) - sun.misc.FloatConsts.EXP_BIAS
|
| 1733 |
|
| 1734 |
|
| 1735 |
'
|
| 1736 |
'Returns the unbiased exponent used in the representation of a
|
| 1737 |
'{@code double}. Special cases:
|
| 1738 |
'
|
| 1739 |
'
|
| 1740 |
'+ If the argument is NaN or infinite, then the result is
|
| 1741 |
' Double#MAX_EXPONENT"/> + 1.
|
| 1742 |
'+ If the argument is zero or subnormal, then the result is
|
| 1743 |
' Double#MIN_EXPONENT"/> -1.
|
| 1744 |
' </summary>
|
| 1745 |
'<param name="d"> a {@code double} value </param>
|
| 1746 |
'<returns> the unbiased exponent of the argument
|
| 1747 |
'@since 1.6 </returns>
|
| 1748 |
|
| 1749 |
|
| 1750 |
* Bitwise convert d to long, mask out exponent bits, shift
|
| 1751 |
* to the right and then subtract out double's bias adjust to
|
| 1752 |
* get true exponent value.
|
| 1753 |
|
| 1754 |
Return CInt(Fix(((Double.doubleToRawLongBits(d) And sun.misc.DoubleConsts.EXP_BIT_MASK) >> (sun.misc.DoubleConsts.SIGNIFICAND_WIDTH - 1)) - sun.misc.DoubleConsts.EXP_BIAS))
|
| 1755 |
|
| 1756 |
|
| 1757 |
'
|
| 1758 |
'Returns the floating-point number adjacent to the first
|
| 1759 |
'argument in the direction of the second argument. If both
|
| 1760 |
'arguments compare as equal the second argument is returned.
|
| 1761 |
'
|
| 1762 |
'
|
| 1763 |
'Special cases:
|
| 1764 |
'
|
| 1765 |
'+ If either argument is a NaN, then NaN is returned.
|
| 1766 |
'
|
| 1767 |
'+ If both arguments are signed zeros, {@code direction}
|
| 1768 |
'is returned unchanged (as implied by the requirement of
|
| 1769 |
'returning the second argument if the arguments compare as
|
| 1770 |
'equal).
|
| 1771 |
'
|
| 1772 |
'+ If {@code start} is
|
| 1773 |
'± Double#MIN_VALUE"/> and {@code direction}
|
| 1774 |
'has a value such that the result should have a smaller
|
| 1775 |
'magnitude, then a zero with the same sign as {@code start}
|
| 1776 |
'is returned.
|
| 1777 |
'
|
| 1778 |
'+ If {@code start} is infinite and
|
| 1779 |
'{@code direction} has a value such that the result should
|
| 1780 |
'have a smaller magnitude, Double#MAX_VALUE"/> with the
|
| 1781 |
'<span class="xml_comment">''</span>same sign as {@code start} is returned.
|
| 1782 |
'<span class="xml_comment">''</span>
|
| 1783 |
'<span class="xml_comment">''</span>+ If {@code start} is equal to ±
|
| 1784 |
'<span class="xml_comment">''</span> Double#MAX_VALUE"/> and {@code direction} has a
|
| 1785 |
'value such that the result should have a larger magnitude, an
|
| 1786 |
'infinity with same sign as {@code start} is returned.
|
| 1787 |
'
|
| 1788 |
'</summary>
|
| 1789 |
'<param name="start"> starting floating-point value </param>
|
| 1790 |
'<param name="direction"> value indicating which of
|
| 1791 |
'{@code start}'s neighbors or {@code start} should
|
| 1792 |
'be returned </param>
|
| 1793 |
'<returns> The floating-point number adjacent to {@code start} in the
|
| 1794 |
'direction of {@code direction}.
|
| 1795 |
'@since 1.6 </returns>
|
| 1796 |
|
| 1797 |
|
| 1798 |
* The cases:
|
| 1799 |
*
|
| 1800 |
* nextAfter(+infinity, 0) == MAX_VALUE
|
| 1801 |
* nextAfter(+infinity, +infinity) == +infinity
|
| 1802 |
* nextAfter(-infinity, 0) == -MAX_VALUE
|
| 1803 |
* nextAfter(-infinity, -infinity) == -infinity
|
| 1804 |
*
|
| 1805 |
* are naturally handled without any additional testing
|
| 1806 |
|
| 1807 |
|
| 1808 |
First check for NaN values
|
| 1809 |
If Java.lang.[Double].IsNaN(start) OrElse Java.lang.[Double].IsNaN(direction) Then
|
| 1810 |
return a NaN derived from the input NaN(s)
|
| 1811 |
Return start + direction
|
| 1812 |
ElseIf start = direction Then
|
| 1813 |
Return direction start > direction or start < direction
|
| 1814 |
Else
|
| 1815 |
Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
|
| 1816 |
then bitwise convert start to java.lang.[Integer].
|
| 1817 |
Dim transducer As Long = Java.lang.[Double].doubleToRawLongBits(start + 0.0R)
|
| 1818 |
|
| 1819 |
|
| 1820 |
* IEEE 754 floating-point numbers are lexicographically
|
| 1821 |
* ordered if treated as signed- magnitude integers .
|
| 1822 |
* Since Java's integers are two's complement,
|
| 1823 |
* incrementing" the two's complement representation of a
|
| 1824 |
* logically negative floating-point value *decrements*
|
| 1825 |
* the signed-magnitude representation. Therefore, when
|
| 1826 |
* the integer representation of a floating-point values
|
| 1827 |
* is less than zero, the adjustment to the representation
|
| 1828 |
* is in the opposite direction than would be expected at
|
| 1829 |
* first .
|
| 1830 |
|
| 1831 |
If direction > start Then Calculate next greater value
|
| 1832 |
transducer = transducer + (If(transducer >= 0L, 1L, -1L)) Calculate next lesser value
|
| 1833 |
Else
|
| 1834 |
Debug.Assert(direction < start)
|
| 1835 |
If transducer > 0L Then
|
| 1836 |
transducer -= 1
|
| 1837 |
Else
|
| 1838 |
If transducer < 0L Then
|
| 1839 |
transducer += 1
|
| 1840 |
|
| 1841 |
* transducer==0, the result is -MIN_VALUE
|
| 1842 |
*
|
| 1843 |
* The transition from zero (implicitly
|
| 1844 |
* positive) to the smallest negative
|
| 1845 |
* signed magnitude value must be done
|
| 1846 |
* explicitly.
|
| 1847 |
|
| 1848 |
Else
|
| 1849 |
transducer = sun.misc.DoubleConsts.SIGN_BIT_MASK Or 1L
|
| 1850 |
End If
|
| 1851 |
End If
|
| 1852 |
End If
|
| 1853 |
|
| 1854 |
Return Java.lang.[Double].longBitsToDouble(transducer)
|
| 1855 |
End If
|
| 1856 |
|
| 1857 |
|
| 1858 |
'<span class="xml_comment">''<summary></span>
|
| 1859 |
'<span class="xml_comment">''</span>Returns the floating-point number adjacent to the first
|
| 1860 |
'<span class="xml_comment">''</span>argument in the direction of the second argument. If both
|
| 1861 |
'<span class="xml_comment">''</span>arguments compare as equal a value equivalent to the second argument
|
| 1862 |
'<span class="xml_comment">''</span>is returned.
|
| 1863 |
'<span class="xml_comment">''</span>
|
| 1864 |
'<span class="xml_comment">''</span>
|
| 1865 |
'<span class="xml_comment">''</span>Special cases:
|
| 1866 |
'<span class="xml_comment">''</span>
|
| 1867 |
'<span class="xml_comment">''</span>+ If either argument is a NaN, then NaN is returned.
|
| 1868 |
'<span class="xml_comment">''</span>
|
| 1869 |
'<span class="xml_comment">''</span>+ If both arguments are signed zeros, a value equivalent
|
| 1870 |
'<span class="xml_comment">''</span>to {@code direction} is returned.
|
| 1871 |
'<span class="xml_comment">''</span>
|
| 1872 |
'<span class="xml_comment">''</span>+ If {@code start} is
|
| 1873 |
'<span class="xml_comment">''</span>± Float#MIN_VALUE"/> and {@code direction}
|
| 1874 |
'has a value such that the result should have a smaller
|
| 1875 |
'magnitude, then a zero with the same sign as {@code start}
|
| 1876 |
'is returned.
|
| 1877 |
'
|
| 1878 |
'+ If {@code start} is infinite and
|
| 1879 |
'{@code direction} has a value such that the result should
|
| 1880 |
'have a smaller magnitude, Float#MAX_VALUE"/> with the
|
| 1881 |
'<span class="xml_comment">''</span>same sign as {@code start} is returned.
|
| 1882 |
'<span class="xml_comment">''</span>
|
| 1883 |
'<span class="xml_comment">''</span>+ If {@code start} is equal to ±
|
| 1884 |
'<span class="xml_comment">''</span> Float#MAX_VALUE"/> and {@code direction} has a
|
| 1885 |
'value such that the result should have a larger magnitude, an
|
| 1886 |
'infinity with same sign as {@code start} is returned.
|
| 1887 |
'
|
| 1888 |
'</summary>
|
| 1889 |
'<param name="start"> starting floating-point value </param>
|
| 1890 |
'<param name="direction"> value indicating which of
|
| 1891 |
'{@code start}'s neighbors or {@code start} should
|
| 1892 |
'be returned </param>
|
| 1893 |
'<returns> The floating-point number adjacent to {@code start} in the
|
| 1894 |
'direction of {@code direction}.
|
| 1895 |
'@since 1.6 </returns>
|
| 1896 |
|
| 1897 |
|
| 1898 |
* The cases:
|
| 1899 |
*
|
| 1900 |
* nextAfter(+infinity, 0) == MAX_VALUE
|
| 1901 |
* nextAfter(+infinity, +infinity) == +infinity
|
| 1902 |
* nextAfter(-infinity, 0) == -MAX_VALUE
|
| 1903 |
* nextAfter(-infinity, -infinity) == -infinity
|
| 1904 |
*
|
| 1905 |
* are naturally handled without any additional testing
|
| 1906 |
|
| 1907 |
|
| 1908 |
First check for NaN values
|
| 1909 |
If Float.IsNaN(start) OrElse Java.lang.[Double].IsNaN(direction) Then
|
| 1910 |
return a NaN derived from the input NaN(s)
|
| 1911 |
Return start + CSng(direction)
|
| 1912 |
ElseIf start = direction Then
|
| 1913 |
Return CSng(direction) start > direction or start < direction
|
| 1914 |
Else
|
| 1915 |
Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
|
| 1916 |
then bitwise convert start to java.lang.[Integer].
|
| 1917 |
Dim transducer As Integer = Float.floatToRawIntBits(start + 0.0F)
|
| 1918 |
|
| 1919 |
|
| 1920 |
* IEEE 754 floating-point numbers are lexicographically
|
| 1921 |
* ordered if treated as signed- magnitude integers .
|
| 1922 |
* Since Java's integers are two's complement,
|
| 1923 |
* incrementing" the two's complement representation of a
|
| 1924 |
* logically negative floating-point value *decrements*
|
| 1925 |
* the signed-magnitude representation. Therefore, when
|
| 1926 |
* the integer representation of a floating-point values
|
| 1927 |
* is less than zero, the adjustment to the representation
|
| 1928 |
* is in the opposite direction than would be expected at
|
| 1929 |
* first.
|
| 1930 |
|
| 1931 |
If direction > start Then Calculate next greater value
|
| 1932 |
transducer = transducer + (If(transducer >= 0, 1, -1)) Calculate next lesser value
|
| 1933 |
Else
|
| 1934 |
Debug.Assert(direction < start)
|
| 1935 |
If transducer > 0 Then
|
| 1936 |
transducer -= 1
|
| 1937 |
Else
|
| 1938 |
If transducer < 0 Then
|
| 1939 |
transducer += 1
|
| 1940 |
|
| 1941 |
* transducer==0, the result is -MIN_VALUE
|
| 1942 |
*
|
| 1943 |
* The transition from zero (implicitly
|
| 1944 |
* positive) to the smallest negative
|
| 1945 |
* signed magnitude value must be done
|
| 1946 |
* explicitly.
|
| 1947 |
|
| 1948 |
Else
|
| 1949 |
transducer = sun.misc.FloatConsts.SIGN_BIT_MASK Or 1
|
| 1950 |
End If
|
| 1951 |
End If
|
| 1952 |
End If
|
| 1953 |
|
| 1954 |
Return Float.intBitsToFloat(transducer)
|
| 1955 |
End If
|
| 1956 |
|
| 1957 |
|
| 1958 |
'<span class="xml_comment">''<summary></span>
|
| 1959 |
'<span class="xml_comment">''</span>Returns the floating-point value adjacent to {@code d} in
|
| 1960 |
'<span class="xml_comment">''</span>the direction of positive infinity. This method is
|
| 1961 |
'<span class="xml_comment">''</span>semantically equivalent to {@code nextAfter(d,
|
| 1962 |
'<span class="xml_comment">''</span>java.lang.[Double].POSITIVE_INFINITY)}; however, a {@code nextUp}
|
| 1963 |
'<span class="xml_comment">''</span>implementation may run faster than its equivalent
|
| 1964 |
'<span class="xml_comment">''</span>{@code nextAfter} call.
|
| 1965 |
'<span class="xml_comment">''</span>
|
| 1966 |
'<span class="xml_comment">''</span>Special Cases:
|
| 1967 |
'<span class="xml_comment">''</span>
|
| 1968 |
'<span class="xml_comment">''</span>+ If the argument is NaN, the result is NaN.
|
| 1969 |
'<span class="xml_comment">''</span>
|
| 1970 |
'<span class="xml_comment">''</span>+ If the argument is positive infinity, the result is
|
| 1971 |
'<span class="xml_comment">''</span>positive infinity.
|
| 1972 |
'<span class="xml_comment">''</span>
|
| 1973 |
'<span class="xml_comment">''</span>+ If the argument is zero, the result is
|
| 1974 |
'<span class="xml_comment">''</span> Double#MIN_VALUE"/>
|
| 1975 |
'
|
| 1976 |
'
|
| 1977 |
'</summary>
|
| 1978 |
'<param name="d"> starting floating-point value </param>
|
| 1979 |
'<returns> The adjacent floating-point value closer to positive
|
| 1980 |
'infinity.
|
| 1981 |
'@since 1.6 </returns>
|
| 1982 |
|
| 1983 |
If Java.lang.[Double].IsNaN(d) OrElse d = Java.lang.[Double].PositiveInfinity Then
|
| 1984 |
Return d
|
| 1985 |
Else
|
| 1986 |
d += 0.0R
|
| 1987 |
Return Java.lang.[Double].longBitsToDouble(Double.doubleToRawLongBits(d) + (If(d >= 0.0R, +1L, -1L)))
|
| 1988 |
End If
|
| 1989 |
|
| 1990 |
|
| 1991 |
'
|
| 1992 |
'Returns the floating-point value adjacent to {@code f} in
|
| 1993 |
'the direction of positive infinity. This method is
|
| 1994 |
'semantically equivalent to {@code nextAfter(f,
|
| 1995 |
'Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
|
| 1996 |
'implementation may run faster than its equivalent
|
| 1997 |
'{@code nextAfter} call.
|
| 1998 |
'
|
| 1999 |
'Special Cases:
|
| 2000 |
'
|
| 2001 |
'+ If the argument is NaN, the result is NaN.
|
| 2002 |
'
|
| 2003 |
'+ If the argument is positive infinity, the result is
|
| 2004 |
'positive infinity.
|
| 2005 |
'
|
| 2006 |
'+ If the argument is zero, the result is
|
| 2007 |
' Float#MIN_VALUE"/>
|
| 2008 |
'
|
| 2009 |
'
|
| 2010 |
'</summary>
|
| 2011 |
'<param name="f"> starting floating-point value </param>
|
| 2012 |
'<returns> The adjacent floating-point value closer to positive
|
| 2013 |
'infinity.
|
| 2014 |
'@since 1.6 </returns>
|
| 2015 |
|
| 2016 |
If Float.IsNaN(f) OrElse f = sun.misc.FloatConsts.POSITIVE_INFINITY Then
|
| 2017 |
Return f
|
| 2018 |
Else
|
| 2019 |
f += 0.0F
|
| 2020 |
Return Float.intBitsToFloat(Float.floatToRawIntBits(f) + (If(f >= 0.0F, +1, -1)))
|
| 2021 |
End If
|
| 2022 |
|
| 2023 |
|
| 2024 |
'
|
| 2025 |
'Returns the floating-point value adjacent to {@code d} in
|
| 2026 |
'the direction of negative infinity. This method is
|
| 2027 |
'semantically equivalent to {@code nextAfter(d,
|
| 2028 |
'java.lang.[Double].NEGATIVE_INFINITY)}; however, a
|
| 2029 |
'{@code nextDown} implementation may run faster than its
|
| 2030 |
'equivalent {@code nextAfter} call.
|
| 2031 |
'
|
| 2032 |
'Special Cases:
|
| 2033 |
'
|
| 2034 |
'+ If the argument is NaN, the result is NaN.
|
| 2035 |
'
|
| 2036 |
'+ If the argument is negative infinity, the result is
|
| 2037 |
'negative infinity.
|
| 2038 |
'
|
| 2039 |
'+ If the argument is zero, the result is
|
| 2040 |
'{@code -Double.MIN_VALUE}
|
| 2041 |
'
|
| 2042 |
'
|
| 2043 |
'</summary>
|
| 2044 |
'<param name="d"> starting floating-point value </param>
|
| 2045 |
'<returns> The adjacent floating-point value closer to negative
|
| 2046 |
'infinity.
|
| 2047 |
'@since 1.8 </returns>
|
| 2048 |
|
| 2049 |
If Java.lang.[Double].IsNaN(d) OrElse d = Java.lang.[Double].NegativeInfinity Then
|
| 2050 |
Return d
|
| 2051 |
Else
|
| 2052 |
If d = 0.0 Then
|
| 2053 |
Return -Double.MIN_VALUE
|
| 2054 |
Else
|
| 2055 |
Return Java.lang.[Double].longBitsToDouble(Double.doubleToRawLongBits(d) + (If(d > 0.0R, -1L, +1L)))
|
| 2056 |
End If
|
| 2057 |
End If
|
| 2058 |
|
| 2059 |
|
| 2060 |
'
|
| 2061 |
'Returns the floating-point value adjacent to {@code f} in
|
| 2062 |
'the direction of negative infinity. This method is
|
| 2063 |
'semantically equivalent to {@code nextAfter(f,
|
| 2064 |
'Float.NEGATIVE_INFINITY)}; however, a
|
| 2065 |
'{@code nextDown} implementation may run faster than its
|
| 2066 |
'equivalent {@code nextAfter} call.
|
| 2067 |
'
|
| 2068 |
'Special Cases:
|
| 2069 |
'
|
| 2070 |
'+ If the argument is NaN, the result is NaN.
|
| 2071 |
'
|
| 2072 |
'+ If the argument is negative infinity, the result is
|
| 2073 |
'negative infinity.
|
| 2074 |
'
|
| 2075 |
'+ If the argument is zero, the result is
|
| 2076 |
'{@code -Float.MIN_VALUE}
|
| 2077 |
'
|
| 2078 |
'
|
| 2079 |
'</summary>
|
| 2080 |
'<param name="f"> starting floating-point value </param>
|
| 2081 |
'<returns> The adjacent floating-point value closer to negative
|
| 2082 |
'infinity.
|
| 2083 |
'@since 1.8 </returns>
|
| 2084 |
|
| 2085 |
If Float.IsNaN(f) OrElse f = Float.NegativeInfinity Then
|
| 2086 |
Return f
|
| 2087 |
Else
|
| 2088 |
If f = 0.0F Then
|
| 2089 |
Return -Float.MIN_VALUE
|
| 2090 |
Else
|
| 2091 |
Return Float.intBitsToFloat(Float.floatToRawIntBits(f) + (If(f > 0.0F, -1, +1)))
|
| 2092 |
End If
|
| 2093 |
End If
|
| 2094 |
|
| 2095 |
|
| 2096 |
'
|
| 2097 |
'Returns {@code d} ×
|
| 2098 |
'2<sup>{@code scaleFactor}</sup> rounded as if performed
|
| 2099 |
'by a single correctly rounded floating-point multiply to a
|
| 2100 |
'member of the double value set. See the Java
|
| 2101 |
'Language Specification for a discussion of floating-point
|
| 2102 |
'value sets. If the exponent of the result is between {@link
|
| 2103 |
'Double#MIN_EXPONENT} and Double#MAX_EXPONENT"/>, the
|
| 2104 |
'answer is calculated exactly. If the exponent of the result
|
| 2105 |
'would be larger than {@code java.lang.[Double].MAX_EXPONENT}, an
|
| 2106 |
'infinity is returned. Note that if the result is subnormal,
|
| 2107 |
'precision may be lost; that is, when {@code scalb(x, n)}
|
| 2108 |
'is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
|
| 2109 |
'_x_. When the result is non-NaN, the result has the same
|
| 2110 |
'sign as {@code d}.
|
| 2111 |
'
|
| 2112 |
'Special cases:
|
| 2113 |
'
|
| 2114 |
'+ If the first argument is NaN, NaN is returned.
|
| 2115 |
'+ If the first argument is infinite, then an infinity of the
|
| 2116 |
'same sign is returned.
|
| 2117 |
'+ If the first argument is zero, then a zero of the same
|
| 2118 |
'sign is returned.
|
| 2119 |
'
|
| 2120 |
'</summary>
|
| 2121 |
'<param name="d"> number to be scaled by a power of two. </param>
|
| 2122 |
'<param name="scaleFactor"> power of 2 used to scale {@code d} </param>
|
| 2123 |
'<returns> {@code d} × 2<sup>{@code scaleFactor}</sup>
|
| 2124 |
'@since 1.6 </returns>
|
| 2125 |
|
| 2126 |
|
| 2127 |
* This method does not need to be declared strictfp to
|
| 2128 |
* compute the same correct result on all platforms. When
|
| 2129 |
* scaling up, it does not matter what order the
|
| 2130 |
* multiply-store operations are done; the result will be
|
| 2131 |
* finite or overflow regardless of the operation ordering.
|
| 2132 |
* However, to get the correct result when scaling down, a
|
| 2133 |
* particular ordering must be used.
|
| 2134 |
*
|
| 2135 |
* When scaling down, the multiply-store operations are
|
| 2136 |
* sequenced so that it is not possible for two consecutive
|
| 2137 |
* multiply-stores to return subnormal results. If one
|
| 2138 |
* multiply-store result is subnormal, the next multiply will
|
| 2139 |
* round it away to zero. This is done by first multiplying
|
| 2140 |
* by 2 ^ (scaleFactor % n) and then multiplying several
|
| 2141 |
* times by by 2^n as needed where n is the exponent of number
|
| 2142 |
* that is a covenient power of two. In this way, at most one
|
| 2143 |
* real rounding error occurs. If the double value set is
|
| 2144 |
* being used exclusively, the rounding will occur on a
|
| 2145 |
* multiply. If the double-extended-exponent value set is
|
| 2146 |
* being used, the products will (perhaps) be exact but the
|
| 2147 |
* stores to d are guaranteed to round to the double value
|
| 2148 |
* set.
|
| 2149 |
*
|
| 2150 |
* It is _not_ a valid implementation to first multiply d by
|
| 2151 |
* 2^MIN_EXPONENT and then by 2 ^ (scaleFactor %
|
| 2152 |
* MIN_EXPONENT) since even in a strictfp program double
|
| 2153 |
* rounding on underflow could occur; e.g. if the scaleFactor
|
| 2154 |
* argument was (MIN_EXPONENT - n) and the exponent of d was a
|
| 2155 |
* little less than -(MIN_EXPONENT - n), meaning the final
|
| 2156 |
* result would be subnormal.
|
| 2157 |
*
|
| 2158 |
* Since exact reproducibility of this method can be achieved
|
| 2159 |
* without any undue performance burden, there is no
|
| 2160 |
* compelling reason to allow double rounding on underflow in
|
| 2161 |
* scalb.
|
| 2162 |
|
| 2163 |
|
| 2164 |
magnitude of a power of two so large that scaling a finite
|
| 2165 |
nonzero value by it would be guaranteed to over or
|
| 2166 |
underflow; due to rounding, scaling down takes takes an
|
| 2167 |
additional power of two which is reflected here
|
| 2168 |
Dim MAX_SCALE As Integer = sun.misc.DoubleConsts.MAX_EXPONENT + -sun.misc.DoubleConsts.MIN_EXPONENT + sun.misc.DoubleConsts.SIGNIFICAND_WIDTH + 1
|
| 2169 |
Dim exp_adjust As Integer = 0
|
| 2170 |
Dim scale_increment As Integer = 0
|
| 2171 |
Dim exp_delta As Double = Java.lang.[Double].NaN
|
| 2172 |
|
| 2173 |
Make sure scaling factor is in a reasonable range
|
| 2174 |
|
| 2175 |
If scaleFactor < 0 Then
|
| 2176 |
scaleFactor = sys.Max(scaleFactor, -MAX_SCALE)
|
| 2177 |
scale_increment = -512
|
| 2178 |
exp_delta = twoToTheDoubleScaleDown
|
| 2179 |
Else
|
| 2180 |
scaleFactor = sys.Min(scaleFactor, MAX_SCALE)
|
| 2181 |
scale_increment = 512
|
| 2182 |
exp_delta = twoToTheDoubleScaleUp
|
| 2183 |
End If
|
| 2184 |
|
| 2185 |
Calculate (scaleFactor % +/-512), 512 = 2^9, using
|
| 2186 |
technique from "Hacker's Delight" section 10-2.
|
| 2187 |
Dim t As Integer = CInt(CUInt((scaleFactor >> 9 - 1)) >> 32 - 9)
|
| 2188 |
exp_adjust = ((scaleFactor + t) And (512 - 1)) - t
|
| 2189 |
|
| 2190 |
d *= powerOfTwoD(exp_adjust)
|
| 2191 |
scaleFactor -= exp_adjust
|
| 2192 |
|
| 2193 |
Do While scaleFactor <> 0
|
| 2194 |
d *= exp_delta
|
| 2195 |
scaleFactor -= scale_increment
|
| 2196 |
Loop
|
| 2197 |
Return d
|
| 2198 |
|
| 2199 |
|
| 2200 |
'
|
| 2201 |
'Returns {@code f} ×
|
| 2202 |
'2<sup>{@code scaleFactor}</sup> rounded as if performed
|
| 2203 |
'by a single correctly rounded floating-point multiply to a
|
| 2204 |
'member of the float value set. See the Java
|
| 2205 |
'Language Specification for a discussion of floating-point
|
| 2206 |
'value sets. If the exponent of the result is between {@link
|
| 2207 |
'Float#MIN_EXPONENT} and Float#MAX_EXPONENT"/>, the
|
| 2208 |
'answer is calculated exactly. If the exponent of the result
|
| 2209 |
'would be larger than {@code Float.MAX_EXPONENT}, an
|
| 2210 |
'infinity is returned. Note that if the result is subnormal,
|
| 2211 |
'precision may be lost; that is, when {@code scalb(x, n)}
|
| 2212 |
'is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
|
| 2213 |
'_x_. When the result is non-NaN, the result has the same
|
| 2214 |
'sign as {@code f}.
|
| 2215 |
'
|
| 2216 |
'Special cases:
|
| 2217 |
'
|
| 2218 |
'+ If the first argument is NaN, NaN is returned.
|
| 2219 |
'+ If the first argument is infinite, then an infinity of the
|
| 2220 |
'same sign is returned.
|
| 2221 |
'+ If the first argument is zero, then a zero of the same
|
| 2222 |
'sign is returned.
|
| 2223 |
'
|
| 2224 |
'</summary>
|
| 2225 |
'<param name="f"> number to be scaled by a power of two. </param>
|
| 2226 |
'<param name="scaleFactor"> power of 2 used to scale {@code f} </param>
|
| 2227 |
'<returns> {@code f} × 2<sup>{@code scaleFactor}</sup>
|
| 2228 |
'@since 1.6 </returns>
|
| 2229 |
|
| 2230 |
magnitude of a power of two so large that scaling a finite
|
| 2231 |
nonzero value by it would be guaranteed to over or
|
| 2232 |
underflow; due to rounding, scaling down takes takes an
|
| 2233 |
additional power of two which is reflected here
|
| 2234 |
Dim MAX_SCALE As Integer = sun.misc.FloatConsts.MAX_EXPONENT + -sun.misc.FloatConsts.MIN_EXPONENT + sun.misc.FloatConsts.SIGNIFICAND_WIDTH + 1
|
| 2235 |
|
| 2236 |
Make sure scaling factor is in a reasonable range
|
| 2237 |
scaleFactor = sys.Max(System.Math.Min(scaleFactor, MAX_SCALE), -MAX_SCALE)
|
| 2238 |
|
| 2239 |
|
| 2240 |
* Since + MAX_SCALE for float fits well within the double
|
| 2241 |
* exponent range and + float -> double conversion is exact
|
| 2242 |
* the multiplication below will be exact. Therefore, the
|
| 2243 |
* rounding that occurs when the double product is cast to
|
| 2244 |
* float will be the correctly rounded float result. Since
|
| 2245 |
* all operations other than the final multiply will be exact,
|
| 2246 |
* it is not necessary to declare this method strictfp.
|
| 2247 |
|
| 2248 |
Return CSng(CDbl(f) * powerOfTwoD(scaleFactor))
|
| 2249 |
|
| 2250 |
|
| 2251 |
'Constants used in scalb
|
| 2252 |
|
| 2253 |
|
| 2254 |
|
| 2255 |
'
|
| 2256 |
'Returns a floating-point power of two in the normal range.
|
| 2257 |
'</summary>
|
| 2258 |
|
| 2259 |
Assert(n >= sun.misc.DoubleConsts.MIN_EXPONENT AndAlso n <= sun.misc.DoubleConsts.MAX_EXPONENT)
|
| 2260 |
Return java.lang.[Double].longBitsToDouble(((CLng(n) + CLng(Fix(sun.misc.DoubleConsts.EXP_BIAS))) << (sun.misc.DoubleConsts.SIGNIFICAND_WIDTH - 1)) And sun.misc.DoubleConsts.EXP_BIT_MASK)
|
| 2261 |
|
| 2262 |
|
| 2263 |
'
|
| 2264 |
'Returns a floating-point power of two in the normal range.
|
| 2265 |
'</summary>
|
| 2266 |
|
| 2267 |
Assert(n >= sun.misc.FloatConsts.MIN_EXPONENT AndAlso n <= sun.misc.FloatConsts.MAX_EXPONENT)
|
| 2268 |
Return Float.intBitsToFloat(((n + sun.misc.FloatConsts.EXP_BIAS) << (sun.misc.FloatConsts.SIGNIFICAND_WIDTH - 1)) And sun.misc.FloatConsts.EXP_BIT_MASK)
|
| 2269 |
|
| 2270 |
End Module
|
| 2271 |
End Namespace
|