使用 JavaScript能使本网站更好的工作。
首页
探索
帮助
注册
登录
SisMaker
/
jiffy
关注
1
点赞
0
派生
0
代码
工单
0
合并请求
0
项目
0
版本发布
62
百科
动态
浏览代码
issue
#31
: encode floating point numbers with less precision if possible. fails a few etap tests, though I believe it's due to the specific values expected
pull/32/head
Ryan Flynn
12 年前
父节点
3b6a1327d4
当前提交
b045a37391
共有
1 个文件被更改
,包括
7 次插入
和
1 次删除
分列视图
Diff 选项
显示统计
下载 Patch 文件
下载 Diff 文件
+7
-1
c_src/encoder.c
+ 7
- 1
c_src/encoder.c
查看文件
@ -4,6 +4,7 @@
#
include
<assert.h>
#
include
<stdio.h>
#
include
<string.h>
#
include
<float.h>
#
include
"erl_nif.h"
#
include
"jiffy.h"
@ -401,7 +402,12 @@ enc_double(Encoder* e, double val)
start
=
&
(
e
-
>
p
[
e
-
>
i
]
)
;
sprintf
(
start
,
"
%0.20g
"
,
val
)
;
/
/
try
to
encode
doubles
using
the
fewest
digits
possible
.
.
.
if
(
snprintf
(
start
,
32
,
"
%.*g
"
,
DBL_DIG
,
val
)
>
FLT_DIG
)
{
/
/
.
.
.
fall
back
to
full
expansion
to
be
safe
snprintf
(
start
,
32
,
"
%.*g
"
,
LDBL_DIG
,
val
)
;
}
len
=
strlen
(
start
)
;
/
/
Check
if
we
have
a
decimal
point
撰写
预览
正在加载...
取消
保存