


     HHHHPPPP((((1111))))			 XXXXEEEENNNNIIIIXXXX 3333....0000			 HHHHPPPP((((1111))))



     NNNNAAAAMMMMEEEE
	  hp - Reverse Polish Notation calculator

     SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
	  hhhhpppp [ _e_x_p_r_e_s_s_i_o_n _e_l_e_m_e_n_t_s ]

     DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
	  _H_p is	a desk calculator program using	the Reverse Polish
	  Notation familiar to all stack machine aficionados and users
	  of Hewlett-Packard calculators.  It accepts expressions
	  composed of operands and operators from either its argument
	  list or standard input and evaluates them.

	  If the expressions to	be evaluated are given on the command
	  line,	_h_p prints the resulting	value automatically;
	  otherwise, the user must request printing with the "p" or
	  "P" commands.

	  An acceptable	expression consists of a sequence of
	  "constants" and "commands." Constants	are numeric constants
	  written in the style of FORTRAN, and are stored internally
	  as double precision floating-point values.  Commands are
	  single characters that request an arithmetic,	stack control,
	  or control flow operation.  The following commands are
	  currently implemented:

	  pppp    print the value on the top of the stack.

	  PPPP    print all the values currently on the stack.

	  dddd    delete the top value on the stack (throw	it away).

	  DDDD    empty the stack completely (throw all stacked data
	       away).

	  ++++    add top two items on the	stack, place sum on the	stack.

	  ----    subtract	top of stack from next to top, place
	       difference on the stack.

	  **** or xxxx or XXXX
	       multiply	top two	items on the stack, place product on
	       the stack.  Since "*" is	usually	expanded by the	shell,
	       _h_p allows "x" or	"X" as synonyms	for "*".  (The idea is
	       that "x"	is hopefully reminiscent of the	grade-school
	       notation	used for multiplication.)

	  ////    divide next to top of stack by top of stack, place
	       quotient	on the stack.

	  %%%%    divide next to top of stack by top of stack, place
	       remainder on the	stack.



     Page 1					     (printed 8/16/94)






     HHHHPPPP((((1111))))			 XXXXEEEENNNNIIIIXXXX 3333....0000			 HHHHPPPP((((1111))))



	  ^^^^ or ::::
	       evaluate	(next to top of	stack) to the (top of stack)
	       power, place result on the stack.  The ":", while not
	       very mnemonic, is not special to	the Bourne shell
	       (_s_h(1)),	and so can be used on the command line.

	  <<<<    if next to top of stack is less than top	of stack,
	       place a 1 on the	stack; otherwise, place	a 0 on the
	       stack.

	  ====    if next to top of stack equals top of stack, place a 1
	       on the stack; otherwise,	place a	0 on the stack.

	  >>>>    if next to top of stack is greater than top of stack,
	       place a 1 on the	stack; otherwise, place	a 0 on the
	       stack.

	  &&&&    if next to top of stack is nonzero and top of stack is
	       nonzero,	place a	1 on the stack;	otherwise, place a 0
	       on the stack.

	  ||||    if next to top of stack is nonzero or top of stack is
	       nonzero,	place a	1 on the stack;	otherwise, place a 0
	       on the stack.

	  !!!!    if top of stack is nonzero, replace it with a 0;	if it
	       is zero,	replace	it with	a 1 (logical negation).

	  qqqq or QQQQ
	       exit.  _H_p will also exit	when it	sees an	end-of-file
	       (usually	control-D).

     EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
	  hp 32.75 4.5 '*'
	  hp
	  1 2 3	4 5 6 7P++++++pd
	  3.1416 2.7183^ 2.7183	3.1416^>p

     SSSSEEEEEEEE AAAALLLLSSSSOOOO
	  _e_v_a_l(1), _l_e_x(1), _y_a_c_c(1)

     DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
	  stack	overflow
	       if an attempt is	made to	push too many items on the
	       stack.  The stack size is currently limited to about
	       100.

	  stack	underflow
	       if an attempt is	made to	perform	an operation with
	       insufficient operands on	the stack.

	  <char>: unrecognized command



     Page 2					     (printed 8/16/94)






     HHHHPPPP((((1111))))			 XXXXEEEENNNNIIIIXXXX 3333....0000			 HHHHPPPP((((1111))))



	       if a character not corresponding	to any command appears
	       in an expression.





















































     Page 3					     (printed 8/16/94)



