public Object mod ( Object a , Object b ) { if ( a == null || b == null ) { return null ; } switch ( typeCode ) { case Types . SQL_REAL : case Types . SQL_FLOAT : case Types . SQL_DOUBLE : { double ad = ( ( Number ) a ) . doubleValue ( ) ; double bd = ( ( Number ) b ) . doubleValue ( ) ; if ( bd == 0 ) { throw Error . error ( ErrorCode . X_22012 ) ; } return ValuePool . getDouble ( Double . doubleToLongBits ( ad % bd ) ) ; } case Types . SQL_DECIMAL : { if ( ( b ) . equals ( 0 ) ) { throw Error . error ( ErrorCode . X_22012 ) ; } return ValuePool . getBigDecimal ( ( ( BigDecimal ) a ) . remainder ( ( BigDecimal ) b ) ) ; } case Types . TINYINT : case Types . SQL_SMALLINT : case Types . SQL_INTEGER : { int ai = ( ( Number ) a ) . intValue ( ) ; int bi = ( ( Number ) b ) . intValue ( ) ; if ( bi == 0 ) { throw Error . error ( ErrorCode . X_22012 ) ; } return ValuePool . getInt ( ai % bi ) ; } case Types . SQL_BIGINT : { long al = ( ( Number ) a ) . longValue ( ) ; long bl = ( ( Number ) b ) . longValue ( ) ; if ( bl == 0 ) { throw Error . error ( ErrorCode . X_22012 ) ; } return ValuePool . getLong ( al % bl ) ; } default : throw Error . runtimeError ( ErrorCode . U_S0500 , "NumberType" ) ; } }
A VoltDB extension