jacobwilliams / json-fortran

A Modern Fortran JSON API
https://jacobwilliams.github.io/json-fortran/
Other
332 stars 83 forks source link

Rounding a real when printing #525

Closed stoudamire87 closed 3 months ago

stoudamire87 commented 1 year ago

Hi Jacob et al.

First of all, thanks for your job.

I would like to know if it possible to round a real number when printing to avoid the round off error in real numbers, since compact_real only trim 0s.

An example can be the output file of test2:

"VARIABLE": "Vz", "UNITS": "km/s", "FRAME": "J2000", "CENTER": "EARTH", "DATA": [ 0.30000000000000001E-2, 0.29999999999999999E-1, 0.40000000000000001E-1 ]

Best regards

jacobwilliams commented 1 year ago

The real_format options gives you some control.