Skip to content

Feature Request: Change Precision Parameter to Rounding Parameter #12

@9-FS

Description

@9-FS

Currently, precision is enforced by optionally truncating to a fixed number of digits behind the comma .# or to a significant amount of digits ~#. Usually, this is undesired for displaying numbers and rounding is preferred.

Examples of desired behaviour

static rounding

  • [.3] 42069.69 => "42069.690"; trailing "0" gets added
  • [.2] 42069.69 => "42069.69"; nothing happens
  • [.1] 42069.69 => "42069.7"; rounded to 0.1s
  • [.0] 42069.69 => "42070"; rounded to whole numbers
  • [.-1] 42069.69 => "42100"; rounded to 10s
  • ...
  • [.-5] 42069.69 => "0"; rounded to 100000s, rounds number away completely

dynamic rounding

  • [~5] 69.69 => "69.690"; trailing "0" gets added
  • [~4] 69.69 => "69.69"; nothing happens
  • [~3] 69.69 => "69.7"
  • [~2] 69.69 => "70"
  • [~1] 69.69 => "70"
  • [~0] 69.69 => "0"; always returns "0"
  • [~-1] invalid option

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