cqframework / cql-execution

A JavaScript framework for executing CQL
Apache License 2.0
66 stars 30 forks source link

Issues w/ Power operator and large decimals #201

Open cmoesel opened 3 years ago

cmoesel commented 3 years ago

See spec-tests:

These should return large numbers but are returning null. Is the number getting switched to null because it thinks its an integer and overflowed?

kjmahalingam commented 3 years ago

This is directly tied to #204 since the assumption above is correct. If we take ValueLiteralsAndSelectors.Decimal.Decimal10Pow28ToZeroOneStepDecimalMaxValue as an example, the output value here:

<output>10*10000000000000000000.00000000-0.00000001</output>

has the first argument to the Subtract parsed as null since the 1e28 is processed as an Integer that is considered to overflow. In order to fix this, we need to fix #204.

kjmahalingam commented 3 years ago

In addition, we need to update the values of both the expressions and outputs in these tests. They are set to be 10^28 as opposed to (10^28 - 1) / (10^8) as is defined to be the max in the CQL spec.