提交 ac03ba32 authored 作者: Thomas Mueller's avatar Thomas Mueller

ABS(CAST(0.0 AS DOUBLE)) returned -0.0 instead of 0.0.

上级 3e1cb1af
...@@ -21,6 +21,8 @@ Change Log ...@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>ABS(CAST(0.0 AS DOUBLE)) returned -0.0 instead of 0.0.
</li>
<li>BNF auto-completion failed with unquoted identifiers. <li>BNF auto-completion failed with unquoted identifiers.
</li> </li>
<li>Oracle compatibility: empty strings were not converted to NULL when using prepared statements. <li>Oracle compatibility: empty strings were not converted to NULL when using prepared statements.
......
...@@ -581,7 +581,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -581,7 +581,7 @@ public class Function extends Expression implements FunctionCall {
Value result; Value result;
switch (info.type) { switch (info.type) {
case ABS: case ABS:
result = v0.getSignum() > 0 ? v0 : v0.negate(); result = v0.getSignum() >= 0 ? v0 : v0.negate();
break; break;
case ACOS: case ACOS:
result = ValueDouble.get(Math.acos(v0.getDouble())); result = ValueDouble.get(Math.acos(v0.getDouble()));
......
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
-- Initial Developer: H2 Group -- Initial Developer: H2 Group
-- --
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- special grammar and test cases ---------------------------------------------------------------------------------------------
select abs(cast(0.0 as double)) x;
> X
> ---
> 0.0
> rows: 1
select * from table(a int=(1)), table(b int=(2)); select * from table(a int=(1)), table(b int=(2));
> A B > A B
> - - > - -
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论