W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2019

Re: [csswg-drafts] [css-values] Trigonometric functions (#2331)

From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
Date: Fri, 01 Mar 2019 00:44:25 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-468497573-1551401064-sysbot+gh@w3.org>
Thanks for all the input everyone! (You're making my eventual job much easier.)

A couple quick responses:

@Crissov The consensus in the room was to match JavaScript's `Math` functions for naming.  I agree with Tab that `sqrt()` should be considered a convenience function.  If it turns out that we need a general root function because of numerical issues with `pow` (i.e., with `pow(pow(x, 1/3), 3)` not neatly cancelling out), then a `root()` could be added later.

Regarding cotangent and so on: we're not saying they'll never be added, but they aren't the priority. JS has survived without them, so we think devs can work with what they're given.  Again, until we start getting complaints about numerical imprecision causing real-world problems!

@jonathantneal @valtlai  The way I interpret the slash delimiter is that it is added for clarity if simple space separation is ambiguous because of optional values, and commas indicate lists of repeated compound values.  But, we have lots of existing functions that use commas for 

The only functions (of those we're discussing at this point) that take multiple parameters are atan2, pow, and hypot.

atan2 is interesting since it is conceptually a ratio/division, but we want the function to be able to keep track of whether the numerator or denominator or both are negative.  But it would probably be weird to have a slash mean "conceptual division and separator" in this one function when it is simple division in the others.  And we're never going to extend it to a list, so there's no ambiguity in using a comma.

pow could be space-separated, but again there's no harm in making it a comma separator.

hypot is more a list of values, especially if we allow it to work on more than 2 (I'd like to at least support 3 values, for 3D transform constructs). So comma works there quite naturally.

@ewilligers I definitely like the idea of skipping the nested `calc()` function if it can be omitted unambiguously.  And as you say, it's an argument against using a slash as the separator, and against using whitespace — even if whitespace between two math expressions could technically be unambiguous to the parser, it would be very ambiguous to a human author!

-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2331#issuecomment-468497573 using your GitHub account
Received on Friday, 1 March 2019 00:44:27 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:26:57 UTC