Este sitio web funciona mejor con JavaScript.
Inicio
Explorar
Ayuda
Registro
Iniciar sesión
SisMaker
/
jiffy
Seguir
1
Destacar
0
Fork
0
Código
Incidencias
0
Pull Requests
0
Projects
0
Lanzamientos
62
Wiki
Actividad
Explorar el Código
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
hace 12 años
padre
3b6a1327d4
commit
b045a37391
Se han
modificado 1 ficheros
con
7 adiciones
y
1 borrados
Dividir vista
Opciones de diferencias
Mostrar estadísticas
Descargar archivo de parche
Descargar archivo de diferencias
+7
-1
c_src/encoder.c
+ 7
- 1
c_src/encoder.c
Ver fichero
@ -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
Escribir
Vista previa
Cargando…
Cancelar
Guardar