HP-11C FRAC & INT
04-01-2024, 10:02 AM (This post was last modified: 04-01-2024 12:46 PM by Gamo.)
Post: #1
 Gamo Senior Member Posts: 736 Joined: Dec 2016
HP-11C FRAC & INT
The HP-55 doesn't have FRAC and INT functions and I'm happen to see some
program example from HP-55 User's Manual that program the fractional and
integer part routine in program.

So I just try this out on the HP-11C to see how it work with this program
it will only work on "Positive Integer"

Procedure:

LBL A for FRAC
LBL B for INT

Program:
Quote:LBL A
ENTER ENTER GSB1 1 - - 1 X≤Y GTO 0 R↓ RTN

LBL B
LBL 1 EEX 9 + LSTx - RTN LBL 0 - RTN

Example: FIX 9

¶ display 3.141592654 [A] display 0.141592654

7 e^x display 1096.633158 [B] display 1097.000000

To find the remainder of the division of 18811 ÷ 133

18811 [ENTER] 133 [÷] display 141.4360902

While result on display press [A] display 0.436090200

While result on display press 133 [x] display 57.9999660

While result on display press [B] display answer 58

The remainder is 58

Gamo 4/2024
04-01-2024, 02:04 PM
Post: #2
 Thomas Klemm Senior Member Posts: 2,066 Joined: Dec 2013
RE: HP-11C FRAC & INT
(04-01-2024 10:02 AM)Gamo Wrote:  7 e^x display 1096.633158 [​B] display 1097.000000

That is rounding it to the next integer.

If you really want to implement INT you can use:
Code:
   001 { 42 21 11 } f LBL A    002 {       36 } ENTER    003 {    32 12 } GSB B    004 {       30 } -    005 {    43 32 } g RTN    006 { 42 21 12 } f LBL B    007 {       48 } .    008 {        5 } 5    009 {    42 20 } f x>y    010 {    43 35 } g CLx    011 {       30 } -    012 {       26 } EEX    013 {        9 } 9    014 {       40 } +    015 {    43 36 } g LSTx    016 {       30 } -

Example

7 ex
GSB B

1,096.000000

Caveat: This doesn't work for numbers bigger than 9,999,999,990.
On the other hand, these are already integers.
 « Next Oldest | Next Newest »

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