Post Reply 
Example Program to calculate Factorial
02-03-2018, 03:43 AM (This post was last modified: 02-03-2018 03:45 AM by Gerson W. Barbosa.)
Post: #34
RE: Example Program to calculate Factorial
(02-03-2018 01:29 AM)Gamo Wrote:  I don't know why HP didn't put Factorial function for HP 25 since this model have very limited program steps and if your program need factorial that will take up more steps in the process.

Why not just put n! instead of x^2

Precisely because of the very limited number of program steps in the HP-25, as you’ve noticed. The latter is a more frequently used function than the former. Thus, even if the ROM weren’t full, the designers would probably have chosen x^2 instead of n!. If you have only 49 or 50 steps, then [ ENTER ] [ * ] instead of simply [ x^2 ] will make a difference, depending on how many times you have to use that in a program.

On the other hand, most of the times we won’t need a full implementation of the factorial function. If you are sure no argument will be zero, then you don’t have to worry about that special case, and save one step or two. I remember once I needed factorial in a 33C program, but I had only five steps left. Luckily enough, the possible arguments lay in the 0 through 4 range, then I could use the following:

x^2
5
/
e^x
INT
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Example Program to calculate Factorial - Gerson W. Barbosa - 02-03-2018 03:43 AM



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