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

Weird slash appears when formatting exponential notation #85

Open
jagot opened this issue May 13, 2024 · 0 comments
Open

Weird slash appears when formatting exponential notation #85

jagot opened this issue May 13, 2024 · 0 comments

Comments

@jagot
Copy link

jagot commented May 13, 2024

When formatting some numbers (I have only seen this for 1e-10) using exponential notation, a wild slash appears, see below:

julia> using Format

julia> format("{1:.16g}", 1e-10)
"1.000000000000000/e-10"

julia> format("{1:.16g}", 1e-5)
"1.0000000000000000e-05"

julia> format("{1:.17g}", 1e-10)
"1.00000000000000000e-10"

julia> format("{1:.17g}", 1e-5)
"1.00000000000000000e-05"

julia> format("{1:.16e}", 1e-10)
"1.000000000000000/e-10"

julia> format("{1:.16e}", 1e-9)
"1.0000000000000000e-09"

julia> format("{1:.16e}", 1e-10)
"1.000000000000000/e-10"

julia> format("{1:.16e}", 2e-10)
"1.9999999999999996e-10"

(tmp) pkg> st
Status `/private/tmp/Project.toml`
  [1fa38f19] Format v1.3.7

As seen above, I can somehow avoid it by increasing to 17 decimals, but it seems slightly arbitary.

jagot added a commit to MBI-Theory/strong-field-exercises that referenced this issue May 13, 2024
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

1 participant