A web-based educational simulator of the HP12c Financial Calculator with an interactive step-by-step recording system designed for demonstrating the use of calculator on-screen in a classroom.
The FAQ and step recorder is also useful for students learning calculator operations before using the physical device.

- RPN (Reverse Polish Notation) Logic: Authentic HP12c stack-based calculations
- Complete Financial Functions:
- Time Value of Money (TVM): Calculate n, i, PV, PMT, FV with Newton-Raphson methods
- Cash Flow Analysis: NPV and IRR with multiple cash flows
- Bond Pricing: Calculate bond price and yield to maturity
- Amortization: Principal and interest payment schedules
- Depreciation: Straight-line, SOYD, and declining balance methods
- Advanced Mathematical Functions: Powers, roots, logarithms, exponentials
- Complete Statistical Suite:
- Linear regression with slope and intercept calculations
- Mean (arithmetic and weighted)
- Sample standard deviation
- Y and X estimation from regression line
- Full Σ+ and Σ- data point management
- Date Calculations:
- Date arithmetic (add/subtract days with day-of-week)
- Days between dates (actual and 30/360 bond basis)
- Support for M.DY and D.MY formats
- Memory Registers: 20 storage registers (.0-.9, R0-R9) plus statistical registers
- Step Recording: Every button press is recorded in sequence
- Visual Feedback: Buttons highlight when pressed with smooth animations
- Function Indicators: Shows when f or g functions are active
- Clear Documentation: Each step shows button name, function, and result
- Interactive FAQ: Built-in help system with real calculator examples
- Exact Reproduction: Students can follow the exact same steps on their physical calculator
- Visual Learning: See the calculator layout and button relationships
- Practice Mode: Try calculations without risk of breaking anything
- Export Functionality: Save step sequences for later reference
AmyCalc12c/
├── index.html # Main HTML structure with button overlays
├── styles.css # CSS styling and responsive design
├── calculator.js # Core calculator logic (2400+ lines)
├── help.js # FAQ system (auto-generated from faq-content.md)
├── export-faq.js # Export help.js to Markdown for editing
├── import-faq.js # Import edited Markdown back to help.js
├── faq-content.md # Markdown FAQ source (edit this, not help.js)
├── FUNCTIONS.md # Complete function documentation
├── test-functions.html # Automated test suite (36 tests)
├── Assets/
│ └── AmyCalc_HP12c.png # Calculator background image
└── README.md # This file
- Run Locally: Open
index.htmlin any modern web browser - Or Use Web Server:
python -m http.server 8000 # Navigate to http://localhost:8000 - The calculator initializes showing
0.00- click any button to begin
- Click number buttons (0-9) to enter digits
- Click
.for decimal point - Click
EEXfor scientific notation - Click
CHSto change sign
- Click
ENTERto push number to stack - Operations work on stack automatically
- Example: 2 ENTER 3 + = 5
- Click
fto access orange functions (shown above buttons) - Click
gto access blue functions (shown below buttons) - Indicators show when f or g mode is active
-
Enter values for known variables:
n- Number of periodsi- Interest rate per periodPV- Present ValuePMT- Payment amountFV- Future Value
-
Press the key for unknown variable to calculate
360 n (30 years × 12 months)
6.5 i (6.5% annual rate)
200000 PV ($200,000 loan amount)
PMT (Calculate payment = $1,264.14)
- Automatic Recording: Every button press is logged
- Sequential Numbering: Steps are numbered for easy following
- Real-time Display: See steps appear as you calculate
- Export Function: Save steps to text file
- Teacher demonstrates calculation
- Students follow exact button sequence
- Export steps for homework/reference
- Practice with confidence
STO+ digit: Store display value in registerRCL+ digit: Recall value from register- Example:
5 STO 1stores 5 in register 1
.0through.9: General purposeR0throughR9: General purpose- Special registers for statistics
y^x: Raise y to power x1/x: Reciprocal√x(f + y^x): Square rootLN(f + %T): Natural logarithme^x(f + 1/x): Exponential
Σ+: Add data pointΣ-(f + Σ+): Remove data point- Statistics automatically calculated
- Chrome/Chromium 80+
- Firefox 75+
- Safari 13+
- Edge 80+
- JavaScript enabled
- Modern CSS support
- Local file access (for image loading)
- Live Demonstrations: Project on classroom screen
- Step-by-Step Teaching: Every button press is visible and recorded
- Export Sequences: Save calculation steps for handouts
- Homework Assignments: Students can practice without physical calculator
- Assessment: Verify students understand correct button sequences
- Risk-Free Practice: Learn without fear of damaging equipment
- Visual Learning: See button layout and relationships
- Muscle Memory: Develop familiarity before using physical device
- Self-Paced: Practice anywhere with just a web browser
- Reference Tool: Built-in FAQ with 55+ worked examples
- Start with Basic Arithmetic: Get comfortable with RPN logic
- Practice Stack Operations: Understand ENTER, stack lift, drop
- Learn TVM Functions: Master loan and savings calculations
- Explore Cash Flows: Work with NPV and IRR for investments
- Advanced Topics: Statistics, bonds, depreciation
- Watch instructor demonstration on simulator
- Follow exact button sequence on physical HP-12c
- Export steps from simulator for reference
- Practice independently to build confidence
- Pure JavaScript: No external dependencies
- CSS Grid/Flexbox: Responsive button positioning
- Event-Driven: Real-time user interaction
- Local Storage: Session persistence (optional)
- IEEE 754: Standard floating-point arithmetic
- RPN Stack: Four-register stack (X, Y, Z, T)
- Financial Algorithms: Standard TVM formulas
- Error Handling: Graceful overflow/underflow
Each button is precisely positioned over the calculator image using CSS absolute positioning. The coordinate system ensures perfect alignment across different screen sizes.
- Chrome/Chromium 80+
- Firefox 75+
- Safari 13+
- Edge 80+
- JavaScript enabled
- Modern CSS support (transforms, animations)
- Local file access (for image loading)
- Invalid operation detected (e.g., division by zero)
- Solution: Press
ONto clear and reset
- Check browser console for JavaScript errors
- Verify calculator image has loaded
- Ensure JavaScript is enabled in browser
- Solution: Refresh page (Ctrl+F5 / Cmd+Shift+R)
- Browser may be serving cached version
- Solution: Hard refresh (Ctrl+F5 on Windows, Cmd+Shift+R on Mac)
- Check version numbers in HTML:
styles.css?v=74,help.js?v=76
- Check that steps panel is visible
- Look for console errors
- Solution: Refresh page and retry
- Calculator optimized for 60fps animations
- Uses efficient DOM manipulation
- Auto-scrolls to latest step
- Solution: Close other browser tabs if sluggish
- Click FAQ button to access comprehensive examples
- 10 categories with 55+ worked problems:
- 💰 Time Value of Money - Basics
- 🏦 Loans & Financing
- 📈 Investment Analysis (IRR, NPV, Leased Fee)
- 📑 Bond Valuation
- 💯 Percentage Calculations
- 📊 Statistical Calculations
- 🔢 Mathematical Operations
- 📉 Depreciation Calculations
- 📅 Date Calculations
- 💡 Practice Tips
To update examples:
-
Export current FAQ to Markdown:
node export-faq.js
-
Edit
faq-content.mdin any text editor- Keep category metadata:
[//]: # (Category Key: tvm) - Use backticks (`) around button names in steps
- Follow existing format for consistency
- Keep category metadata:
-
Import changes back:
node import-faq.js
-
Update cache version in
index.html:<script src="help.js?v=77"></script>
Important: All FAQ examples have been verified against HP-12C calculations for mathematical accuracy.
Modern Jest Test Suite:
- 122 comprehensive tests across 8 test files
- All tests passing ✅ (100% pass rate)
- Validates against HP-12C reference values
- Coverage includes unit tests, integration tests, and workflow tests
Test Files:
calculator-core.test.js- Core RPN stack operations (16 tests)calculator.test.js- Financial and mathematical functions (24 tests)calculator-stats.test.js- Statistical functions (15 tests)calculator-lastx.test.js- LastX register behavior (6 tests)calculator-memory-arithmetic.test.js- Memory arithmetic (20 tests)calculator-eex.test.js- Scientific notation entry (20 tests)calculator-conversions.test.js- Conversion functions (21 tests)calculator-integration.test.js- Complete workflows (18 tests)
To run tests:
npm test # Run all tests
npm test calculator-core.test.js # Run specific file
npm test -- --coverage # With coverage reportTest Coverage:
- Financial TVM (n, i, PV, PMT, FV) with monthly/annual rates
- Cash flow analysis (NPV, IRR, f-Σ)
- Statistical functions (regression, mean, std dev, Σ+/Σ-)
- Date arithmetic and day counting
- Bond pricing and yield
- All depreciation methods (SL, SOYD, DB)
- Amortization schedules
- Memory arithmetic (STO+, STO-, STO×, STO÷)
- RCL arithmetic (RCL+, RCL-, RCL×, RCL÷)
- Scientific notation (EEX) with exponent handling
- Conversion functions (polar/rect, HMS/hours, deg/rad)
- Edge cases: division by zero, overflow, underflow
See TESTING_SUMMARY.md for detailed test coverage analysis.
| Feature | Status | Notes |
|---|---|---|
| RPN Stack Operations | ✅ Complete | Four-register stack (X, Y, Z, T) |
| Basic Math | ✅ Complete | +, −, ×, ÷, powers, roots, logs |
| Financial TVM | ✅ Complete | Newton-Raphson solver, END/BEGIN modes |
| Cash Flow (NPV/IRR) | ✅ Complete | Iterative methods for complex flows, f-Σ sum |
| Bond Functions | ✅ Complete | Price and yield to maturity |
| Depreciation | ✅ Complete | SL, SOYD, DB with corrected formulas |
| Amortization | ✅ Complete | Principal/interest schedules |
| Statistics | ✅ Complete | Linear regression, Σ operations |
| Date Functions | ✅ Complete | M.DY/D.MY formats, day counting |
| Memory Registers | ✅ Complete | 20 storage registers with arithmetic |
| Memory Arithmetic | ✅ Complete | STO+/−/×/÷ and RCL+/−/×/÷ |
| Scientific Notation | ✅ Complete | EEX with proper exponent handling |
| Conversion Functions | ✅ Complete | Polar/rect, HMS/hours, deg/rad |
| Test Functions | ✅ Complete | x>0, x<y tests |
| LastX Register | ✅ Complete | Proper preservation across all operations |
| Program Mode | ❌ Not Implemented | PSE, BST, GTO, PRGM placeholders |
Recent Fixes (October 2025):
- Fixed interest rate calculation (NPV=0 solver)
- Corrected depreciation formulas
- Fixed amortization sign conventions
- Verified all FAQ examples for mathematical accuracy (55 problems)
See FUNCTIONS.md for complete documentation with formulas.
Display Settings:
- Press
f+ digit (0-9) to set decimal places - Settings persist in localStorage
Button Positioning:
- Adjust coordinates in CSS (absolute positioning over image)
- Each button precisely aligned with background image
Adding Functions:
- Extend
calculator.jswith new operations - Update button handlers in event listeners
- Add corresponding tests to
test-functions.html
Extension Ideas:
- Keyboard shortcuts for button presses
- Sound effects for tactile feedback
- Custom problem sets for specific courses
- LMS integration for homework tracking
- Calculation history export/import
- Save/restore calculator state
This project is designed for educational use to help students learn HP-12c calculator operations.
Trademark Notice: HP12c is a trademark of HP Inc. This simulator is an independent educational tool and is not affiliated with, endorsed by, or sponsored by HP Inc.
Educational Purpose: This simulator replicates essential HP-12c functions for learning purposes. While comprehensive and mathematically verified, always verify critical financial calculations with the actual HP-12c calculator or professional financial software.
Known Limitations: See KNOWN_LIMITATIONS.md for details on intentional simplifications (e.g., programming features not implemented).
No Warranty: This software is provided "as is" without warranty of any kind. Use for educational purposes only.
For Support: Refer to source code comments for implementation details. All FAQ examples have been verified for mathematical accuracy against HP-12c calculations.