Creates a rational number of the specified double value.

@param value the double value
@return the rational number
@throws NumberFormatException if the double value is Infinite or NaN.
973498
public static BigRational valueOf(double value) {
		if (value == 0.0) {
			return ZERO;
		}
		if (value == 1.0) {
			return ONE;
		}
		if (Double.isInfinite(value)) {
			throw new NumberFormatException("Infinite");
		}
		if (Double.isNaN(value)) {
			throw new NumberFormatException("NaN");
		}
		return valueOf(new BigDecimal(String.valueOf(value)));
	}
162381
public static Double toNullableDouble(Object value) {
		if (value == null)
			return null;

		if (value instanceof Date)
			return (double) ((Date) value).getTime();
		if (value instanceof Calendar)
			return (double) ((Calendar) value).getTimeInMillis();
		if (value instanceof Duration)
			return (double) ((Duration) value).toMillis();

		if (value instanceof Boolean)
			return (boolean) value ? 1.0 : 0.0;

		if (value instanceof Integer)
			return (double) ((int) value);
		if (value instanceof Short)
			return (double) ((short) value);
		if (value instanceof Long)
			return (double) ((long) value);
		if (value instanceof Float)
			return (double) ((float) value);
		if (value instanceof Double)
			return (double) value;

		if (value instanceof String)
			try {
				return Double.parseDouble((String) value);
			} catch (NumberFormatException ex) {
				return null;
			}

		return null;
	}
424928
private boolean isValueOutOfRange(final Double value) {
        return value == null || getMinValue() != Double.NEGATIVE_INFINITY && value < getMinValue()
                || getMaxValue() != Double.POSITIVE_INFINITY && value > getMaxValue();
    }
500051
private Item newDouble(final double value) {
        Item result = get(key.set(DOUBLE, value));
        if (result == null) {
            pool.putByte(DOUBLE).putLong(Double.doubleToLongBits(value));
            result = new Item(poolIndex, key);
            put(result);
            poolIndex += 2;
        }
        return result;
    }
1171498
@Override
    public INDArray scalar(double value) {
        if (Nd4j.dataType() == DataType.DOUBLE)
            return create(new double[] {value}, new int[0], new int[0], 0);
        else
            return scalar((float) value);
    }
711626
public static String writeDouble(Double value) {
		if (value==null) return null;
		
		return Double.toString(value);			
	}
825016
public static Number parseNumber( String value ) {
        // Try to parse as a number ...
        char c = value.charAt(0);

        if ((c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+') {
            // It's definitely a number ...
            if (c == '0' && value.length() > 2) {
                // it might be a hex number that starts with '0x'
                char two = value.charAt(1);
                if (two == 'x' || two == 'X') {
                    try {
                        // Parse the remainder of the hex number ...
                        return Integer.parseInt(value.substring(2), 16);
                    } catch (NumberFormatException e) {
                        // Ignore and continue ...
                    }
                }
            }
            // Try parsing as a double ...
            try {
                if ((value.indexOf('.') > -1) || (value.indexOf('E') > -1) || (value.indexOf('e') > -1)) {
                    return Double.parseDouble(value);
                }
                Long longObj = new Long(value);
                long longValue = longObj.longValue();
                int intValue = longObj.intValue();
                if (longValue == intValue) {
                    // Then it's just an integer ...
                    return new Integer(intValue);
                }
                return longObj;
            } catch (NumberFormatException e) {
                // ignore ...
            }
        }
        return null;
    }
1045605
public void setDouble(Double value) {
		this.checkNull(value);
		list.add(value);
		type.add(Double.class);
	}
1107705
private String formatUnits(Number value)
   {
      return (value == null ? null : m_formats.getUnitsDecimalFormat().format(value.doubleValue() / 100));
   }
1208360
public boolean isNumber(Object value) {

        if(value == null) {
            return false;
        }

        if(value instanceof Number) {
            return true;
        }

        // valid Long?
        if(String.valueOf(value).matches("\\d+")) {
            return true;
        }

        try {
            // valid Double?
            Double.parseDouble(String.valueOf(value));
        } catch(Exception e) {
            return false;
        }

        return true;
    }
129808
public Expression<Double> neq(double value) {
		String valueString = "'" + value + "'";
		return new Expression<Double>(this, Operation.neq, valueString);
	}
192699
public static final BigInteger getBigInteger(Number value)
   {
      BigInteger result = null;
      if (value != null)
      {
         if (value instanceof BigInteger)
         {
            result = (BigInteger) value;
         }
         else
         {
            result = BigInteger.valueOf(Math.round(value.doubleValue()));
         }
      }
      return (result);
   }
193690
@Override
    public Long convert(Object value) {
        if (value instanceof Number) {
            double d = ((Number)value).doubleValue();
            if (Double.isNaN(d) || Math.round(d)!=d) throw new IllegalArgumentException("Not a valid long: " + value);
            return ((Number)value).longValue();
        } else if (value instanceof String) {
            return Long.parseLong((String)value);
        } else if (value instanceof Idfiable) {
            return ((Idfiable)value).longId();
        } else return null;
    }
657167
@Override
    public double doubleValueExact() {
        double d = this.number.doubleValue();
        if (d == Double.NEGATIVE_INFINITY || d == Double.POSITIVE_INFINITY) {
            throw new ArithmeticException("Unable to convert to double: "
                    + this.number);
        }
        return d;
    }
1212954
public static double toDouble(Object value, double defaultValue) {
		if (value == null || value.toString().trim().equals("")) {
			return defaultValue;
		}
		if (value instanceof Double) {
			return (double) value;
		}
		if (value instanceof Date) {
			final Date date = (Date) value;
			return date.getTime();
		}
		return Double.parseDouble(value.toString());
	}
363622
@Override
    public Byte convert(Object value) {
        if (value instanceof Number) {
            double d = ((Number)value).doubleValue();
            if (Double.isNaN(d) || Math.round(d)!=d) throw new IllegalArgumentException("Not a valid byte: " + value);
            long l = ((Number)value).longValue();
            if (l>=Byte.MIN_VALUE && l<=Byte.MAX_VALUE) return Byte.valueOf((byte)l);
            else throw new IllegalArgumentException("Value too large for byte: " + value);
        } else if (value instanceof String) {
            return Byte.parseByte((String)value);
        } else return null;
    }
245726
public static double getDouble(
    Object      value)
  {
    if (value == null)
    {
        return 0;
    }

    return Double.valueOf(value.toString()).doubleValue();

  }