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

Golden rectangles would probably be a major use case. Since many graphic designers demand pixel-perfect layouts across devices and browsers, Iʼd say a reasonable approximation of φ would yield accurate results for all integer base edges up to, say, `2000px`, because larger values are very rarely useful. This would stay accurate, if one could correct initial errors by always rounding in the same way. Alas, with 8:5, a rectangle 100px wide would be 160px tall instead of 161px and rounding could not help at all.

The first approximation of φ by the ratio of two adjacent Fibonacci numbers that is …

- … better than 17/12 and 24/17 for √2 or `sqrt(2)` (i.e. 100.17% and 99.83%) is f~8~/f~7~ = 21/13 ≈ 1,615385. 
- … better than 22/7 for π or `pi` (i.e. 100.04%) is f~10~/f~9~ = 55/34 ≈ 1.617647. 
- … correct to 3 decimal places (with truncation, no rounding) is f~11~/f~10~ = 89/55 = 1.6(18). 
- … correct to 4 decimal places is f~13~/f~12~ = 233/144 = 1.6180(5). 
- … correct to 5 decimal places is f~15~/f~14~ = 610/377 ≈ 1,618037. 
- … correct to 6 decimal places is f~18~/f~17~ = 2584/1597 ≈ 1,6180338. 

By the way, a static function to return the *n*-th Fibonacci number _could have been_ a reasonable substitute to `phi` as a constant, e. g.: `fibonacci(3)` = `3`.The actual sequence could also have been up to a parameter, e. g.: `seq(prime, 3)` = `seq(fibonacci, 4)` = `5` with `seq(prime, 0)` = `seq(fibonacci, 0)` = `seq(fibonacci, 1)` = `1`.

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

Received on Thursday, 30 January 2020 07:18:45 UTC