Post Reply 
(42S) (& 41C): Ceiling (& Floor) Function Programme
02-09-2017, 08:33 PM (This post was last modified: 02-12-2017 08:00 PM by Gerson W. Barbosa.)
Post: #13
RE: HP 42S (& 41C): Ceiling (& Floor) Function Programme
(02-09-2017 09:16 AM)Dieter Wrote:  
(02-07-2017 02:20 AM)Gerson W. Barbosa Wrote:  Not perfect, 42S only:

00 { 17-Byte Prgm}
01 LBL "FLOOR"
02 IP
03 LASTX
04 FP
05 X<0?
06 COSH
07 IP
08 -
09 END

I guess using SIGN and + instead of COSH and – would have been far too trivial ?-)

Dieter

That's what used to work both on my HP-15C and on my HP-32S II. But you're right, SIGN & + are way better than COSH & - on the HP-42S (one byte shorter and HP-41 compatible). Thanks for the improvement!

On the HP-42S we can make it also one step shorter:

00 { 16-Byte Prgm }
01 LBL "FLOOR"
02 IP
03 LASTX
04 FP
05 X<0?
06 SIGN
07 BASE+
08 END

Gerson.

-------------------

[Image: HP_41_CEIL_FLOOR_zpsgppgwn7e.jpg]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 42S (& 41C): Ceiling (& Floor) Function Programme - Gerson W. Barbosa - 02-09-2017 08:33 PM



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