private static Double convertToDouble ( Object a ) { double value ; if ( a instanceof java . lang . Double ) { return ( Double ) a ; } else if ( a instanceof BigDecimal ) { BigDecimal bd = ( BigDecimal ) a ; value = bd . doubleValue ( ) ; int signum = bd . signum ( ) ; BigDecimal bdd = new BigDecimal ( value + signum ) ; if ( bdd . compareTo ( bd ) != signum ) { throw Error . error ( ErrorCode . X_22003 ) ; } } else { value = ( ( Number ) a ) . doubleValue ( ) ; } return ValuePool . getDouble ( Double . doubleToLongBits ( value ) ) ; }
Converter from a numeric object to Double . Input is checked to be within range represented by Double