Skip to content

Weird slash appears when formatting exponential notation #85

@jagot

Description

@jagot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions