Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b970c4ab
提交
b970c4ab
authored
14 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The double or float value -0.0 is now distinct from 0.0 (as in Java).
上级
c90da788
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
33 行增加
和
21 行删除
+33
-21
help.csv
h2/src/main/org/h2/res/help.csv
+7
-7
ValueDouble.java
h2/src/main/org/h2/value/ValueDouble.java
+10
-7
ValueFloat.java
h2/src/main/org/h2/value/ValueFloat.java
+10
-7
test-1.3.txt
h2/src/test/org/h2/test/test-1.3.txt
+6
-0
没有找到文件。
h2/src/main/org/h2/res/help.csv
浏览文件 @
b970c4ab
...
...
@@ -479,7 +479,7 @@ condition [ { AND condition } [...] ]
","
Value or condition."
"Other Grammar","Array","
(
expression [,...
] )
(
[ expression, [ expression [,...] ]
] )
","
An array of values."
"Other Grammar","Boolean","
...
...
@@ -576,7 +576,7 @@ A string starts and ends with two dollar signs."
"Other Grammar","Double","
[ + | - ] { { number [ . number ] } | { . number } } [ E [ + | - ] expNumber [...] ] ]
","
The limitations are the same as for the Java data type Double
."
A floating point number with high precision
."
"Other Grammar","Expression","
andCondition [ { OR andCondition } [...] ]
","
...
...
@@ -716,23 +716,23 @@ Data type with fixed precision and scale."
"Data Types","DOUBLE Type","
{ DOUBLE [ PRECISION ] | FLOAT | FLOAT4 | FLOAT8 }
","
F
loating point number."
A f
loating point number."
"Data Types","REAL Type","
REAL
","
S
ingle precision floating point number."
A s
ingle precision floating point number."
"Data Types","TIME Type","
TIME
","
The
format is hh:mm:ss
."
The
time data type
."
"Data Types","DATE Type","
DATE
","
The
format is yyyy-MM-dd
."
The
date data type
."
"Data Types","TIMESTAMP Type","
{ TIMESTAMP | DATETIME | SMALLDATETIME }
","
The
format is yyyy-MM-dd hh:mm:ss[
."
The
timestamp data type
."
"Data Types","BINARY Type","
{ BINARY | VARBINARY | LONGVARBINARY | RAW | BYTEA } [ ( precisionInt ) ]
","
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueDouble.java
浏览文件 @
b970c4ab
...
...
@@ -27,11 +27,10 @@ public class ValueDouble extends Value {
*/
public
static
final
int
DISPLAY_SIZE
=
24
;
private
static
final
double
DOUBLE_ZERO
=
0.0
;
private
static
final
double
DOUBLE_ONE
=
1.0
;
private
static
final
ValueDouble
ZERO
=
new
ValueDouble
(
DOUBLE_ZERO
);
private
static
final
ValueDouble
ONE
=
new
ValueDouble
(
DOUBLE_ONE
);
private
static
final
ValueDouble
ZERO
=
new
ValueDouble
(
0.0
);
private
static
final
ValueDouble
ONE
=
new
ValueDouble
(
1.0
);
private
static
final
ValueDouble
NAN
=
new
ValueDouble
(
Double
.
NaN
);
private
static
final
long
ZERO_BITS
=
Double
.
doubleToLongBits
(
0.0
);
private
final
double
value
;
...
...
@@ -126,10 +125,14 @@ public class ValueDouble extends Value {
* @return the value
*/
public
static
ValueDouble
get
(
double
d
)
{
if
(
DOUBLE_ZERO
==
d
)
{
return
ZERO
;
}
else
if
(
DOUBLE_ONE
==
d
)
{
if
(
d
==
1.0
)
{
return
ONE
;
}
else
if
(
d
==
0.0
)
{
// unfortunately, -0.0 == 0.0, but we don't want to return
// 0.0 in this case
if
(
Double
.
doubleToLongBits
(
d
)
==
ZERO_BITS
)
{
return
ZERO
;
}
}
else
if
(
Double
.
isNaN
(
d
))
{
return
NAN
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueFloat.java
浏览文件 @
b970c4ab
...
...
@@ -27,10 +27,9 @@ public class ValueFloat extends Value {
*/
static
final
int
DISPLAY_SIZE
=
15
;
private
static
final
float
FLOAT_ZERO
=
0.0
F
;
private
static
final
float
FLOAT_ONE
=
1.0
F
;
private
static
final
ValueFloat
ZERO
=
new
ValueFloat
(
FLOAT_ZERO
);
private
static
final
ValueFloat
ONE
=
new
ValueFloat
(
FLOAT_ONE
);
private
static
final
ValueFloat
ZERO
=
new
ValueFloat
(
0.0
F
);
private
static
final
ValueFloat
ONE
=
new
ValueFloat
(
1.0
F
);
private
static
final
int
ZERO_BITS
=
Float
.
floatToIntBits
(
0.0
F
);
private
final
float
value
;
...
...
@@ -126,10 +125,14 @@ public class ValueFloat extends Value {
* @return the value
*/
public
static
ValueFloat
get
(
float
d
)
{
if
(
FLOAT_ZERO
==
d
)
{
return
ZERO
;
}
else
if
(
FLOAT_ONE
==
d
)
{
if
(
d
==
1.0
F
)
{
return
ONE
;
}
else
if
(
d
==
0.0
F
)
{
// unfortunately, -0.0 == 0.0, but we don't want to return
// 0.0 in this case
if
(
Float
.
floatToIntBits
(
d
)
==
ZERO_BITS
)
{
return
ZERO
;
}
}
return
(
ValueFloat
)
Value
.
cache
(
new
ValueFloat
(
d
));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/test-1.3.txt
浏览文件 @
b970c4ab
--- special grammar and test cases ---------------------------------------------------------------------------------------------
select -cast(0 as double) nz;
> NZ
> -----
> -0.0
> rows: 1
select () empty;
> EMPTY
> -----
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论