Skip to content

Commit 62827d8

Browse files
authored
Merge pull request #3715 from shallow-beach/master
Update article.md
2 parents d6e0376 + 5a0df77 commit 62827d8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

1-js/05-data-types/02-number/article.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ There are several built-in functions for rounding:
137137
: Rounds up: `3.1` becomes `4`, and `-1.1` becomes `-1`.
138138

139139
`Math.round`
140-
: Rounds to the nearest integer: `3.1` becomes `3`, `3.6` becomes `4`, the middle case: `3.5` rounds up to `4` too.
140+
: Rounds to the nearest integer: `3.1` becomes `3`, `3.6` becomes `4`. In the middle cases `3.5` rounds up to `4`, and `-3.5` rounds up to `-3`.
141141

142142
`Math.trunc` (not supported by Internet Explorer)
143143
: Removes anything after the decimal point without rounding: `3.1` becomes `3`, `-1.1` becomes `-1`.
@@ -147,8 +147,10 @@ Here's the table to summarize the differences between them:
147147
| | `Math.floor` | `Math.ceil` | `Math.round` | `Math.trunc` |
148148
|---|---------|--------|---------|---------|
149149
|`3.1`| `3` | `4` | `3` | `3` |
150+
|`3.5`| `3` | `4` | `4` | `3` |
150151
|`3.6`| `3` | `4` | `4` | `3` |
151152
|`-1.1`| `-2` | `-1` | `-1` | `-1` |
153+
|`-1.5`| `-2` | `-1` | `-1` | `-1` |
152154
|`-1.6`| `-2` | `-1` | `-2` | `-1` |
153155
154156

0 commit comments

Comments
 (0)