New HP-15C simulator


I've put together a new HP-15C simulator at It does almost everything, with some minor exceptions as noted on the About page. I'm continuing to work on it to implement the missing bits, so expect updates.

Please try it out - feedback, bug reports, and even contributions are welcome!



I checked the SOLVE feature with my usual test function, and your simulator came through with flying colors.

I want to salute your valiant effort to create an HP-15C simulator for browsers. Not an easy job, especially if you are using Javascript (are you?).


Edited: 22 June 2010, 8:59 a.m.


Thanks! It is indeed written in Javascript (which is a pretty capable language, all things considered). The "Source" link on the site links to the source repository if you want to have a look.


SIN(PI = 3.14159265359) = 1.224646799e-16

SIN(3.14159265) = 3.589793029e-09

SIN(0.01) = 9.999833334e-03

SIN(PI-0.01) = 9.999833334e-03

TAN(355/226) = -7.497258179e+06

Very accurate trig. BTW, CHS doesn't work in EEX.


If unimplemented functions is used in looping program, for example, Solver and Integration, the simulator keeps showing error messages. I think this is a small problem.

Edited: 22 June 2010, 10:49 a.m.


The trig functions come straight out of the Javascript "Math.*" library, so I can't claim any credit for their accuracy. :)

I'll add the CHS in EEX bug to the known issues list.


some missing complex trigs.

also, try adding 0.1 ten times, then press H.MS to get 0.5960 opps!

large factorials go bad, also in FIX 9, you dont get the exponent.

otherwise neat!

keep up the good work.


Thanks! The missing complex trig functions are noted on the known issues list. I'll have a look at that ->H.MS rounding problem.

I suspect the large factorials are due to some display rounding problems, especially with numbers slightly less than 1e100. Which number did you notice specifically?


try FIX 9. then 69!


Thanks, should be fixed now.


Try 48.0 minus 47.8 then subtract 0.2 from the answer, the result should be zero - but it isn't so I know you are doing binary math.

Mike T.


Yes, that's true. I don't claim to be doing BCD math, that would be a substantial amount more work (but still possible). The simulator uses the native Javascript math library (as implemented in your browser) for all arithmetic.


is there a JS "decimal" type, or is that java only?

alternatively, you could pull a trick to "fix" these sorts of problems when working in binary as follows:

a + b = a <+> b  if |a <+> b| >= eps*|a|
= 0 otherwise

where <+> represents computed addition rather than mathematical addition and eps is epsilon eg 10^-15

use the same idea for subtraction.

some real world calculators actually work in binary and they must do a trick like this, because i've tried to embarrass them with a binary rounding error and not been successful.


Very nice!!! It even works using the browser on my Android phone.


I tried it on my iPad. Works too. However "test" reported errors:

Unimplemented: complex log

Fail: 45g)

Update: Test also failed on Firefox, fail: 3^.

Test now working on iPad. I just turned it sideways, reloaded the page so I could see the registers and test passed after 1 min 45 sec.

Hmmmm.... Just tested on iPad again, this time the orientation is the same as my failed test and it passed.

Hmmmm..... 4th try. I cannot get it to fail again on the iPad. BTW, no need for 'h' on the iPad, fingers work great. :-)

Update 2: Firefox fails repeatably (fail: 3^). iPad works every time now. Unsure what the original issue was.

Feature requests:

Sound (click), some type of visual button press notification.

Excellent work. Thanks!

Update 3:

I tested with Safari 5.0. Also failed like Firefox 3.6.3 with "fail: 3^". If I press test again I get the error above (complex log). BTW Safari screams compared to Firefox.

Chrome is also a screamer and passes, but a retest generates the "complex log" error.

I speculate the "complex log" error is erroneous.

Update 4:

Just got the "fail 3^" with Chrome. I cannot get Chrome to pass again without restarting Chrome. After that I got 3 passes and then non-stop fail 3^.

Edited: 22 June 2010, 6:30 p.m.


Wow, thanks for all the testing! I suspect many of those failures were due to the test function not resetting some critical flags (like the Complex flag) before running the test. Since the test ends with C set, this was sort of a problem. I've updated the script so the Test runs twice on my system, and would be interested to see whether that fixes the issues you saw.


Complex Log issue fixed, however:

Firefox 3.6.3, Safari 5.0 (OS/X 10.6.4):

The page at says:
fail: 3^
result: 352.00000000000006
expected: 352
diff: 2.220446049250313e-16

Chrome 5.0.375.70 (OS/X 10.6.4). Passed 3 times, then I closed the pop-up, clicked on the image again to get a new session and then test failed with:

The page at says:
fail: 3^
result: 352.00000000000006
expected: 352
diff: 2.220446049250313e-16
2.220446049250313e-16 is a familiar number with 64-bit floats. The "diff:" is the relative machine precision (i.e., the smallest number + 1 > 1), e.g.:
perl -e '$eps=1;while($eps+1>1){$eps/=2.0}$eps*=2;print"$eps\n"'
#include <stdio.h>
int main(void)
double eps = 1.0;
    while(eps + 1.0 > 1.0)
eps /= 2.0;
eps *= 2.0;
printf("Epsilon is %.14e\n", eps);
Rounding issues?

