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

Change defaults for format-style printing? #506

Open
skirpichev opened this issue Aug 12, 2024 · 1 comment
Open

Change defaults for format-style printing? #506

skirpichev opened this issue Aug 12, 2024 · 1 comment

Comments

@skirpichev
Copy link
Contributor

Documentation says: The default format is '.6f'. While this can be considered as a feature, I would prefer to be compatible with CPython floats here (in short, in CPython default is almost same as 'g').

With 'f' it's easy to demolish significand to dust:

>>> f'{gmpy2.mpfr(1.3335678912e-10)}'
'0.000000'
>>> f'{gmpy2.mpfr(1.3335678912e-10):g}'
'1.33357e-10'
@casevh
Copy link
Collaborator

casevh commented Sep 5, 2024

I agree that matching CPython is important. I don't remember why I chose '.6f'.

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

No branches or pull requests

2 participants