HP Forums
RPNcalc+ free colorful web calculator - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: RPNcalc+ free colorful web calculator (/thread-15844.html)

Pages: 1 2


RE: RPNcalc+ free colorful web calculator - Albert Chan - 11-22-2020 01:40 PM

(11-21-2020 07:53 PM)radulle Wrote:  Implemented decimal math using decimal.js library.

Nice work. But decimal type may need some work.

https://rpncalcplus.web.app/ issues:
  1. "PI 1e15 *" gives error "maximumFractionDigits value is out of range"
  2. LN not working, "100 LN" gives 2, same as "100 LOG"
  3. 10^X not working. "100 10^X" give 10, then "LOG" crashed: "[DecimalError] Invalid argument: 10^x"
  4. Infinity ≠ Infinity. "1E99 X^2" gives Infinity, taken "LOG" gives back 99*2 = 198
  5. "10 E LOGxy STO" (≡ LN(10) ≈ 2.302585092994), then "RCL", calculator freezed.
    (unable to enter new numbers).

The upside is we have *huge* expoenent range. (note: we avoid using the bad 10^X)
"2.302585092994e15 E^X LOG "      → 999,999,999,999,980

Decimal type have 20 digits mantissa, 15 digits exponents.


RE: RPNcalc+ free colorful web calculator - radulle - 11-22-2020 02:46 PM

(11-22-2020 01:40 PM)Albert Chan Wrote:  
(11-21-2020 07:53 PM)radulle Wrote:  Implemented decimal math using decimal.js library.

Nice work. But decimal type may need some work.

https://rpncalcplus.web.app/ issues:
  1. "PI 1e15 *" gives error "maximumFractionDigits value is out of range"
  2. LN not working, "100 LN" gives 2, same as "100 LOG"
  3. 10^X not working. "100 10^X" give 10, then "LOG" crashed: "[DecimalError] Invalid argument: 10^x"
  4. Infinity ≠ Infinity. "1E99 X^2" gives Infinity, taken "LOG" gives back 99*2 = 198
  5. "10 E LOGxy STO" (≡ LN(10) ≈ 2.302585092994), then "RCL", calculator freezed.
    (unable to enter new numbers).

The upside is we have *huge* expoenent range. (note: we avoid using the bad 10^X)
"2.302585092994e15 E^X LOG "      → 999,999,999,999,980

Decimal type have 20 digits mantissa, 15 digits exponents.

Albert Chan & EdS2, thank you very much, I went with a presumption that JS Math's methods worked in the same way as Decimal's which is not the case (e.g. LN vs LOG), I will definitely have to explore this new library more and iron all the issues.

Due to current calculator like design I limited exponent to two digits, do you find use of a very large exponent?


RE: RPNcalc+ free colorful web calculator - radulle - 11-22-2020 04:15 PM

For trigonometric functions that return very small values (e.g. sin(0) and cos(pi/2) give less than 10E-16) would it be correct to return zero?


RE: RPNcalc+ free colorful web calculator - CMarangon - 11-22-2020 04:51 PM

Hello!

You made a nice job.:-)

I belong to the kind of people that have difficulty with RPN.
During my college time I used HP48 for programs, plots, matrixes
and a Casio for numeric expressions.

However, I use RPN to program the HP50/49/48.


A similar thing that happens is that I don't use Linux at home, however
all sites that I made till today, are hosted in Linux servers.

I made a javascript Calculator, take a look,
http://area48.com/calculator.html

I'm a mix of Saru and Linus, from Star Trek Discovery:-)

[Image: linus.jpg]
Saru and Linus




l


RE: RPNcalc+ free colorful web calculator - radulle - 11-22-2020 06:03 PM

(11-22-2020 04:51 PM)CMarangon Wrote:  You made a nice job.:-)
I made a javascript Calculator, take a look,
http://area48.com/calculator.html

Thank you, conversion utils seem very useful and web site as a whole is very rich in information.


RE: RPNcalc+ free colorful web calculator - radulle - 11-22-2020 06:14 PM

(11-22-2020 01:40 PM)Albert Chan Wrote:  https://rpncalcplus.web.app/ issues:
  1. "PI 1e15 *" gives error "maximumFractionDigits value is out of range"
  2. LN not working, "100 LN" gives 2, same as "100 LOG"
  3. 10^X not working. "100 10^X" give 10, then "LOG" crashed: "[DecimalError] Invalid argument: 10^x"
  4. Infinity ≠ Infinity. "1E99 X^2" gives Infinity, taken "LOG" gives back 99*2 = 198
  5. "10 E LOGxy STO" (≡ LN(10) ≈ 2.302585092994), then "RCL", calculator freezed.
    (unable to enter new numbers).

These were great finds, I will be sure to add them to unit tests when I get to them (for this purpose I moved all calculation logic to calc.js).
Issues:
  1. I had an issue with my own number formatting, fixed for now, but I'll explore if I can use decimal.js for this too to justify the bundle size bump.
  2. JS Math.log used base e while Decimal.log used base 10
  3. 10^x was a silly mistake by me where JS was parsing it as a number instead of a command
  4. Infinity issue should be fine now as I reduced decimal.js exponent to +/- 99
  5. Should be fine now



RE: RPNcalc+ free colorful web calculator - EdS2 - 11-23-2020 09:57 AM

(11-22-2020 04:15 PM)radulle Wrote:  For trigonometric functions that return very small values (e.g. sin(0) and cos(pi/2) give less than 10E-16) would it be correct to return zero?

Ideally not, because of the wonderful behaviour of sin(x) near pi:
sin(3.1415) -> 0.00009265358966
sin(3.1415926535) -> 8.97932384626434e-11

About the keyboard shortcuts: I was surprised to see S for sin and s for arcsin. Why this way around? My intuition led me to expect the unshifted key to perform the forward function.


RE: RPNcalc+ free colorful web calculator - radulle - 12-02-2020 11:34 PM

(11-23-2020 09:57 AM)EdS2 Wrote:  About the keyboard shortcuts: I was surprised to see S for sin and s for arcsin. Why this way around? My intuition led me to expect the unshifted key to perform the forward function.

I see your point, but it is because of the shift keyboard shortcut which is used to reveal that set of keys.

In the meantime I upgraded most of the libraries used, tested it and it seems fine, but if you notice anything strange. Decimal.js seems fine for now.


RE: RPNcalc+ free colorful web calculator - Thomas Klemm - 07-24-2022 10:01 AM

(11-04-2020 04:33 PM)radulle Wrote:  I really hope you take some time try it out, enjoy it and give feedback what should be improved or if you notice any bugs.

Nice calculator.
The only thing I noticed is that the over key does a rot instead.


RE: RPNcalc+ free colorful web calculator - radulle - 07-24-2022 11:41 AM

(07-24-2022 10:01 AM)Thomas Klemm Wrote:  
(11-04-2020 04:33 PM)radulle Wrote:  I really hope you take some time try it out, enjoy it and give feedback what should be improved or if you notice any bugs.

Nice calculator.
The only thing I noticed is that the over key does a rot instead.

Thank you, I must have overlooked, will check it out and report when fixed.