Post Reply 
JRPN 15C/16C: More faithful rounding simulation
09-03-2024, 05:52 PM
Post: #1
JRPN 15C/16C: More faithful rounding simulation
Hi all,

Perhaps of some interest here, I just released to beta an update to the JRPN 15C/16C simulators that make their rounding behavior more like the original. In a previous release, I implemented floating-point decimal addition and subtraction (instead of using the computer's internal IEEE floating point binary, and converting to decimal). Now I've implemented floating-point decimal multiplication and division, with rounding away from zero (like the real 15C, and unlike IEEE math). The new `DecimalFP` internal class is used everywhere appropriate, which covers a pretty big percentage of the 15C's functions. Only things like the trig functions, ln, sqrt, and stuff like that use binary floating point now (and the trig functions are special-cased in degree and grad modes so that, e.g., cos(90 degrees) gives exactly 0.)


I mostly noticed the different (improved?) rounding behavior on one or two matrix operation regression tests.

Since a lot of lines of code were touched, I'm first publishing this as a "beta," which means a beta release on Android and Linux, and publication to the web version (https://jrpn.jovial.com). The new version is called "1.1.16 beta1" under Help -> About. I'll probably leave it in this beta state for a week or so. If anyone needs a build for a different platform, happy to provide one.

Now the only use of IEEE binary floating point math is for things like
Anyway, if anyone has some tests they'd like to run through this new version, that would be most welcome.

Cheers,

Bill
Visit this user's website Find all posts by this user
Quote this message in a reply
09-04-2024, 07:58 AM
Post: #2
RE: JRPN 15C/16C: More faithful rounding simulation
Hi Bill,
I ran my complex matrix code here with the example on pg. 128 of the 15C Advanced Functions Handbook, works perfectly, and even a bit more accurate than a real 15C. (I believe you work with 12 digits, right?)

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
09-05-2024, 05:49 PM (This post was last modified: 09-05-2024 05:59 PM by Gerson W. Barbosa.)
Post: #3
RE: JRPN 15C/16C: More faithful rounding simulation
Code:

#  Program produced by JRPN 15C.
#  Generated 2024-9-5 14:23 Horário Padrão de Brasília.
#  Program occupies 14 bytes.

   000 {          } 
   001 { 42 21 11 } f LBL A
   002 {    42 25 } f I
   003 {       36 } ENTER
   004 {    43 16 } g ABS
   005 {       10 } /
   006 {       34 } X<=>Y
   007 {       14 } yX
   008 {    42 30 } f Re<=>Im
   009 {    43 32 } g RTN

# End.

22 ENTER 783 ENTER 56 GSB A f Re<=>Im ->

HP-15C:

3.536885643-05

JRPN 15C:

3.536885811-05

This is equivalent to

783 ENTER 785 ÷ g COS⁻¹ 22 × COS

Both the HP-15C and JRPN 15C return the same result in DEG mode, 3.536927182-05. In RAD mode they differ slightly:

HP-15C:

3.536879499-05

JRPN 15C:

3.536879489-05

The exact 10-digit result is 3.536890463e-5.

Best regards,

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)