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

Feature request: add a way to set the format of floats and doubles in the JSON output #894

Closed
t-cadet opened this issue Sep 6, 2024 · 1 comment
Labels
discussion The viability / implementation of the issue is up for debate feature Code based project improvement

Comments

@t-cadet
Copy link

t-cadet commented Sep 6, 2024

The idea is to provide a way for Crow users to set the format of floating-point numbers in the JSON output to best fit their use case.

For example in my case having less significant digits:

  • improves readability
  • makes the output less sensitive to small changes in computations
  • makes diffing outputs for tests more robust

Related: #891

@gittiver gittiver added feature Code based project improvement discussion The viability / implementation of the issue is up for debate labels Sep 6, 2024
@gittiver
Copy link
Member

gittiver commented Sep 6, 2024

problem is loss of precision depending on value of the number. An implementation according to should use the maximum possible precision for 64bit double values.

Therefore this feature will not be implemented.

If you need a workaround for tests, store the value as string not as Number.

@gittiver gittiver closed this as completed Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion The viability / implementation of the issue is up for debate feature Code based project improvement
Projects
None yet
Development

No branches or pull requests

2 participants