このサイトはJavaScriptを使用しています
ホーム
エクスプローラー
ヘルプ
登録
サインイン
SisMaker
/
jiffy
ウォッチ
1
スター
0
フォーク
0
コード
課題
0
プルリクエスト
0
プロジェクト
0
リリース
62
Wiki
アクティビティ
ソースを参照
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行の削除
分割表示
差分オプション
統計情報を表示
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
書き込み
プレビュー
読み込み中…
キャンセル
保存