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

How to represent "0.00" #354

Open
omkar9194 opened this issue Feb 22, 2024 · 2 comments
Open

How to represent "0.00" #354

omkar9194 opened this issue Feb 22, 2024 · 2 comments

Comments

@omkar9194
Copy link

omkar9194 commented Feb 22, 2024

I find that if we do
var zero = decimal.FromString("0.00")
Then print zero/ assign it to string after conversion, Instead of printing 0.00, 0 is printed.

Similarly if we do
var seventy = decimal.FromString("0.70")
Then print zero/ assign it to string after conversion, Instead of printing 0.70, 0.7 is printed.

Is there a pre-existing solution for this? If not, can this be added as a feature?

@mwoss
Copy link
Member

mwoss commented Feb 22, 2024

By default trailing zeroes are truncated when decimals are converted to string representation. We are discussion potential enhancement in this PR #296

@serprex
Copy link
Contributor

serprex commented Apr 5, 2024

In the meantime, you can use d.StringFixed(2) if you only want printing 2 decimal places

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

3 participants