# 5.5.1.2.1 Let-coercion between numeric types

The most fundamental coercions are conversions from a numeric value type (Integer, Long, LongLong, Byte, Single, Double, Currency, Decimal) to a numeric declared type (Integer, Long, LongLong, Byte, Single, Double, Currency).

Numeric value types can be broken down into 3 categories:

§ Integral: Integer, Long, LongLong and Byte

§ Floating-point: Single and Double

§ Fixed-point: Currency and Decimal

Similarly, numeric declared types can be broken down into 3 categories:

§ Integral: Integer, Long (including any Enum), LongLong and Byte

§ Floating-point: Single and Double

§ Fixed-point: Currency and Decimal

The semantics of numeric Let-coercion depend on the source’s value type and the destination’s declared type:

Source Value Type

Destination

Declared Type

Semantics

Any integral type

Any numeric type

If the source value is within the range of the destination type, the result is a copy of the value.

Otherwise, runtime error 6 (Overflow) is raised.

Any floating point or fixed point type

Any integral type

If the source value is finite (not positive infinity, negative infinity or NaN) and is within the range of the destination type, the result is the value converted to an integer using Banker’s rounding (section 5.5.1.2.1.1).

Otherwise, runtime error 6 (Overflow) is raised.

Any integral type

Any numeric type

If the source value is within the range of the destination type, the result is a copy of the value.

Otherwise, runtime error 6 (Overflow) is raised.

Any integral type

Any floating point or fixed point type

If the source value is finite (not positive infinity, negative infinity or NaN) and is within the magnitude range of the destination type, the result is the value rounded to the nearest value representable in the destination type using Banker’s rounding.

Otherwise, runtime error 6 (Overflow) is raised.

Note that the conversion can result in a loss of precision, and if the value is too small it can become 0.