Skip to content

Round to significant number of digits #11

@hasko

Description

@hasko

I found it useful to have a function that rounds a float to a given number of significant digits, regardless of magnitude. I needed this for some exponential scales and I thought maybe it would have some value if added to this module. I've also created a pull request.

Example:

roundSig 3 1234.5 gives "1230"
roundSig 3 1.2345 gives "1.23"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions