code: protected double toDouble(final Object val) {
  
          if (val == null) {
              return Double.NaN;
          } else if (Double.class.isInstance(val)) {
              return Double.class.cast(val);
          } else if (Number.class.isInstance(val)) {
              return Number.class.cast(val).doubleValue();
          } else if (double.class.isInstance(val)) {
              return double.class.cast(val);
          } else if (long.class.isInstance(val)) {
              return long.class.cast(val);
          } else if (int.class.isInstance(val)) {
              return int.class.cast(val);
          } else if (byte.class.isInstance(val)) {
              return byte.class.cast(val);
          } else if (float.class.isInstance(val)) {
              return float.class.cast(val);
          } else {
              return Double.NaN;
          }
      }
docs: Simple helper method to transform an {@code Object} into a {@code double}. The method returns {@code NaN}, if
  the value cannot be transformed.
  
  @param val the value to transform
  
  @return the created double