#1 Re: mORMot 1 » Wrong floating point json parsing? » 2021-10-03 09:58:42

ab wrote:

You need to enable float process.
Floats may not be consistent when converted back and forth.

Use _JsonFastFloat() as documented.

Thanks, I dont see a _JsonFastFloat anywhere even if searching the mORMot-master.zip sources

#2 mORMot 1 » Wrong floating point json parsing? » 2021-10-03 01:25:02

mvg7
Replies: 5

Hi!
this code

var
  obj:    Variant;
  z:      double;
begin
  obj := _JsonFast('{"x": 8.1E-2}');
  z1 := obj.x;
  Memo1.Lines.Add(Format('x: %f', [z]));
end.

produces output "x: 8.10" instead of 0.081, why?

Board footer

Powered by FluxBB