-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Support the flag '
for thousand separator in Printf, issue #29077
#42145
base: master
Are you sure you want to change the base?
Support the flag '
for thousand separator in Printf, issue #29077
#42145
Conversation
Add tests Update the struct Spec Extend plength() for thousand sep. Update Base.string for Spec including apostrophe Supports integer output Fix wrong test Add test for printing float as %'d Reset the way to insert the thousand operator Add `insertsep` function Add tests for the combinations of the thousand separator and others Implement the thousand operator option for %d, %u, and %i
Add tests for thousand separators for floats Implement thousand separators for floats: %f, %F, %g, and %G Fix `countthousandsep` for proper rounding Add tests for BigFloat with thousand separators Fix impl for BigFloat with thousand separators Add tests for BigFloat with zero precision and a thousand separator WIP: for scientific notation when %'g Add function `findonesplace`
@quinnj, maybe you could take a look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overall looks like useful functionality. I've left a few comments about improving the performance, which we want to be sensitive too. i.e. for formats not using the apostrophe
, we'd ideally have zero impact from this net-new code. I think the BigInt
trunc
is the only really tricky part; we need to find another, more efficient way to get that information.
@quinnj Thanks for the review. I will try to fix the code, and you are right about the BigInt issue; I need to think about it more carefully. |
Now that #40105 is released in Julia 1.10, I want this functionality even more (to eliminate my need for the Formatting.jl package). Maybe @johanmon, having worked on this function recently, has some ideas to avoid the performance issues above? |
It seems this PR has stalled because of some performance concerns.
Would something like the following work as an alternative to the BigInt version?
I think the other issues raised were using @ki-chi, are you still willing to work on this? |
Sorry for leaving that pull request hanging. I need more time to work on this PR now. But I always welcome any suggestion to resolve the performance issue above. |
Closes #29077.
The flag
'
is valid only for the decimal notation, i.e., the following formats:%d
,%u
,%i
,%f
,%F
,%g
, and%G
.