Closed jitsedesmet closed 3 years ago
Here's what I found: https://www.w3.org/TR/xpath20/#mapping .
[Definition: When referring to a type, the term numeric denotes the types xs:integer, xs:decimal, xs:float, and xs:double.] An operator whose operands and result are designated as numeric might be thought of as representing four operators, one for each of the numeric types. For example, the numeric + operator might be thought of as representing the following four operators:
With a table underneath it. I think this is a pretty good solution. It basically means type promotion will handle that problem.
We should make sure we understand why we use
arithmeticWidening
and where this behaviour is mentioned in the specs. This issue has 2 tasks.arithmeticWidening
.arithmeticWidening
like the specs sugest.arithmeticWidening
answers a simple question: what type is the return type of an arithmetic operation. things to consider: it could be that short + short \ne short. Example: is 240 + 100 still a short? It can not be represented as a short. Should we check this? Or do we need to return a short with value 340 which is not a valid short value.