Allow rounding option
See original GitHub issueThis option allows users to limit the default precision to what’s defined in precision
, but doesn’t round the number if the rounded number isn’t equal to the number itself. This may sound a bit vague, so let’s demonstrate this with an example:
Let’s assume you have configured precision: 5
and allowRounding: false
:
calc(100% / 3)
will outputcalc(100% / 3)
becausecalc(100% / 3) != 33.33333%
calc(100% / 4)
will output25%
becausecalc(100% / 4) == 25%
What’s the advantage? We never have rounded numbers which can cause issues like https://github.com/twbs/bootstrap/pull/27374 and we don’t have expressions like calc(100% / 4)
that can be simplified.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Set rounding precision - Microsoft Support
Force the value of numbers to the rounding precision that is displayed by using the “Precision as displayed” option.
Read more >ROUNDED Option - Micro Focus
The arithmetic statements allow for the ROUNDED phrase to be optionally specified. The results of an arithmetic statement depend on whether this phrase...
Read more >Formatting using the Rounding Function - Webucator
The syntax is simply Round (x) , with x being the numeric or currency field to be rounded. Here are some examples of...
Read more >Rounding Option - Caseware
The Rounding Option dialog enables you to specify program settings for expressing numeric values. This option only applies to Connector linkages created ...
Read more >Rounding in Power Query – The default rounding mode and ...
Let 's say I have a set of numbers that I want to round to two decimal places. ... If we use the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
precision: 'safe'
would still need some kind of precision. Lets say for some reason the generated value would be:15.35153465435186437435513
(and this is the exact number, no numbers after the last 3). That’s a pretty long number, probably something you don’t want. This is why I splitprecision
&allowRounding
.@MartijnCuppens Maybe we can do better:
?