A fully functional, responsive single-file calculator web app (HTML + CSS + JavaScript in one file) with a dark glassmorphic UI, keyboard support, and a scientific mode.
Open index.html in any modern browser.
For the Help modal (which loads /README.md) to work reliably, run a local server in this folder and open the app via HTTP:
python -m http.server- STD mode: standard calculator keys + VAT tools + currency conversion.
- SCI mode: scientific keys (toggle using the top-right mode pill).
- TRZ mode: same UI/behavior as STD (duplicate).
The mode pill shows the current mode (cycle on click: STD → TRZ → SCI → STD).
- Top line: current calculation context.
- Bottom line: live input / result.
- The Log panel is hidden by default.
- Use the LOG pill (left of DEG) to show/hide it.
- The panel appears to the right of the calculator (stacks below on small screens).
- Use Export CSV to download the current log as
calc-log.csv. - Use Clear to remove all log entries (also clears persisted log storage).
- Each log row shows an Action (e.g.
5 + 3 = 8,20 BGN) and the resulting Value. - For chained arithmetic, the log behaves like a paper tape: as you type the right-hand operand, the current step preview updates; pressing the next operator (or
=) commits the step. - The log keeps the last 50 values and restores them on reload.
- Double-click a log item to copy its value to the calculator display.
- Click Help (left of LOG) to open a modal that renders this README (loaded from
/README.md). - Click License in the footer to open the same modal and render
/LICENSEas plain text in a<pre><code>block. - The footer also contains a GitHub link to
https://github.com/icis4/calc. - If you opened
index.htmlviafile://, some browsers will block fetching/README.md; use the local server command above.
+,−,×,÷+/-(toggle sign)- Decimal input (
.) C(clear all)DEL(backspace)
√(square root)x^y(exponent)mod(remainder; uses JavaScript%semantics)n!(factorial for non-negative integers; errors for non-integers/negatives; limited ton ≤ 170)%(percent)π(pi constant)e(Euler’s number constant)EXP(scientific notation entry, e.g.5.6e-4)1/x(reciprocal)|x|(absolute value)- Trigonometry:
sin,cos,tan,cot - HYP toggles hyperbolic trig:
sin/cos/tan/cot→sinh/cosh/tanh/coth- When HYP is on, DEG/RAD does not apply (hyperbolic uses the raw input)
- INV toggles:
sin/cos/tan→sin⁻¹/cos⁻¹/tan⁻¹cot→cot⁻¹- When HYP is ON, INV toggles hyperbolic inverses instead (
sinh⁻¹/cosh⁻¹/tanh⁻¹/coth⁻¹) ln→e^xlog→10^x√→x²x^y→ʸ√x(y-th root)
- Logs:
ln(x)(natural log)log(x)(base-10 log)
- Random tools:
Coin→ random0or1Dice→ random integer1to6Rand→ random number in[0.0, 1.0)
The DEG/RAD pill changes how trig is interpreted:
- Normal trig (
sin/cos/tan): input is treated as degrees or radians. - Inverse trig (
sin⁻¹/cos⁻¹/tan⁻¹): output is returned as degrees or radians. cotfollows the same DEG/RAD rules astan.- When HYP is ON, DEG/RAD does not apply to
sinh/cosh/tanh/coth.
Buttons appear only in STD/TRZ mode:
EUR: converts BGN → EUR using the fixed peg1 EUR = 1.95583 BGNBGN: converts EUR → BGN using the same peg- Results are rounded to 2 decimals.
- In TRZ mode,
EURis labeled asEURᶻand (BGN → EUR) is rounded to 3 decimals.
- In TRZ mode,
Buttons appear only in STD/TRZ mode:
-
+VAT: adds 20% VAT (net → gross):$x \to x \cdot 1.2$ -
-VAT: removes 20% VAT (gross → net):$x \to x / 1.2$ -
+VAT/-VATresults are rounded to 2 decimals. -
00: rounds the current value to 2 decimals- In TRZ mode it is labeled as
00ᶻ: ако третият знак след десетичната запетая е по-голям от нула, вторият знак след десетичната запетая се увеличава с една единица.
- In TRZ mode it is labeled as
-
000: rounds the current value to 3 decimals
- You can type a leading
-to start a negative number (e.g.-5, or5 * -3). - When entering
EXPnotation (e.g.5e),+/-applies to the exponent sign.
The app stores your last used:
- Mode (
calc_modecookie:STD/SCI/TRZ)- Legacy fallback:
calc_sci(1/0)
- Legacy fallback:
- DEG/RAD (
calc_anglecookie) - Log panel visibility (
calc_logcookie) - Log entries (saved in
localStorageascalc_log_entries)
0–9digits.decimal+ - * / ^operatorsEnteror=equalsBackspacedeleteEscclearCtrl/Cmd+Ccopies the current valueCtrl/Cmd+Vpastes a number into the calculator (supports scientific notation like1.0e+10,2e5,-10e-12)
F5→ switch to STDF6→ switch to TRZF7→ switch to SCI
F8→ toggle DEG/RAD
F10→ show/hide LOG panel
F1→ open/close Help
s→√i→sino→cost→tanp→πr→ toggleRAD/DEGe→EXP(enter scientific notation)l→ln(ore^xwhen INV is ON)g→log(or10^xwhen INV is ON)
n/F9→+/-
The calculator includes a simple memory register:
MCclears memoryMRrecalls memory into the displayMSstores the current value into memoryM+adds the current value to memoryM-subtracts the current value from memory
When memory is set, an M indicator appears in the display.
Memory operations are also written to the Log panel (MS/MC/MR/M+/M-).
-
ln(x)andlog(x)requirex > 0; otherwise the calculator showsError. - Division by zero shows
Error. - Some functions have real-number domain limits and will show
Errorwhen violated (e.g.cosh⁻¹(x)requiresx ≥ 1,tanh⁻¹(x)requires$|x| < 1$ ,coth(x)is undefined at0). - While typing an incomplete number (e.g.
-,1e,1e-), operations are ignored until the number is complete. - Very long results are automatically compacted for display (often into a shorter
...e...form) so they fit the screen.
- When available, use the Add button in the top bar to install/add a shortcut.
- Install requires serving the folder via HTTPS or localhost (for example:
python -m http.server).
- The
0key is single-width. - The
=key is single-width.