The Programmer Calculator is a simple web-based calculator that allows you to perform arithmetic operations, bitwise operations, and base conversions for numbers in different bases (binary, octal, decimal, and hexadecimal).
-
Arithmetic Operations: You can perform basic arithmetic operations like addition, subtraction, multiplication, and division on decimal numbers.
-
Bitwise Operations: The calculator supports bitwise AND, OR, and XOR operations on binary numbers.
-
Base Conversions: You can switch between different bases (binary, octal, decimal, and hexadecimal) and perform calculations in the selected base.
-
Parentheses: The calculator correctly handles parentheses to evaluate expressions following the order of operations (PEMDAS).
-
Hexadecimal Alphabet: In hexadecimal mode, you can use the dropdown to select hexadecimal alphabet characters (A-F) for input.
-
Select Base: Use the "BIN," "OCT," "DEC," and "HEX" buttons to switch between different bases.
-
Input Numbers and Operators: Click on the buttons to input numbers (0-9), operators (+, -, *, /, %, &, |, ^, <<, >>), and parentheses.
-
Evaluate Expression: Click the "=" button to evaluate the expression. The result will be displayed in the input box.
-
Clear Display: Click the "C" button to clear the display.
-
Decimal Calculation:
2 + 3 * 4will display14as the result. -
Binary Calculation: In binary mode,
1101 + 1010will display10111as the result. -
Hexadecimal Calculation: In hexadecimal mode,
A + Bwill display21as the result.
The calculator uses a custom parser and evaluator with an Abstract Syntax Tree (AST) to handle different bases and operator precedence. You can further extend the functionality or customize the calculator to meet your specific requirements.
This calculator was created by [Badger Code].
This project is licensed under the MIT License - see the LICENSE.md file for details.