Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 62827d8

Browse files
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‎

Lines changed: 3 additions & 1 deletion
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`. Inthe 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)

AltStyle によって変換されたページ (->オリジナル) /