The Museum of HP Calculators

HP Forum Archive 17

 Difference between Voyager and HP-48GMessage #1 Posted by James Biddlecombe on 22 Feb 2007, 6:50 a.m. Guys, I've recently got back into HP calculators after owning an HP-41 for over 20 years. Since then I've acquired a few off ebay, but have a question concerning a percentage calculation, for example, on the HP-41 and 48G: Example calculation: 100 Enter 15 % + produces and answer of 115 on the HP-41 and Voyager models, but an error on the 48G as the 100 seems to be removed from the stack after the percentage calculation. Can anyone explain why this is different and if there is some kind of 'trick' in performing this on the 48G without entering 100 twice. Thanks, James.

 Re: Difference between Voyager and HP-48GMessage #2 Posted by Giancarlo (Italy) on 22 Feb 2007, 7:11 a.m.,in response to message #1 by James Biddlecombe Hi James. The 42S (Pioneer) operates as you say on the Voyagers. I'd say the different behaviour of the 48G is related to its being an RPL model rather than a "pure" RPN... But I'd expect some deeper suggestions from more knowledgeable forum people :) Just my two cents. Best regards. Giancarlo

 Re: Difference between Voyager and HP-48GMessage #3 Posted by Bram on 22 Feb 2007, 7:30 a.m.,in response to message #1 by James Biddlecombe Quote: (..) as the 100 seems to be removed from the stack after the percentage calculation. True, it does. The 48G %-operator needs (and consumes) two arguments and leaves just one result. Quote: Can anyone explain why this is different Not me, sorry. Quote:and if there is some kind of 'trick' in performing this on the 48G without entering 100 twice. ```100 Enter Enter 15 % + ``` but I bet you have guessed this yourself as well (o well, it does enter the 100 twice, but at least you don't have to type it twice) Edited: 22 Feb 2007, 7:32 a.m.

 Re: Difference between Voyager and HP-48GMessage #4 Posted by Dia C. Tran on 22 Feb 2007, 8:43 a.m.,in response to message #3 by Bram For the older calculators it's for convienient as you already know. For the 48, it's for consitency.

 Re: Difference between Voyager and HP-48GMessage #5 Posted by Les Bell on 22 Feb 2007, 7:13 p.m.,in response to message #1 by James Biddlecombe Quote: Can anyone explain why this is different I'm pretty sure it's down to RPL being designed to be as "pure" and orthogonal as possible. The % operator is designed to consume two levels of the stack and return its result in one, just like all other binary operators. Leaving a copy of an original value behind might be convenient, but it's not mathematically kosher - a function can't return two values. To my mind, the 41C, like all the other RPN calcs, is an arithmetic tool. The 48 and the other RPL calcs are mathematical tools, which is what makes them awkward for those back-of-envelope calculations. Best, --- Les [http://www.lesbell.com.au]

 Re: Difference between Voyager and HP-48GMessage #6 Posted by Cameron Paine on 22 Feb 2007, 7:15 p.m.,in response to message #1 by James Biddlecombe Quote: Can anyone explain why this is different... The behaviour of ENTER WRT stack lift differs between RPN and RPL calculators. On RPN machines, ENTER terminates digit entry and duplicates X into Y. If the very next thing you do is press a digit key, the value in X is overwritten. However if the very next thing you do is invoke a function that consumes the value in X, the stack will drop, leaving your original value in X. The RPL calculators terminate digit entry when ENTER is pressed and copy the content of the input buffer into X (AKA level 1). If the next thing you do is press a digit, the value in the input buffer is overwritten. If however you invoke a function that consumes the level 1 value, the stack will drop leaving whatever was in level 2 in level 1. I believe that the % function consumes the level 1 value on both architectures. HTH Cameron Edit: no sooner had I posted than I realised that % must consume two stack levels. Which renders my explanation irrelevant. What I describe above explains why 100 ENTER sqrt + produces 110 on an 11C and an error on a 48 (if both start with an empty stack). Unfortunately that's not what we were discussing here. Sorry for the noise. Edited: 22 Feb 2007, 7:34 p.m.

 Re: Difference between Voyager and HP-48GMessage #7 Posted by Antonio Maschio (Italy) on 23 Feb 2007, 2:43 a.m.,in response to message #6 by Cameron Paine I guess this means that with RPN the display and register X are the same, and while inputting a number we're affecting both; pressing Enter pushes the number down 1 position to Y (keeping the value in X); as a side effect, we have two copies of the input number. with RPL, the display is not the same as register X, it's kind a level higher so, when we're inputting a number, we are not affecting register X, but only the input buffer; pressing Enter pushes the number again down 1 position to X (clearing the input buffer). Right? -- Antonio Edited: 23 Feb 2007, 2:44 a.m.

 RPL command line entryMessage #8 Posted by James M. Prange (Michigan) on 23 Feb 2007, 9:54 p.m.,in response to message #7 by Antonio Maschio (Italy) Quoting Bill Wickes: Quote: The fundamental definition of the HP 48 operation ENTER is: Take the text in the command line, check it for correct syntax, then treat it as a program and execute the objects defined there. With RPL, when you're typing in source code (for a number, other object, series of objects, whatever), you're inputting it to an "editor" (command line, equation writer, matrix writer, etc.), which could be considered a "buffer"; it has no effect on the stack until an ENTER operation is invoked. In the case of the command line editor in particular, when you press ENTER, ordinarily the source code is parsed and checked for syntax errors, and assuming no errors, all objects from the command line are combined into a compiled "secondary" (SysRPL program) which is placed on the stack and executed, and when finished, the display is updated. In "immediate entry" mode (neither PRG nor ALG displayed in the status area), pressing an immediate entry key effectively appends the key object to the command line and then invokes an "implicit ENTER". In the case of just a data class object such as a number, the effect of pressing ENTER is to put the object (or actually, a pointer to the object in temporary memory) on stack level 1 (moving anything already on the stack up one level), and then update the display. But suppose that you open the command line with RightShift ENTRY (over the ALPHA key) to invoke PRM entry mode, then type in 1 2 +, and then press ENTER. In this case the number 3 is placed on the stack before the display is updated. Or if you type 1 2 into the command line and then press + (which invokes an implicit ENTER), 3 is also placed on the stack. Or if you already have 1 on the stack, then type in 2 and then press +, the 1 is replaced by a 3 before the display is updated. In general, the command line could be considered source code for a program to be executed immediately. Note that when in the standard stack display (no command line or other "special environment" active), pressing the ENTER key doesn't invoke the ENTER operation; it invokes a DUP command instead. For more details, see section 4.3 (pages 83-90) of HP 48 Insights Part I: Principles and Programming HP48G/GX Edition, available on the current MoHPC CD-ROM set / DVD-ROM. Regards,James Edited: 23 Feb 2007, 10:20 p.m.

 As usual, an excellent essayMessage #9 Posted by bill platt on 24 Feb 2007, 10:38 a.m.,in response to message #8 by James M. Prange (Michigan) Thanks, James bill

Go back to the main exhibit hall