2025-01-24T02:27:50

This commit is contained in:
2025-01-24 02:27:50 +09:00
parent 342a843ce6
commit f43f6328c0
47 changed files with 292 additions and 145 deletions

94
doc/topics/Number.md Normal file
View File

@@ -0,0 +1,94 @@
# 숫자
자바스크립트에서 모든 숫자는 8바이트 배정밀도 부동소수형으로 저장됩니다. 숫자에는 ```+Infinity```, ```-Infinity```, ```NaN``` 3개의 특수 값이 포함됩니다.
## Number
```javascript
Number.MAX_VALUE
Number.MIN_VALUE
Number.NaN
Number.NEGATIVE_INFINITY
Number.POSITIVE_INFINITY
Number.EPSILON
Number.MIN_SAFE_INTEGER
Number.MAX_SAFE_INTEGER
```
```javascript
Number.parseFloat()
Number.parseInt()
Number.isFinite()
Number.isInteger()
Number.isNaN()
Number.isSafeInteger()
```
```javascript
toExponential()
```
지수 표기법으로 나타낸 문자열을 반환합니다. 매개 변수에는 소수점 이하 자릿수를 전달합니다.
```javascript
toFixed()
```
고정 소수점 방식으로 표현된 문자열을 반환합니다. 매개 변수에는 소수점 이하 자릿수를 전달하며, 기본 값은 0입니다.
```javascript
toPrecision()
```
유효 자릿수에서 반올림한 문자열을 반환합니다. 매개 변수에는 유효자릿수를 전달합니다.
## Math
```javascript
Math.PI
```
```javascript
/* 절대값 */
Math.abs()
/* 삼각함수 */
Math.sin()
Math.cos()
Math.tan()
Math.asin()
Math.acos()
Math.atan()
Math.atan2()
Math.sinh()
Math.cosh()
Math.tanh()
Math.asinh()
Math.acosh()
Math.atanh()
/* 제곱근 */
Math.pow(a, n) // a의 n승
Math.sqrt(a) // 제곱근
Math.cbrt(a) // 세제곱근
/* 지수와 로그 */
Math.exp()
Math.expm1()
Math.log10()
Math.log1p()
Math.log2()
/* 올림과 내림 */
Math.floor()
Math.ceil()
Math.round()
Math.fround()
Math.trunc()
/* 최소, 최대 */
Math.min(a, ...)
Math.max(a, ...)
/* 랜덤 */
Math.random() // 0 ~ 1 사이의 값을 반환
/* 그 외 */
Math.hypot(a, ...)
Math.sign(a) // 어떤 수의 부호를 반환. 1, 0, -0, -1, NaN 중 하나를 반환.
Math.clz32(a) // 숫자를 32비트 이진 표현으로 변환 후 앞 쪽의 0의 갯수를 반환
Math.imul(a, b) // 두 숫자의 32비트 정수 곱셈. ECMAScript2015에서 추가되었습니다.
```