512 * significantly better space and time performance by caching
513 * frequently requested values.
514 *
515 * @param d a double value.
516 * @return a {@code Double} instance representing {@code d}.
517 * @since 1.5
518 */
519 public static Double valueOf(double d) {
520 return new Double(d);
521 }
522
523 /**
524 * Returns a new {@code double} initialized to the value
525 * represented by the specified {@code String}, as performed
526 * by the {@code valueOf} method of class
527 * {@code Double}.
528 *
529 * @param s the string to be parsed.
530 * @return the {@code double} value represented by the string
531 * argument.
532 * @throws NumberFormatException if the string does not contain
533 * a parsable {@code double}.
534 * @see java.lang.Double#valueOf(String)
535 * @since 1.2
536 */
537 public static double parseDouble(String s) throws NumberFormatException {
538 return FloatingDecimal.readJavaFormatString(s).doubleValue();
539 }
540
541 /**
542 * Returns {@code true} if the specified number is a
543 * Not-a-Number (NaN) value, {@code false} otherwise.
544 *
545 * @param v the value to be tested.
546 * @return {@code true} if the value of the argument is NaN;
547 * {@code false} otherwise.
548 */
549 static public boolean isNaN(double v) {
550 return (v != v);
551 }
|
512 * significantly better space and time performance by caching
513 * frequently requested values.
514 *
515 * @param d a double value.
516 * @return a {@code Double} instance representing {@code d}.
517 * @since 1.5
518 */
519 public static Double valueOf(double d) {
520 return new Double(d);
521 }
522
523 /**
524 * Returns a new {@code double} initialized to the value
525 * represented by the specified {@code String}, as performed
526 * by the {@code valueOf} method of class
527 * {@code Double}.
528 *
529 * @param s the string to be parsed.
530 * @return the {@code double} value represented by the string
531 * argument.
532 * @throws NullPointerException if the string is null
533 * @throws NumberFormatException if the string does not contain
534 * a parsable {@code double}.
535 * @see java.lang.Double#valueOf(String)
536 * @since 1.2
537 */
538 public static double parseDouble(String s) throws NumberFormatException {
539 return FloatingDecimal.readJavaFormatString(s).doubleValue();
540 }
541
542 /**
543 * Returns {@code true} if the specified number is a
544 * Not-a-Number (NaN) value, {@code false} otherwise.
545 *
546 * @param v the value to be tested.
547 * @return {@code true} if the value of the argument is NaN;
548 * {@code false} otherwise.
549 */
550 static public boolean isNaN(double v) {
551 return (v != v);
552 }
|