cql-engine icon indicating copy to clipboard operation
cql-engine copied to clipboard

Engine tries to cast a Decimal as an Integer, fails internally

Open duncand opened this issue 6 years ago • 0 comments

CQL specifies that when we have an operation with both Decimal and Integer inputs, the Integer is promoted to a Decimal and that a Decimal is never changed to an Integer.

Run the following CQL:

define x1: 2*Power(10,-8)
define x2: 2*Power(10.0,-8)
define x3: 2.0*Power(10.0,-8)

Actual result:

>> x1 [2:1] Error: java.math.BigDecimal cannot be cast to java.lang.Integer
>> x2 [3:1] 0.0
>> x3 [4:1] 2.0E-8

The statement x1 is exhibiting an attempt to turn a Decimal into an Integer.

Also, x2 is producing the wrong result; it should be producing 0.00000002 like x3 is.

duncand avatar Mar 05 '18 11:03 duncand