RE: New Version: 2.1.14181 (2018 10 16)
(04-13-2020 12:55 AM)Jacob Wall Wrote: (04-12-2020 09:37 PM)Eric Rechlin Wrote: I looked into this, and the lack of STRING isn't the issue at all. I added the call to STRING as you suggested, and it had no effect. This is only a problem with the "r" variable here; substitute for any other variable that's defined here (like a, b, c, d, etc)
I am not sure why his code doesn't work with current ROM versions, but I think it might be related to the way he wrote this:
Code:
r:=approx(r);
F:=fp(r);
r:=exact(r);
It seems r has somehow become the literal "r" here and not the contents of what was in r.
Unfortunately, my knowledge of HPPL isn't good enough to figure this out. Maybe someone else knows better.
You're correct, it has nothing to do with the lack of STRING, I remember being surprised that it worked, however it was my lack of understanding at the time of object types in PPL.
I looked at this again now, and the issue is the use of IFERR when combined with CAS commands. Take this example:
Code:
EXPORT slk3()
BEGIN
LOCAL a:=0,b:=0,c:=0,d:=0,r:=0;
LOCAL OP3:=0,F:=0,Z22:=0;
PRINT();
INPUT({{a,[0],{10,20,1}},{b,[0],{40,20,1}},{c,[0],{10,20,2}},{d,[0],{40,20,2}}},"Distance Between 2 Points",{"X₁:","Y₁:","X₂:","Y₂:"},{"Enter a Value for X₁ (Any Real Number).","Enter a Value for Y₁ (Any Real Number).","Enter a Value for X₂ (Any Real Number).","Enter a Value for Y₂ (Any Real Number)."});
IF 0 THEN BREAK;
END;
// IFERR 3/0 THEN END;
r:=√((c-a)^2+(d-b)^2);
MSGBOX(r);
r:=approx(r);
MSGBOX(r);
F:=fp(r);
r:=exact(r);
MSGBOX(r);
END;
Run it as is and should show the distance in each of the three MSGBOX instances, then un-comment the line with IFERR which has a divide by zero error on purpose. I think the first time running with that line un-commented will still work, but then something happens and the next run and you'll see just 'r' in the second and third MSGBOX, which follow the CAS commands.
If no errors get triggered by IFERR, then everything should be just fine. My workaround for this was to just write my own PPL commands to substitute for the CAS commands I was using, there was no other solution that I found because the IFERR in my case was to catch a ON key press.
Related topic https://www.hpmuseum.org/forum/thread-10995.html
Why would you override the reserved system variable F?
LOCAL OP3:=0,F:=0,Z22:=0;
- -
VPN
|