Why this works then fails on Chrome is odd. It should be consistent one way or another. Are all variables/arrays initialized? Does that question make sense for JavaScript?

Edited: 23 June 2010, 8:50 a.m.


The nondeterministic behaviour is indeed odd. I haven't seen that on any of the browsers I've tried, but I'll investigate.


And on my Nokia 5800!! Just fits in on Full Screen mode.


Good work!

Just pressing EEX without any preceding digit will not execute properly. You may even end with one stack level in a different format, i.e. displaying less decimals.


Indeed, that does look like it's doing the wrong thing. Will fix!


Nice simulator. Through trial and error I found that values can be as large as 1x10^308. Though only the last two digits are displayed in the exponent, all three are actually still there because if you Log the value you get 308.

This means for large factorials (or for any large number) the integer part of the log of the answer is the correct exponent. For factorials I believe you can go up to 170! which shows

7.2574     06

But logging the number shows the exponent is actualyl 306. Possibly an improvement over an actual 15C, as long as you are aware of this when dealing with large numbers (like e^500).


Edited: 23 June 2010, 1:58 p.m.


Good catch - that's one of the situations I alluded to in the fine print, where "the numeric display is known to be totally wrong". :)

Behind the scenes, the calculator simulator uses the native Javascript Math library as implemented in your browser, which has the IEEE 754 double precision exponent range of approximately -308 to 308. I plan to detect such out of bounds display (beyond -99 to 99) and blink the result as a real 15C would do, rather than attempt to improve upon it.


Very cool - looks great and the buttons move too.

Mike T.


Please don't take me as a troll, because I'm honestly curious (plus a huge fan of the 15c).

Ignoring (a) the joy of creating such an application, and (b) the joy of dinking around with such an application, does anyone find that web-based calculator sims like this have practical application?

Loading it on a webphone sounds semi-practical ... but not nearly as practical as a native RPN calculator app. IMHO, most of these web apps are missing the features that make them truly useful, e.g., copying/pasting the results from the calculator into another app.

If I'm missing something, please enlighten me!

Edited: 23 June 2010, 4:53 p.m.


I think the idea of calculator simulators does not necessarily lean toward the "useful" side. Although some enthusiasts (like me and others that are probably found here) will use a simulator as their desktop calculator for nostalgic reasons (or even to provoke questions from curious bystanders), I don't think they are intended to be general purpose replacements for a fully functional calculator program or service.

For the 15C specifically, all of the "advanced" functions offered (complex, matrix, integration, solver) are provided in a much more usable, useful, and practical way by other services such as Wolfram Alpha. Surely you're aware of how tedious it is to actually enter matrix data into a 15C, for example.

Having said that, creating a web app does not preclude also creating a desktop app. A web user interface is an easy, quick, and widely accessible way of getting code out there that people can run instantly. The code is written in JavaScript, which is one of the most portable languages around today. I wouldn't rule out creating a corresponding application for desktop or mobile use. In fact, since it's open source, I would even encourage that!

I hope you enjoy the calculator simulators. That's what it's all about.


Thanks for your thoughts. Simulators like this definitely put a smile on my face (I especially like the web-based slide rule simulators), but I wasn't sure if there was something more to it than the fun/novelty.

I also use a 15c simulator (application) as a calculator in Mac OS X, but it has the added advantage of being able to give/receive data via copy/paste, which I use routinely. (IIRC, it will also save/load programs to disk, although I've never used that feature since, as I'm already using a computer, it's typically easier to write the code I need in something else.)

Edited: 24 June 2010, 1:41 p.m.


Nice job!

The PSE function needs some attention - looks like it puts the X register up on the display, but doesn't really pause to show it.



Good catch, I had that disabled for the self-test. I'll find a better way to handle that within the test, and enable PSE for interactive use.


Thanks for the contribution. What do you think, how difficult would it be to port Eric Smith's Nonpareil to JavaScript instead?

Best regards


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-70 simulator updated Willy R. Kunz 3 1,160 11-26-2013, 08:20 PM
Last Post: BShoring
  where can I get the HP Prime simulator? John Ioannidis 4 1,352 09-27-2013, 12:28 PM
Last Post: John Ioannidis
  OT: EDSAC simulator Mike (Stgt) 2 1,054 08-20-2013, 07:27 AM
Last Post: Mike (Stgt)
  Yet another simulator Mike T. 3 1,222 08-05-2013, 07:10 AM
Last Post: Namir
  HP-16C simulator fhub 12 2,644 06-30-2013, 10:14 PM
Last Post: Robert Prosperi
  HP-15C Simulator / Release 3.2.00, Build 5319 Torsten 10 2,072 05-11-2013, 05:19 PM
Last Post: Thomas Klemm
  Christmas tree simulator on HP39gII Mic 0 730 12-08-2012, 07:19 AM
Last Post: Mic
  A Simulator for a Stack Machine Thomas Klemm 0 688 10-19-2011, 03:02 PM
Last Post: Thomas Klemm
  Photo of my HP 15c | 15c LE DigiGal 2 1,131 10-12-2011, 12:34 PM
Last Post: DigiGal
  HP 15c LE vs HP-15C dimensions - BOTH ARE HUGE! Joerg Woerner 4 1,477 10-03-2011, 06:53 AM
Last Post: Jim Johnson

Forum Jump: