-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Trailing dot is returned for formatFloat with precision 0 #12586
Labels
Comments
I don't really mind the trailing dot, it actually reminds me that I'm using floats. a = 3.14159
print(f'{a:.0f}')
print('%.0f' % a)
print("{0:.0f}".format(a)) |
Maybe you want to format a float for SASS/SCSS for example. |
narimiran
added a commit
to narimiran/Nim
that referenced
this issue
Nov 4, 2019
…ion = 0' 'formatFloat' with 'precision = 0' now gives the same result (a number without a decimal point) in all backends. This is compatible with Python's formatters, too.
narimiran
added a commit
to narimiran/Nim
that referenced
this issue
Nov 5, 2019
…ion = 0' 'formatFloat' with 'precision = 0' now gives the same result (a number without a decimal point) in all backends. This is compatible with Python's formatters, too.
kiyolee
pushed a commit
to kiyolee/nim
that referenced
this issue
Nov 7, 2019
…ion = 0' (nim-lang#12592) * fix nim-lang#8242, fix nim-lang#12586: fix 'formatFloat' with 'precision = 0' 'formatFloat' with 'precision = 0' now gives the same result (a number without a decimal point) in all backends. This is compatible with Python's formatters, too. * fix failing tests * add changelog entry * add version switch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
strututils.formatFloat
returns a trailing dot when usingprecision = 0
.Example
Current Output
Expected Output
Additional Information
With the JS backend the expected result is returned. Tested with latest devel.
The text was updated successfully, but these errors were encountered: