Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.
This repository was archived by the owner on Apr 13, 2026. It is now read-only.

Incorrect formatting on very small numbers #19

@foundryspatial-duncan

Description

@foundryspatial-duncan

I found this repo while searching for a fork that fixed the Numeral JS bug "NaN returned if value < 1e-6"
I see that this fork fixes that issue somewhat; it doesn't return NaN anymore, but the formatting of the output string has problems.

If I use format 0,0 on a number like 4.8439166267322474e-8, the formatted string looks like this:

4.8,439,166,267,322,474e-8

Note there are commas in the mantissa after the decimal point. I'd expect an output of 0 here, actually.

Format 0,0.00 returns the same string as above, where I'd expect 0.00 or 4.84e-8 or something.

Here's a codepen that shows the strangeness:
https://codepen.io/foundryspatial-duncan/pen/YzqWxgK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions