Skip to content

Json reals#85

Merged
ac000 merged 2 commits intomasterfrom
json_reals
Apr 29, 2025
Merged

Json reals#85
ac000 merged 2 commits intomasterfrom
json_reals

Conversation

@ac000
Copy link
Copy Markdown
Owner

@ac000 ac000 commented Apr 29, 2025

Fix displaying/writing of real numbers. Requires jansson 2.14.1

ac000 added 2 commits April 29, 2025 22:54
This partly reverts commit 609b24a.

It reverts the JSON_REAL_PRECISION(16) part.

So the above commit was made in an attempt to try and fix real numbers
like

  565.56

being shown/written as

  565.55999999999995

and while it helped it didn't fix every case, like the above number.

In the meantime jansson (the JSON library in use) gained a new mechanism
for dealing with such things in the form of David M. Gay's dtoa work.

This seems to resolve the issue, if you leave the default precision at
17.

This patch is in the 2.14.1 release of jansson, so that kind of becomes
a hard requirement for the proper functioning of all this.

Link: <akheron/jansson@8b975ab>
Link: <https://github.com/akheron/jansson/releases/tag/v2.14.1>
Signed-off-by: Andrew Clayton <ac@sigsegv.uk>
Signed-off-by: Andrew Clayton <ac@sigsegv.uk>
@ac000 ac000 merged commit 5b18743 into master Apr 29, 2025
8 checks passed
@ac000 ac000 deleted the json_reals branch April 29, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant