기본 계산기
사칙연산을 빠르고 간편하게 계산
기본 계산기란?
기본 계산기는 더하기(+)·빼기(−)·곱하기(×)·나누기(÷) 등 일상적인 사칙연산을 키패드나 키보드로 빠르게 처리하는 도구입니다. 서버나 외부 라이브러리 없이 브라우저 안에서 직접 수식을 해석해 계산하며, 결과를 이어서 다음 계산의 시작값으로 사용할 수 있는 연속 계산을 지원합니다.
사용 방법
화면의 키패드 버튼을 눌러 숫자와 연산자를 입력하고 = 버튼으로 계산을 실행합니다. C는 전체 지우기, ←는 마지막 한 글자 지우기, %는 현재 입력된 숫자를 퍼센트 값(÷100)으로 바꿉니다. 물리 키보드도 그대로 사용할 수 있습니다: 숫자와 + - * /, 소수점은 ., 계산 실행은 Enter, 지우기는 Backspace(한 글자)와 Esc(전체), 퍼센트는 % 키로 입력합니다.
연산자 우선순위
이 계산기는 괄호 버튼이 없는 대신, 수학의 표준 규칙대로 곱하기·나누기(×÷)를 먼저 계산한 뒤 더하기·빼기(+−)를 왼쪽에서 오른쪽으로 계산합니다. 예를 들어 2 + 3 × 4를 입력하면 (2+3)×4=20이 아니라, 3×4=12를 먼저 계산한 뒤 2를 더한 14가 결과로 나옵니다.
| 입력 | 계산 순서 | 결과 |
|---|---|---|
| 2 + 3 × 4 | 3×4=12 → 2+12 | 14 |
| 10 − 4 ÷ 2 | 4÷2=2 → 10−2 | 8 |
| 50 % | 50 ÷ 100 | 0.5 |
| 7 ÷ 0 | 0으로 나누기 | 오류 |
헷갈리는 연산 순서 — "6÷2(1+2)" 논쟁과 퍼센트 버튼의 차이
인터넷에서 종종 화제가 되는 6 ÷ 2(1+2) 같은 식은 사람마다 답을 1 또는 9로 다르게 계산해 논쟁이 벌어지곤 합니다. 괄호 앞에 생략된 곱셈(암묵적 곱셈)을 나눗셈보다 먼저 계산해야 한다고 보면 6÷(2×3)=6÷6=1이 되고, 곱셈과 나눗셈을 같은 우선순위로 보고 왼쪽부터 순서대로 계산하면 (6÷2)×3=3×3=9가 됩니다. 이는 계산기나 사람마다 암묵적 곱셈의 우선순위를 다르게 해석하기 때문에 생기는 표기법의 모호함이지, 어느 한쪽이 명백히 틀린 것은 아닙니다.
이 계산기는 괄호나 암묵적 곱셈 입력 자체를 지원하지 않으므로 이런 모호함이 애초에 발생하지 않습니다. 코드를 확인하면 곱하기·나누기는 같은 우선순위(PREC 값 2)로 두고 더하기·빼기(우선순위 1)보다 먼저 계산하며, 우선순위가 같은 연산자끼리는 입력한 순서(왼쪽에서 오른쪽) 그대로 계산하는 표준 Shunting-yard 방식을 씁니다.
퍼센트(%) 버튼도 계산기마다 동작이 다릅니다. 일부 계산기는 100 + 10 %를 "100의 10%인 10을 더한다"고 해석해 110을 내놓지만, 이 계산기의 %는 직전 입력값 자체를 100으로 나누는 단순 변환만 수행합니다. 코드로 실제 동작을 확인하면, 100 + 10 %를 입력할 경우 10을 0.1로 바꾼 뒤 100과 더하므로 결과는 110이 아니라 100.1입니다. 계산기 종류마다 % 버튼의 동작이 다를 수 있다는 점을 기억해 두면 좋습니다.
What is the Basic Calculator?
A quick arithmetic tool for addition, subtraction, multiplication and division, usable from the on-screen keypad or your physical keyboard. It parses expressions directly in the browser (no server, no external library) and supports chained calculations, letting you continue from a previous result.
How to use it
Tap numbers and operators, then press = to compute. C clears everything, ← deletes the last character, and % converts the current number to its percentage value (÷100). Keyboard shortcuts: digits and + - * /, . for the decimal point, Enter to compute, Backspace/Esc to delete, and % for percent.
Operator precedence
There are no parentheses buttons; instead, standard math rules apply — multiplication and division first, then addition and subtraction left to right. For example, 2 + 3 × 4 evaluates 3×4=12 first, then adds 2, giving 14 (not 20).
| Input | Order | Result |
|---|---|---|
| 2 + 3 × 4 | 3×4=12 → 2+12 | 14 |
| 10 − 4 ÷ 2 | 4÷2=2 → 10−2 | 8 |
| 50 % | 50 ÷ 100 | 0.5 |
| 7 ÷ 0 | Division by zero | Error |
The "6÷2(1+2)" debate and how the percent button differs
Expressions like 6 ÷ 2(1+2) famously produce two different answers, 1 or 9, depending on whether the implicit multiplication before the parenthesis is treated as higher priority than division (giving 6÷6=1) or as equal priority evaluated left to right (giving 3×3=9). This ambiguity comes from notation, not from either answer being wrong.
This calculator doesn't accept parentheses or implicit multiplication, so the ambiguity never arises: multiplication and division share the same precedence and are evaluated strictly left to right using a standard Shunting-yard approach.
The percent button also behaves differently across calculators. Some interpret 100 + 10 % as "add 10% of 100," giving 110. This calculator's % simply divides the currently entered number by 100, so 100 + 10 % converts 10 to 0.1 and adds it to 100, giving 100.1 — not 110.