Skip to content

Commit 056b700

Browse files
author
Awjin Ahn
authored
More Math Functions Draft 2.2 (sass#2804)
* Rename `hypot()`'s args to `$numbers` for consistency. * All functions with cases for `-0` now have cases for `0`.
1 parent 3ef49d3 commit 056b700

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

accepted/more-math-functions.changes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Draft 2.2
2+
3+
* For consistency, all functions that have cases for `-0` also have cases for
4+
`0`. This includes `sqrt()`, `sin()`, `tan()`, `asin()`, and `atan()`.
5+
6+
* `hypot()`'s arguments are named `$numbers` for consistency.
7+
18
## Draft 2.1
29

310
* atan2()'s arguments must all have compatible units, or all be unitless.

accepted/more-math-functions.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# More Math Functions: Draft 2.1
1+
# More Math Functions: Draft 2.2
22

33
*[(Issue)](https://github.com/sass/sass/issues/851)*
44

@@ -165,15 +165,15 @@ clamp($min, $number, $max)
165165
### `hypot()`
166166

167167
```
168-
hypot($arguments...)
168+
hypot($numbers...)
169169
```
170170

171-
* If all arguments are not compatible with each other, throw an error.
172-
* If some arguments have units and some do not, throw an error.
173-
* If all arguments are unitless, the return value is unitless.
174-
* Otherwise, the return value takes the unit of the leftmost argument.
175-
* If any argument equals `Infinity` or `-Infinity`, return `Infinity`.
176-
* Return the square root of the sum of the squares of each argument.
171+
* If all numbers are not compatible with each other, throw an error.
172+
* If some numbers have units and some do not, throw an error.
173+
* If all numbers are unitless, the return value is unitless.
174+
* Otherwise, the return value takes the unit of the leftmost number.
175+
* If any number equals `Infinity` or `-Infinity`, return `Infinity`.
176+
* Return the square root of the sum of the squares of each number.
177177

178178
### Exponentiation
179179

@@ -242,6 +242,7 @@ sqrt($number)
242242
* If `$number` has units, throw an error.
243243
* If `$number < 0`, return `NaN` as a unitless number.
244244
* If `$number == -0`, return `-0` as a unitless number.
245+
* If `$number == 0`, return `0` as a unitless number.
245246
* If `$number == Infinity`, return `Infinity` as a unitless number.
246247
* Return the square root of `$number`, as a unitless number.
247248

@@ -272,6 +273,7 @@ sin($number)
272273
* If `$number == Infinity` or `$number == -Infinity`, return `NaN` as a unitless
273274
number.
274275
* If `$number == -0`, return `-0` as a unitless number.
276+
* If `$number == 0`, return `0` as a unitless number.
275277
* Return the [sine][] of `$number`, as a unitless number.
276278

277279
[sine]: https://en.wikipedia.org/wiki/Trigonometric_functions#Right-angled_triangle_definitions
@@ -287,6 +289,7 @@ tan($number)
287289
* If `$number == Infinity` or `$number == -Infinity`, return `NaN` as a unitless
288290
number.
289291
* If `$number == -0`, return `-0` as a unitless number.
292+
* If `$number == 0`, return `0` as a unitless number.
290293
* If `$number` is equivalent to `90deg +/- 360deg * n`, where `n` is any
291294
integer, return `Infinity` as a unitless number.
292295
* If `$number` is equivalent to `-90deg +/- 360deg * n`, where `n` is any
@@ -317,6 +320,7 @@ asin($number)
317320
* If `$number` has units, throw an error.
318321
* If `$number < -1` or `$number > 1`, return `NaN` as a number in `deg`.
319322
* If `$number == -0`, return `-0deg`.
323+
* If `$number == 0`, return `0deg`.
320324
* Return the [arcsine][] of `$number`, as a number in `deg`.
321325

322326
[arcsine]: https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Basic_properties
@@ -329,6 +333,7 @@ atan($number)
329333

330334
* If `$number` has units, throw an error.
331335
* If `$number == -0`, return `-0deg`.
336+
* If `$number == 0`, return `0deg`.
332337
* If `$number == -Infinity`, return `-90deg`.
333338
* If `$number == Infinity`, return `90deg`.
334339
* Return the [arctangent][] of `$number`, as a number in `deg`.

0 commit comments

Comments
 (0)