Skip to content

More unit API - #870

Open
Seggan wants to merge 8 commits into
masterfrom
seggan/api/derived-units
Open

More unit API#870
Seggan wants to merge 8 commits into
masterfrom
seggan/api/derived-units

Conversation

@Seggan

@Seggan Seggan commented Jul 7, 2026

Copy link
Copy Markdown
Member
  • Added derived units
  • Cleaned up UnitFormat a bit
  • Improved docs
  • Changed the confusing behavior of autoSelectPrefix and renamed it
  • Finally fixed the percent sign having a space before it

@Seggan
Seggan requested a review from a team July 7, 2026 18:49
* Sets the number of significant figures. For example, if this is set to 3, then a value
* of 0.472894 will be shown as 0.473.
* Sets the number of significant figures. Uses [RoundingMode.HALF_UP] for rounding.
* For example, if this is set to `3`, then a value of `0.472894` will be shown as `0.473`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad example to use as the result would be the same with a 3 DP round. An example where the result is different than a DP round and you showcase the half up rounding is best imo. Ie 3.755 -> 3.76


/**
* Sets the number of decimal places. This overrides significant figures if both are set.
* If [force] is true, the formatted number will always have this many decimal places.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add output example here as well but I'm not requiring it.

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

Successfully merging this pull request may close these issues.

4 participants