We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e453c1 commit 651bbc7Copy full SHA for 651bbc7
source/basic/operator/README.md
@@ -111,8 +111,20 @@ console.log(10 * 0.5); // => 5
111
```js
112
console.log(8 / 2); // => 4
113
console.log(10 / 0.5); // => 20
114
+
115
+// 正の無限大
116
+console.log(10 / 0); // => Infinity
117
+console.log(-10 / -0); // => Infinity
118
+// 負の無限大
119
+console.log(-10 / 0); // => -Infinity
120
+console.log(10 / -0); // => -Infinity
121
```
122
123
+0で除算した場合、無限大を表す数値である`Infinity`として評価されます。
124
+演算結果が0未満で表される場合は、負の無限大を表す`-Infinity`となります。
125
126
+四則演算において、式の一部でInfinityと評価されてしまうと、式全体の演算結果も意図しないものとなります。そのため、除算演算子を使う場合には右オペランドの値が0になるケースには注意が必要です。
127
128
### 剰余演算子(`%`) {#modulus-operator}
129
130
2つの数値を除算したあまりを求める演算子です。左オペランドを右オペランドで除算したあまりを返します。
0 commit comments