ghewgill / hp15c

HP-15C calculator simulator
http://hp15c.com
Other
59 stars 20 forks source link

Label .0 does not work #16

Open yoyoma2 opened 5 years ago

yoyoma2 commented 5 years ago

Tested in the web/javascript version.

Steps: g P/R f LBL .0

Result: The label 0 is created instead of the label .0

If your program uses both labels 0 and .0 it will fail.

Possible Cause: In function decode_lbl(k), the following line: i = Number(k) / f; results in i=0 when k=0 regardless of f being 1 or 10.

Same problem with GTO: The function decode_gto() has the same problem calculating x with x=0 and f=10 x /= f;

Nice simulator BTW!

yoyoma2 commented 4 months ago

Here's a patch that makes this work in the javacript version. In the case of label .0 we store 0.01 to distinguish it from label 0 which already stores 0. I'm sure someone who knows this code and javascript could fix it in a much more elegant way.

labelDotZero.patch

Anyways a program can now use both label 0 and label .0 and it works.