public double getInternalDouble(ColumnInformation columnInfo) throws SQLException {
    if (lastValueWasNull()) {
      return 0;
    }
    switch (columnInfo.getColumnType()) {
      case BIT:
        return parseBit();
      case TINYINT:
        return getInternalTinyInt(columnInfo);
      case SMALLINT:
      case YEAR:
        return getInternalSmallInt(columnInfo);
      case INTEGER:
      case MEDIUMINT:
        return getInternalMediumInt(columnInfo);
      case BIGINT:
        long valueLong = ((buf[pos] & 0xff)
            + ((long) (buf[pos + 1] & 0xff) << 8)
            + ((long) (buf[pos + 2] & 0xff) << 16)
            + ((long) (buf[pos + 3] & 0xff) << 24)
            + ((long) (buf[pos + 4] & 0xff) << 32)
            + ((long) (buf[pos + 5] & 0xff) << 40)
            + ((long) (buf[pos + 6] & 0xff) << 48)
            + ((long) (buf[pos + 7] & 0xff) << 56)
        );
        if (columnInfo.isSigned()) {
          return valueLong;
        } else {
          return new BigInteger(1, new byte[]{(byte) (valueLong >> 56),
              (byte) (valueLong >> 48), (byte) (valueLong >> 40), (byte) (valueLong >> 32),
              (byte) (valueLong >> 24), (byte) (valueLong >> 16), (byte) (valueLong >> 8),
              (byte) valueLong}).doubleValue();
        }
      case FLOAT:
        return getInternalFloat(columnInfo);
      case DOUBLE:
        long valueDouble = ((buf[pos] & 0xff)
            + ((long) (buf[pos + 1] & 0xff) << 8)
            + ((long) (buf[pos + 2] & 0xff) << 16)
            + ((long) (buf[pos + 3] & 0xff) << 24)
            + ((long) (buf[pos + 4] & 0xff) << 32)
            + ((long) (buf[pos + 5] & 0xff) << 40)
            + ((long) (buf[pos + 6] & 0xff) << 48)
            + ((long) (buf[pos + 7] & 0xff) << 56));
        return Double.longBitsToDouble(valueDouble);
      case DECIMAL:
      case VARSTRING:
      case VARCHAR:
      case STRING:
      case OLDDECIMAL:
        try {
          return Double.valueOf(new String(buf, pos, length, StandardCharsets.UTF_8));
        } catch (NumberFormatException nfe) {
          SQLException sqlException = new SQLException(
              "Incorrect format for getDouble for data field with type "
                  + columnInfo.getColumnType().getJavaTypeName(), "22003", 1264);
          //noinspection UnnecessaryInitCause
          sqlException.initCause(nfe);
          throw sqlException;
        }
      default:
        throw new SQLException("getDouble not available for data field type "
            + columnInfo.getColumnType().getJavaTypeName());
    }
  }
public double getInternalDouble ( ColumnInformation columnInfo ) throws SQLException { if ( lastValueWasNull ( ) ) { return 0 ; } switch ( columnInfo . getColumnType ( ) ) { case BIT : return parseBit ( ) ; case TINYINT : return getInternalTinyInt ( columnInfo ) ; case SMALLINT : case YEAR : return getInternalSmallInt ( columnInfo ) ; case INTEGER : case MEDIUMINT : return getInternalMediumInt ( columnInfo ) ; case BIGINT : long valueLong = ( ( buf [ pos ] & 0xff ) + ( ( long ) ( buf [ pos + 1 ] & 0xff ) << 8 ) + ( ( long ) ( buf [ pos + 2 ] & 0xff ) << 16 ) + ( ( long ) ( buf [ pos + 3 ] & 0xff ) << 24 ) + ( ( long ) ( buf [ pos + 4 ] & 0xff ) << 32 ) + ( ( long ) ( buf [ pos + 5 ] & 0xff ) << 40 ) + ( ( long ) ( buf [ pos + 6 ] & 0xff ) << 48 ) + ( ( long ) ( buf [ pos + 7 ] & 0xff ) << 56 ) ) ; if ( columnInfo . isSigned ( ) ) { return valueLong ; } else { return new BigInteger ( 1 , new byte [ ] { ( byte ) ( valueLong > > 56 ) , ( byte ) ( valueLong > > 48 ) , ( byte ) ( valueLong > > 40 ) , ( byte ) ( valueLong > > 32 ) , ( byte ) ( valueLong > > 24 ) , ( byte ) ( valueLong > > 16 ) , ( byte ) ( valueLong > > 8 ) , ( byte ) valueLong } ) . doubleValue ( ) ; } case FLOAT : return getInternalFloat ( columnInfo ) ; case DOUBLE : long valueDouble = ( ( buf [ pos ] & 0xff ) + ( ( long ) ( buf [ pos + 1 ] & 0xff ) << 8 ) + ( ( long ) ( buf [ pos + 2 ] & 0xff ) << 16 ) + ( ( long ) ( buf [ pos + 3 ] & 0xff ) << 24 ) + ( ( long ) ( buf [ pos + 4 ] & 0xff ) << 32 ) + ( ( long ) ( buf [ pos + 5 ] & 0xff ) << 40 ) + ( ( long ) ( buf [ pos + 6 ] & 0xff ) << 48 ) + ( ( long ) ( buf [ pos + 7 ] & 0xff ) << 56 ) ) ; return Double . longBitsToDouble ( valueDouble ) ; case DECIMAL : case VARSTRING : case VARCHAR : case STRING : case OLDDECIMAL : try { return Double . valueOf ( new String ( buf , pos , length , StandardCharsets . UTF_8 ) ) ; } catch ( NumberFormatException nfe ) { SQLException sqlException = new SQLException ( "Incorrect format for getDouble for data field with type " + columnInfo . getColumnType ( ) . getJavaTypeName ( ) , "22003" , 1264 ) ; sqlException . initCause ( nfe ) ; throw sqlException ; } default : throw new SQLException ( "getDouble not available for data field type " + columnInfo . getColumnType ( ) . getJavaTypeName ( ) ) ; } }
Get double from raw binary format.

@param columnInfo column information
@return double value
@throws SQLException if column is not numeric or is not in Double bounds (unsigned columns).