산술
다음 테이블에는 JSON 표현식 언어와 함께 사용할 수 있는 산술 표현식이 나와 있습니다.
| Operation | 표현식 | 입력 | 출력 |
|---|---|---|---|
| Addition | ["+", operand1, operand2] |
{ sum: ["+", 2, 4] } |
{ sum: 6 } |
| 뺄셈 | ["-", operand1, operand2] |
{ difference: ["-", 10, 3] } |
{ difference: 7 } |
| 곱셈 | ["*", operand1, operand2] |
{ product: ["*", 5, 6] } |
{ product: 30 } |
| 나눗셈 | ["/", operand1, operand2] |
{ quotient: ["/", 20, 4] } |
{ quotient: 5 } |
| 모듈로 | ["%", operand1, operand2] |
{ remainder: ["%", 15, 4] } |
{ remainder: 3 } |
| 거듭제곱 | ["**", base, exponent] |
{ power: ["**", 2, 3] } |
{ power: 8 } |
| 절댓값 | ["abs", operand] |
{ absolute: ["abs", -5] } |
{ absolute: 5 } |
| Square Root(제곱 근) | ["sqrt", operand] |
{ sqroot: ["sqrt", 16] } |
{ sqroot: 4 } |
| 로그(밑 10) | ["log10", operand] |
{ log: ["log10", 100] } |
{ log: 2 } |
| 자연 로그 | ["ln", operand] |
{ ln: ["ln", Math.E] } |
{ ln: 1 } |
| 반올림 | ["round", operand] |
{ rounded: ["round", 3.7] } |
{ rounded: 4 } |
| 내림 | ["floor", operand] |
{ floor: ["floor", 3.7] } |
{ floor: 3 } |
| 올림 | ["ceil", operand] |
{ ceiling: ["ceil", 3.2] } |
{ ceiling: 4 } |
| 사인 | ["sin", operand] |
{ sine: ["sin", 0] } |
{ sine: 0 } |
| 코사인 | ["cos", operand] |
{ cosine: ["cos", 0] } |
{ cosine: 1 } |
| 탄젠트 | ["tan", operand] |
{ tangent: ["tan", Math.PI] } |
{ tangent: 0 } |