Skip to content

[css-values] Redundancy of atan2() #4485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Crissov opened this issue Nov 5, 2019 · 2 comments
Closed

[css-values] Redundancy of atan2() #4485

Crissov opened this issue Nov 5, 2019 · 2 comments
Labels
css-values-4 Current Work

Comments

@Crissov
Copy link
Contributor

Crissov commented Nov 5, 2019

In #2331 (comment) Iʼve aleady asked to incorporate the functionality offered by atan2() into atan().

I understand that many authors will be familiar with “atan2” or “arctan2” from programming languages, JS in particular. According to Wikipedia, some languages support an optional parameter for their arctangent function: Common Lisp, Mathematica. Other implementations, spreadsheet formulas in particular, expect the arguments in the reverse order.

Can we add an optional second argument to atan() while keeping atan2() with two mandatory arguments?

@Crissov Crissov changed the title [] Redundancy of atan2() [css-values] Redundancy of atan2() Nov 5, 2019
@ewilligers
Copy link
Contributor

If we copied rgb and rgba, we would have both allowing one or two arguments, with serialization rules that atan and atan2 serialize as atan if they have one argument and atan2 if they have two arguments.

I'd prefer that we be consistent with JavaScript. Intent is clearer when authors always use atan with one argument and atan2 with two arguments.

@ewilligers ewilligers added the css-values-4 Current Work label Nov 5, 2019
@tabatkins
Copy link
Member

I made the intentional choice to include both atan() and atan2() to coincide with JS; I've since made sure that the functions agree with JS in as many additional ways as possible, most particularly their corner-case behavior for NaN/Infinity/zero in various spots.

Sticking close to JS for these functions is, I think, better. And as long as we're keeping atan2() around anyway (as your issue suggests we do), I don't think diverging from JS to allow atan() to copy the functionality makes a lot of sense; it doesn't add any new functionality, and there's no guarantee it would accord in all the corner cases with the 1-or-2-args versions of atan in other programming languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-values-4 Current Work
Projects
None yet
Development

No branches or pull requests

3 participants