## Enhancements to java.math |
Math Contents |

**JDK 5.0**

**The**has added support for fixed-precision floating-point computation. Refer to JSR 13.`BigDecimal`

class**The**include hyperbolic transcendental functions (sinh, cosh, tanh), cube root, base 10 logarithm, etc.`Math`

and`StrictMath`

libraries**Hexadecimal floating-point support**- To allow precise and predictable specification of particular floating-point values, hexadecimal notation can be used for floating-point literals and for string to floating-point conversion methods in`Float`

and`Double`

.

**Performance enhancements for prime generation in**`BigInteger`

New static method`probablePrime`has been added to class`BigInteger`for generating prime numbers. Previously, the sole means of generating a prime`BigInteger`required the caller to provide a 'certainty' (the log of the probability of compositeness that the caller was willing to tolerate). However, providing an unreasonable value for the certainty could lead to poor performance (if the certainty was too high) or serious bugs (if it was too low). The new prime-generation method provides an efficient algorithm for generating primes using an automatically determined, appropriate value for the certainty based on a draft ANSI specification (X9-80).

**Performance enhancements in**`BigInteger`

Class`java.math.BigInteger`has been reimplemented in pure Java programming-language code. Previously,`BigInteger`'s implementation was based on an underlying C library. On a high-quality VM, the new implementation performs*all*operations faster than the old implementation. The speed-up can be as much as 5x or more, depending on the operation being performed and the length of the operands.**More robust**`BigDecimal(String)`constructor

The`BigDecimal(String)`constructor has been enhanced to allow signed strings (for example,`"+2.71828"`) and exponential notation (for example,`"1.23E-23"`) as input.

Copyright © 2004 Sun Microsystems, Inc. All Rights Reserved. |