Skip to content

Conversation

@chriadam
Copy link
Contributor

Previously, when the units of a value was scaled up, we did not increase the displayed precision. Thus, a value with precision 0 such as 12345 W would be scaled up to 12.345 kW and then trimmed to 12 kW due to the specified precision.

This commit adjusts the logic to allow increasing the precision so long as the total number of digits is less than 4. That is, 12345 W will now be displayed as 12.35 kW.

Previously, the decimal point character seemed to have been considered to take up a "digit" when calculating whether to trim the precision in some cases (e.g. for precision 2 values with 2 non-decimal digits, precision was trimmed to just 1).

This commit removes that consideration, which allows removal of some unnecessary special-casing for Volts unit values.

Contributes to issue #2705

Previously, when the units of a value was scaled up, we did not
increase the displayed precision.  Thus, a value with precision 0
such as 12345 W would be scaled up to 12.345 kW and then trimmed
to 12 kW due to the specified precision.

This commit adjusts the logic to allow increasing the precision
so long as the total number of digits is less than 4.
That is, 12345 W will now be displayed as 12.35 kW.

Previously, the decimal point character seemed to have been
considered to take up a "digit" when calculating whether to
trim the precision in some cases (e.g. for precision 2 values
with 2 non-decimal digits, precision was trimmed to just 1).

This commit removes that consideration, which allows removal of
some unnecessary special-casing for Volts unit values.

Contributes to issue #2705
@chriadam
Copy link
Contributor Author

DO NOT MERGE. Not for v1.2.x.

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.

2 participants