Skip to content

What should the output of to_chars(123456789.0, chars_format::general) be? #1487

Discussion options

You must be logged in to vote

I found the Standardese here to be unclear, and explained my reasoning on Reddit last year. The central question is indeed what P should be, and the confusion is caused by the Standardese being split between C and C++. Your Question 2 about 10000 is essentially the same as my 1700 scenario.

My interpretation was that printf's "style" is used to decide between fixed and scientific, and I considered the P = 6 default to be applicable, because the precision was indeed omitted in the to_chars call. But the actual number of digits being printed is controlled by the C++ Standardese. This is indeed a different interpretation than behaving like %.*g with a magically varying runtime precision - th…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by statementreply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants