### Question:
RealOperators { @ScalarOperator(CAST) @SqlType(StandardTypes.SMALLINT) public static long castToSmallint(@SqlType(StandardTypes.REAL) long value) { float floatValue = intBitsToFloat((int) value); if (Float.isNaN(floatValue)) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast real NaN to smallint"); } try { return Shorts.checkedCast((long) MathFunctions.round((double) floatValue)); } catch (IllegalArgumentException e) { throw new PrestoException(NUMERIC_VALUE_OUT_OF_RANGE, "Out of range for smallint: " + floatValue, e); } } private  RealOperators(); @ScalarOperator(ADD) @SqlType(StandardTypes.REAL) static long add(@SqlType(StandardTypes.REAL) long left, @SqlType(StandardTypes.REAL) long right); @ScalarOperator(SUBTRACT) @SqlType(StandardTypes.REAL) static long subtract(@SqlType(StandardTypes.REAL) long left, @SqlType(StandardTypes.REAL) long right); @ScalarOperator(MULTIPLY) @SqlType(StandardTypes.REAL) static long multiply(@SqlType(StandardTypes.REAL) long left, @SqlType(StandardTypes.REAL) long right); @ScalarOperator(DIVIDE) @SqlType(StandardTypes.REAL) static long divide(@SqlType(StandardTypes.REAL) long left, @SqlType(StandardTypes.REAL) long right); @ScalarOperator(MODULUS) @SqlType(StandardTypes.REAL) static long modulus(@SqlType(StandardTypes.REAL) long left, @SqlType(StandardTypes.REAL) long right); @ScalarOperator(NEGATION) @SqlType(StandardTypes.REAL) static long negate(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(CAST) @LiteralParameters("x") @SqlType("varchar(x)") static Slice castToVarchar(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(CAST) @SqlType(StandardTypes.BIGINT) static long castToLong(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(CAST) @SqlType(StandardTypes.INTEGER) static long castToInteger(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(CAST) @SqlType(StandardTypes.SMALLINT) static long castToSmallint(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(CAST) @SqlType(StandardTypes.TINYINT) static long castToTinyint(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(CAST) @SqlType(StandardTypes.DOUBLE) static double castToDouble(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(CAST) @SqlType(StandardTypes.BOOLEAN) static boolean castToBoolean(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(SATURATED_FLOOR_CAST) @SqlType(StandardTypes.SMALLINT) static long saturatedFloorCastToSmallint(@SqlType(StandardTypes.REAL) long value); @ScalarOperator(SATURATED_FLOOR_CAST) @SqlType(StandardTypes.TINYINT) static long saturatedFloorCastToTinyint(@SqlType(StandardTypes.REAL) long value);  }### Answer:
@Test public void testCastToSmallint() { assertFunction("CAST(REAL'754.2008' AS SMALLINT)", SMALLINT, (short) 754); assertFunction("CAST(REAL'-754.1985' AS SMALLINT)", SMALLINT, (short) -754); assertFunction("CAST(REAL'9.99' AS SMALLINT)", SMALLINT, (short) 10); assertFunction("CAST(REAL'-0.0' AS SMALLINT)", SMALLINT, (short) 0); assertInvalidFunction("CAST(REAL 'NaN' AS SMALLINT)", INVALID_CAST_ARGUMENT); }