Re: [csswg-drafts] [css-values] Math Constant phi for Golden Ratio (#4702)

The point is that with `round()` inside CSS, authors are no longer forced to use rounded components in calculations to get nice numbers in the end, but can just round the result: round(f(φ)) instead of f(round(φ)). 

Authors already can use better approximations than 1.6 (which tends to lead to round but inaccurate results) or 1.618 (which leads to more accurate but odder results), e. g. `calc(610/377)`, or they can limit themselves to integer values from the Golden series, and Iʼm sure that some are doing either already, and likewise some will soon put accurate representations of φ into their code, i. e. `calc((1+sqrt(5))/2)` or `calc(0.5+sqrt(1.25))`. However, if a design system, like [GRT](https://grtcalculator.com/math/), relies on an equality like φ – 1 = 1 / φ, things will misalign due to, for instance, 0.6 ≠ 0.625 (for Golden numbers 5 and 8). Also, early rounding will yield inaccurate results if authors are not very careful with their math, e. g.: in a series of sizes where adjacent steps are a factor of φ apart, starting with a base of 10 and results being rounded to integers, a factor of 8/5 leads to 16, 26 and 41, whereas 13/8 has 43 in the last step, but 42 would be accurate and could be achieved by alternating the approximate factors or by multiplying by the rounded intermediate steps, i.e. 

- `round(10 * 8/5 * 13/8 * 8/5, 1)`, 
- `round(10 * 13/8 * 8/5 * 13/8, 1)` or
- `round(round(round(10 * 1.6), 1) * 1.6, 1) * 1.6, 1)` instead of 
- `round(10 * pow(phi, 3), 1)`. 

-- 
GitHub Notification of comment by Crissov
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4702#issuecomment-585047931 using your GitHub account

Received on Wednesday, 12 February 2020 06:15:25 UTC