|Title:||CAST('.' AS NUMERIC) computes 0.0 rather than 0|
|Last Modified:||2019-06-10 23:45:20|
|Version Found In:|
mrigger added on 2019-06-10 19:53:54:
Consider the following statement:
SELECT -'.'; -- expected: 0, actual: 0.0
It seems that the '.' is confused with a floating-point number when used with the unary minus. This is also the case for other arithmetic operators (e.g., see below).
SELECT '.' + 0; -- expected: 0, actual: 0.0
This is unexpected, since according to https://www.sqlite.org/syntax/numeric-literal.html, the '.' should be followed by at least one digit to be a valid number.
Previously, this worked as expected and still works as expected when casting '.' to NUMERIC:
SELECT -CAST('.' AS NUMERIC); -- 0
See [4c2d7639f0], where CAST('-' AS NUMERIC) previously computed 0.0.