close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1959 closed defect (fixed)

RapidJSOn falla con números grandes

Reported by: Víctor de Buen Remiro Owned by: Jorge
Priority: highest Milestone: Mantainance
Component: Packages Version: 3.4
Severity: blocker Keywords:
Cc: csanchez@…, asegura@…

Description

He encontrado un error horrible en RapidJSON::CppTools::Set2JSON cuando le pasas un número mayor de 231 sin decimales, o con decimales nulos, que lo convierte por todo el morro en -231 = -2147483648

Set data = [[
413116249059.285,
416010796541.989,
417927630208.313,
414052000000,
420976000000.0,
422588000000.000,
422588000000.0001,
422588000000.00000000000000000001
]];
Text json = RapidJSON::CppTools::Set2JSON(data);

Este es el absurdo resultado

"[413116249059.285,416010796541.989,417927630208.313,-2147483648,-2147483648,-2147483648,422588000000.0001,-2147483648]"

Estos números aparecen en las series macroeconómicas con cierta frecuencia y en concreto en la que necesito para el modelo de pruebas.

Change History (4)

comment:1 Changed 7 years ago by Jorge

Resolution: fixed
Status: newclosed

(In [7542]) fixes #1959, must write as int64 to avoid overflow

comment:2 Changed 7 years ago by Jorge

(In [7543]) refs #1959, reproduce bug

comment:3 Changed 7 years ago by Jorge

(In [7544]) refs #1959, mingw32 compilation

comment:4 Changed 7 years ago by Jorge

(In [7545]) refs #1959, build RapidJSON 0.6 on ubuntu 14, fix int overflow

Note: See TracTickets for help on using tickets.