Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!es2a+ From: es2a+@andrew.cmu.edu (Eric Stuyvesant) Newsgroups: comp.sys.handhelds Subject: HP 48: Weird IFERR | THEN END behavior Message-ID: Date: 4 Dec 90 17:18:09 GMT Organization: Class of '91, Carnegie Mellon, Pittsburgh, PA Lines: 65 I hate to call this by the b** word, but it at least seems like incorrect documentation: In order to evaluate an expression with certain definite numbers substituted for names that occur in the expression, HP has provided |. Given an expression in level 2 and a list of name-value pairs in level 1, | is supposed to substitute the values for the names in the expression. In order to provide run-time error trapping, HP has provided the IFERR trap-clause THEN error-clause {ELSE normal-clause} END structure. From the HP 48 Programmer's Reference Manual, p. 174 (IFERR): " If an error occurs during execution of the trap clause: 1. The error is ignored. [Non-relevant points] 5. If Last Arguments is enabled [Flag -55 is clear], the arguments to the command that caused the error are returned to the stack. 6. Program execution jumps to the error clause. " [End Quote] Now try: -55 SF Enter @ Last Arguments disabled 'INV(X)' Enter { X 0 } Enter \<< IFERR | THEN END \>> Enter @ | is Alpha-Blue-J EVAL This returns nothing (as advertised). Next, try: -55 CF Enter @ Last Arguments enabled 'INV(X)' Enter { X 0 } Enter \<< IFERR | THEN END \>> Enter @ | is Alpha-Blue-J EVAL This returns 0. This behavior is evident on both a REV-A machine and a REV-D machine. I presume this is happening because the LASTARG command is returning the last argument it has seen, in this case, an argument to some not-user-visible function called by |. Can anyone shed any light on the situation? Thanks in Advance. P.S. Am I the only one who thinks HP should include an ML version of EXCO in their next calculator? P.P.S. Why can't you single-step through IFERR structures? -Eric Stuyvesant es2a+@andrew.cmu.edu Go MEMS!