@Override public boolean operateFloatFloat(FloatPointable floatp1, FloatPointable floatp2) throws SystemException, IOException { if (Float.isNaN(floatp1.getFloat()) || Float.isNaN(floatp2.getFloat())) { return false; } return !aOp.operateFloatFloat(floatp1, floatp2); }
@Override public boolean operateDecimalFloat(XSDecimalPointable decp1, FloatPointable floatp2) throws SystemException, IOException { if (Float.isNaN(floatp2.getFloat())) { return false; } return !aOp.operateDecimalFloat(decp1, floatp2); }
@Override public boolean operateIntegerFloat(LongPointable longp1, FloatPointable floatp2) throws SystemException, IOException { if (Float.isNaN(floatp2.floatValue())) { return false; } return !aOp.operateIntegerFloat(longp1, floatp2); }
@Override public boolean operateFloatInteger(FloatPointable floatp1, LongPointable longp2) throws SystemException, IOException { if (Float.isNaN(floatp1.getFloat())) { return false; } return !aOp.operateFloatInteger(floatp1, longp2); }
@Override public boolean operateFloatDouble(FloatPointable floatp1, DoublePointable doublep2) throws SystemException, IOException { if (Float.isNaN(floatp1.getFloat()) || Double.isNaN(doublep2.doubleValue())) { return false; } return !aOp.operateFloatDouble(floatp1, doublep2); }
@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { float sourceValue = FloatPointable.getFloat(data, start); // Boundary check if (sourceValue > Byte.MAX_VALUE || sourceValue < Byte.MIN_VALUE) { throw new IOException( "Cannot convert Float to INT8 - Float value " + sourceValue + " is out of range that INT8 type can hold: INT8.MAX_VALUE:" + Byte.MAX_VALUE + ", INT8.MIN_VALUE: " + Byte.MIN_VALUE); } // Math.floor to truncate decimal portion byte targetValue = (byte) Math.floor(sourceValue); out.writeByte(ATypeTag.INT8.serialize()); out.writeByte(targetValue); }