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

Setting bound for the fractional part #667

Open
BenjaminVannray opened this issue Jan 12, 2023 · 1 comment · May be fixed by #668
Open

Setting bound for the fractional part #667

BenjaminVannray opened this issue Jan 12, 2023 · 1 comment · May be fixed by #668

Comments

@BenjaminVannray
Copy link

Is it possible to specify a format with a minimum and maximum number of decimal places?

Some example inputs and outputs (for minimum 2, maximum 4):

1000 => 1000.00
1000.1 => 1000.10
1000.123 => 1000.123
1000.1234 => 1000.1234

Ideal would be to optionally allow just the minimum, so with minimum 2

1000.1 => 1000.10
1000.1234567 => 1000.1234567

I've tried this with the old style format string, but it doesn't appear to work (I'm using thousand separators, but that doesn't appear to make a difference when they are removed)

0,0.00[0000]
@BenjaminVanRyseghem
Copy link
Owner

I don't think it's currently possible, as if you specify a mantissa, it will force a length, no matter what. Maybe we could extend the value that mantissa accept to allow a min and max 😄

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 a pull request may close this issue.

2 participants