Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

skip decimal point when 0 decimal digits are requested #97

Open
alusiani opened this issue Dec 26, 2020 · 2 comments
Open

skip decimal point when 0 decimal digits are requested #97

alusiani opened this issue Dec 26, 2020 · 2 comments

Comments

@alusiani
Copy link

When no decimal digits are requested, no decimal digits are formatted, but the decimal point is still included. This is different from printf in C and from format in Python, which omit the decimal point in this case.

Example in Python:

"{:.0f}".format(123.4)
## result: '123'

Example in Julia

using Formatting
fmt(".0f", 123.4)
## result: "123."
format("{:.0f}", 123.4)
## result: "123."

Would it be possible to change this behaviour and make it the same as C printf() and Python format()?

@sbrisard
Copy link

I second this request!
This discrepancy has led to nasty bugs in a workflow of mine that combines Python and Julia scripts.

@ScottPJones
Copy link
Collaborator

Note: this has been fixed (for several years) in Format.jl

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants