Monday, February 22, 2010

X++ real vs numeric(32,16)

It is an interesting fact that X++ real type is not fully compatible with the table field real type. The problem is that in the database numeric(32,16) data type is used to store fields of the real type. Numeric(32,16) data type stores numbers with no more than 32 digits total and no more than 16 digits after the decimal point, so value 1033 cannot be stored with this data type. X++ real type is floating-point type and can store values in the range from -10127 to 10127.
The following code execution will fail:
public static void testReal()
    InventTrans inventTrans;
    real realValue = 1.0e33;

    inventTrans.Qty = realValue;
With the following exception:


  1. Thanks to give me solution for X++ real vs numeric.