Exact numerical logging

It’s worth noting that different implementations of JSON may have different levels of numerical precision. JSON doesn’t distinguish between numeric types and may be lossy. Sometimes people put numbers in strings for that reason.

2 Likes

Thanks. I just found

which could make that a more disciplined approach. Will experiment further and get back here.

2 Likes

JSON is a just string, and doesn’t specify anything about the precision or representation of numbers. It depends on your encoder whether it would be lossy. Since a lossless string representation is possible, it is possible to make JSON lossless, but it might require intervention in the encoder or a custom encoder.

1 Like

I also had not heard of JLSO.jl. Please report back with your experience!

Tamas, your reasons make sense, and it does work for you, which is what matters. Thanks for discussing your investigation here. I’m learning from it.

JSON.jl just uses print, and since print is lossless in Julia no further intervention is needed.

5 Likes