This website works better with JavaScript.
首頁
探索
說明
註冊
登入
SisMaker
/
jiffy
關註
1
收藏
0
複製
0
程式碼
問題管理
0
合併請求
0
Projects
0
版本發佈
62
Wiki
Activity
瀏覽代碼
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 Options
Show Stats
Download Patch File
Download Diff File
+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
Write
Preview
Loading…
取消
儲存