code: public static double toDouble(String s) {
  
          if ("+inf".equals(s) || "inf".equals(s)) {
              return Double.POSITIVE_INFINITY;
          }
  
          if ("-inf".equals(s)) {
              return Double.NEGATIVE_INFINITY;
          }
  
          return Double.parseDouble(s);
      }
docs: Convert {@link String} to {@code double}. If {@code s} is {@literal +inf}/{@literal -inf}, returns positive/negative
  infinity.
  
  @param s string representation of the number
  @return the {@code double} value.
  @since 4.3.3