Skip to content

Latest commit

 

History

History
35 lines (29 loc) · 1.17 KB

README.md

File metadata and controls

35 lines (29 loc) · 1.17 KB

JavaScript

Calculator

A functional calculator with Order of Operations.

BASIC OPERATIONS
addition | 1 + 2 = -> 3
multiplication | 1 * 2 = -> 2
division | 1 / 2 = -> 0.5
subtraction | 1 - 2 = -> -1

COMPREHENSIVE OPERATIONS
successive operations | 1 + 1 + 2 = -> 4
decimals | 1 . 1 + 1 . 1 = -> 2.2
multiple decimals | 1 ... 1 + 1 ... 1 = -> 2.2
multiple operations | 1 ++++ 2 = -> 3
changing operations | 1 + - * 2 = -> 2
operation repeat | 1 + 1 = = = -> 4
operation rollover | 1 + 1 + = + = -> 8
division by zero | 1 / 0 = "Cannot divide by zero"
all clear | 4 * 5 = AC -> 0

ADVANCED OPERATIONS
premature operation | ++++ 1 * 3 = -> 3
missing operation | 3 = -> 3
partial operand | 3 * = -> 9
missing operands | = = = = -> 0

order of operations | 1 + 3 / 4 + 10 * 2 = -> 21.75
clear | 4 * 10 C 5 * C 2 = -> 40
backspace | 4 * 10 ← 5 * 10 ← = -> 60
plus/minus | 4 ± + 4 ± = -> -8
binary rounding | 0.1 + 0.2 -> 0.3 (not 0.300000004)