Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dumping large floating numbers (fix #2367) #2661

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

itchyny
Copy link
Contributor

@itchyny itchyny commented Jul 6, 2023

Due to the differences of DBL_MAX and DBL_MIN definition between compilers, large floating number literals in input JSON are dumped incorrectly as reported by #2367. This PR fixes #2367.

@itchyny itchyny added the bug label Jul 6, 2023
@itchyny itchyny added this to the 1.7 release milestone Jul 6, 2023
// (or "-Infinity"), and to reduce stack allocations as possible, we
// normalize infinities in the callers instead of printing the maximum
// (or minimum) double here.
return NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By returning NULL here will we end up here https://github.com/jqlang/jq/blob/master/src/jv_print.c#L243-L252 and inf gets clamped to DBL_MAX?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly.

@itchyny itchyny merged commit 6944d81 into jqlang:master Jul 6, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent dump results of jq
2 participants