toPrimitiveDouble()

Converts an object or primitive data type to the primitive double data type.

Syntax

double toPrimitiveDouble(Object objectData)
double toPrimitiveDouble(int integerData)
double toPrimitiveDouble(float floatData)

Parameters

objectData
A Java object. The objects currently supported are: Double, Float, Integer, and String.
integerData
Any primitive int variable.
floatData
Any primitive float variable.

Return values

Returns a primitive double value.

Exceptions

DtpIncompatibleFormatException - If the source data type cannot be converted to double.

Notes

This method can only handle String, Integer, Float, and Double objects; and the return value may not equal the input value accurately.

The limitation of this method is the same as the limitation of the double type in Java.

The largest positive finite double literal is 1.79769313486231570e+308. The smallest positive finite nonzero literal of type double is 4.94065645841246544e-324, with 15 significant decimal digits (on order of 999,999,999,999.99, in the range of billions).

Examples

double myDouble = DtpDataConversion.toPrimitiveDouble(myObject);

See also

getType(), isOKToConvert(), toDouble()

For more information, see the Java Language Specification.

Copyright IBM Corp. 2004, 2005