Ce site fonctionne mieux avec JavaScript.
Accueil
Explorateur
Aide
S'inscrire
Connexion
SisMaker
/
jiffy
Suivre
1
Ajouter aux favoris
0
Bifurcation
0
Code
Tickets
0
Demandes d'ajout
0
Projects
0
Versions
62
Wiki
Activité
Parcourir la source
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
il y a 12 ans
Parent
3b6a1327d4
révision
b045a37391
1 fichiers modifiés
avec
7 ajouts
et
1 suppressions
Vue séparée
Option de Diff
Voir les Statistiques
Télécharger le Fichier Patch
Télécharger le Fichier des Différences
+7
-1
c_src/encoder.c
+ 7
- 1
c_src/encoder.c
Voir le fichier
@ -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
Écrire
Aperçu
Chargement…
Annuler
Enregistrer