# Exact numerical logging

**URL:** https://discourse.julialang.org/t/exact-numerical-logging/58766
**Category:** General Usage
**Tags:** question
**Created:** [April 7, 2021, 3:25pm UTC](https://discourse.julialang.org/t/exact-numerical-logging/58766 "2021-04-07T15:25:34Z")
**Posts on this page:** 6
**Page:** 2

<div class="post-metadata">

### Author: ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)
#### Post date: [April 15, 2021, 9:30am UTC](https://discourse.julialang.org/t/exact-numerical-logging/58766/21 "2021-04-15T09:30:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [April 15, 2021, 3:05pm UTC](https://discourse.julialang.org/t/exact-numerical-logging/58766/22 "2021-04-15T15:05:08Z")

</div>

> [@kristoffer.carlsson](#):
>
> just use the `Serialization` standard library

Thanks. I just found

> **[GitHub - invenia/JLSO.jl: Julia Serialized Object (JLSO) file format for...](https://github.com/invenia/JLSO.jl)**
>
> Julia Serialized Object (JLSO) file format for storing checkpoint data. - GitHub - invenia/JLSO.jl: Julia Serialized Object (JLSO) file format for storing checkpoint data.

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

---

<div class="post-metadata">

### Author: ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)
#### Post date: [April 15, 2021, 3:25pm UTC](https://discourse.julialang.org/t/exact-numerical-logging/58766/23 "2021-04-15T15:25:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [April 15, 2021, 3:29pm UTC](https://discourse.julialang.org/t/exact-numerical-logging/58766/24 "2021-04-15T15:29:21Z")

</div>

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

---

<div class="post-metadata">

### Author: ![adolgert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adolgert/32/20286_2.png) [@adolgert](https://discourse.julialang.org/u/adolgert)
#### Post date: [April 15, 2021, 3:39pm UTC](https://discourse.julialang.org/t/exact-numerical-logging/58766/25 "2021-04-15T15:39:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [April 15, 2021, 4:05pm UTC](https://discourse.julialang.org/t/exact-numerical-logging/58766/26 "2021-04-15T16:05:12Z")

</div>

> [@Jeff\_Emanuel](#):
>
> 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.

JSON.jl just [uses `print`](https://github.com/JuliaIO/JSON.jl/blob/1c24980c320842e17720c173be767c161f36feb9/src/Writer.jl#L259), and since `print` is lossless in Julia no further intervention is needed.

[Previous page](https://discourse.julialang.org/t/exact-numerical-logging/58766.md?page=1)
