Post Reply 
Programming the INT and FRAC functions
01-04-2016, 06:58 AM (This post was last modified: 01-04-2016 07:11 AM by Dieter.)
Post: #7
RE: Programming the INT and FRAC functions
(01-04-2016 12:07 AM)Didier Lachieze Wrote:  On the HP-55, for INT you can do :
Code:
g H.MS g H.MS EEX 9 + f LastX -
And for FRAC :
Code:
ENTER g H.MS g H.MS EEX 9 + f LastX - -

Fine. Omit the two H.MS commands and you get a RND 0 function. ;-)

(01-04-2016 12:07 AM)Didier Lachieze Wrote:  This works for positive numbers but not for negative ones

Change the E9 into 2E9 and it works for negative numbers as well.

(01-04-2016 12:07 AM)Didier Lachieze Wrote:  and I'm not sure it fits your definition of "short and effective"...

I think it won't get much shorter, so yes, it fits.
Thank you for your contribution.

BTW, I sometimes use a similar technique for rounding numbers to a certain number of digits without having to change the display settings. Just take a lower constant like 2E+8, 2E+7, ... etc.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming the INT and FRAC functions - Dieter - 01-04-2016 06:58 AM



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