2.2.3.6.1.1.4 Binary Numeric Promotions

A data service MAY support binary numeric promotion for operands of the following operations.

Operation

Common Expression

Addition

addExpression

Subtraction

subExpression

Multiplication

mulExpression

Division

divExpression

Modulo

modExpression

Equality

eqExpression

Non-Equality

neExpression

Greater Than

gtExpression

Less Than

ltExpression

Greater Than or Equal

geExpression

Less Than or Equal

leExpression

Table: Operations that Support Binary Numeric Promotion

If supported, binary numeric promotion SHOULD implicitly convert both operands to a common type and, in the case of the nonrelational operators, also become the return type.

If supported, a data service SHOULD support binary numeric promotion for the following Entity Data Model (EDM) primitive types:

  • Edm.Decimal

  • Edm.Double

  • Edm.Single

  • Edm.Byte

  • Edm.Int16

  • Edm.Int32

  • Edm.Int64

If supported, binary numeric promotion SHOULD consist of the application of the following rules in the order specified:

  • If either operand is of type Edm.Decimal, the other operand is converted to Edm.Decimal unless it is of type Edm.Single or Edm.Double.

  • Otherwise, if either operand is Edm.Double, the other operand is converted to type Edm.Double.

  • Otherwise, if either operand is Edm.Single, the other operand is converted to type Edm.Single.

  • Otherwise, if either operand is Edm.Int64, the other operand is converted to type Edm.Int64.

  • Otherwise, if either operand is Edm.Int32, the other operand is converted to type Edm.Int32

  • Otherwise, if either operand is Edm.Int16, the other operand is converted to type Edm.Int16.

  • If binary numeric promotion is supported, a data service SHOULD use a castExpression to promote an operand to the target type.