HP-16C Question



#12

Hi everybody,

Just a question for all those amazingly knowledgeable
HP-programming experts in this Forum. I've recently got
a brand-new HP-16C, manuals and all, and have tried to
program a very simple calculation, for test purposes but
mostly for fun.

The problem is, I know next to nothing about this
particular machine, which has a very different function
set from, say, an HP-11C or 15C, and though what I'm
trying to do seems pretty simple, I can't figure out how
to do it nor can make any sense of reading the manuals.

The question is: I'm trying to perform a pure floating
point calculation (not octal, hexadecimal, binary or
whatever, just plain floating point), but there's a time
when I need just the INTeger part of a floating point
value. In an HP-11C or 15C or almost any other model, I
would simply use the built-in INT function, but either
I'm too dumb to notice, or there seems to be no INT function
on the 16C !

Now, I'm sure there must be some easy way of doing
just that, getting the INTeger part of a floating point
value, and then go on performing more floating point
computations with that value and the rest of the 4-level
floating point stack unaffected.

Can it be done ? How ? I just can't believe
it can't, and I'd rather blame myself for failing to see
the probably ultra-obvious correct procedure.

Any help would be greatly appreciated, many
thanks in advance, and excuse me if my question is
way too silly.


#13

Hi;

you're no dumb at all. There is no INT function available in the 16C's Floating Point repertoire. If you have the Owner's Handbook, get Section 5. All available Floating Point resources are described there.

And now you teased me. I'll work on this subject soon, but I want you to check for this:

- go to Floating Point and store a number (say, 234.4567) in R0 ([STO] 0)
- clear X-register and go back to integer hexadecimal ([HEX])
- recall R0 and inspect its contents

you'll see the two rightmost digits are the exponent of ten, and the leftmost digits are the mantissa. As you are in HEX mode, you see that the numbers are stored in BCD coding, and you should "mask" the n leftmost digits, being n the exponent of ten (in our case, 2), remove the rest of the mantissa and save the so called "INT" representation back to R0. I believe it will need about 10-15 program steps. If you wanna try, tell me. I'll try this weekend.

Success.

#14

Hi;

I read your post again and you mention a bradn-new HP16C; my first question is: where did you get this?

You also mention "manuals" two times in your post. The second question is: which is the other namual than the Owner's Handbook?

Thanks. (any success already?)

#15

Try this (it works for positive floating point numbers in X-register):

EEX; 9; +; LAST X; -

It can also replace RND function if you replace 9 by 9-N, where N is the number of digits after the decimal point you want to preserve.

I have used this a lot on my HP33E when I was in high school (more than 20 years ago).

Nenad


#16

Neat, but there's no EEX on a 16. <g> It really *is* a very different beast.

Best,

--- Les Bell, CISSP
[http://www.lesbell.com.au]


#17

Bzzzt! Earth to Les: Of *course* there's an EEX button on the 16, it's just f-CHS, where you can't see it in a dark office. . . .

Sorry, Nenad - your technique will work just fine.

Best,

--- Les Bell, CISSP
[http://www.lesbell.com.au]

#18

HI, Nenad;

What to say? Simple procedure, brilliant solution.

Cheers.


#19

Thanks to both of you for your imaginative solutions.
Adding a large number will certainly work, though I will
have to take into account the sign of the numbers, as
they can be negative at that stage and if so I would need
to subtract instead of adding.

I was thinking that perhaps there was some way of changing
to some integer mode, do some operation with the number,
then return to floating point with the truncated result,
but could find no way to do it.

As for Luiz's question, I got the machine while visiting
a new acquaintance to whom I told casually I was interested in HP calcs. Much to my astonishment, she then produced the still boxed machine from a drawer where it had been
stored for the last 20 years or so. Everything was unused,
brand-new, even the Owner's Handbook was still shrink-wrapped. Not wishing to open it up, I got a copy of
a book from the "Easy Course ..." series, but couldn't
find any reference to an INT function anywhere. That
particular book is large, heavy, and makes fun reading,
but probably is no substitute for the manual proper.

Again, thanks to both of you, you've been most helpful.


#20

Hi;

If you need to keep your original manual as it is, let me know. I'll scan the original (I have one) and send you the images.

If I have one HP16C Owner's Manual packed, I'd do what is needed to keep it this way.

Cheers. (lucky guy...)

#21

I'm afraid that's RND, not INT.
For INT, do:
.5 - EEX 9 + LASTX -
And even then, it does not always yield the correct answer due to 'unbiased rounding':

1. 'INT' -> 0.
2. 'INT' -> 1.

But I don't have a HP on which to test that. My 42S has unbiased rounding.

Werner Huysegoms


#22

You are right, Werner, thank you. I have to improve it. If you need an INT (not a RND) you may use the following program (17 steps):

*LBLA; ENTER; ENTER; EEX; 9; +; LASTx; -; x>y; 1; 0; ENTER; 1; 0; /(divide); -; RTN

This was tested on HP11C and works for positive numbers. The program contains only the functions available on a HP16C (as seen from it's photo, not a real one:)


Possibly Related Threads...
Thread Author Replies Views Last Post
  Bought a 16C to compensate a little Eelco Rouw 23 2,486 12-07-2013, 01:26 PM
Last Post: Eelco Rouw
  Shiny new 16C! Keith Midson 7 865 10-27-2013, 02:22 AM
Last Post: Keith Midson
  Joys of eBay: HP-32S, HP-32SII, HP-42S, HP-16C, ... Sasu Mattila 7 820 09-23-2013, 04:39 PM
Last Post: Julián Miranda (Spain)
  HP-16C simulator fhub 12 1,169 06-30-2013, 10:14 PM
Last Post: Robert Prosperi
  Program for HP-16c... Leonid 9 947 06-07-2013, 08:51 PM
Last Post: David Hayden
  HP 11C/12C/15C/16C case Philippe Cairic 4 741 11-06-2012, 06:04 PM
Last Post: Matt Agajanian
  Understanding HP-16C integer division Jimi 18 1,661 10-16-2012, 09:13 PM
Last Post: Eddie W. Shore
  Hack a 15C-le into a 16C? David Griffith 20 1,711 12-23-2011, 07:00 AM
Last Post: robert rozee
  has 16C memory increased? designnut 4 557 09-06-2011, 05:32 PM
Last Post: uhmgawa
  wp34S - 16C Compatibility #7 - MASKL, MASKR Jake Schwartz 1 346 06-06-2011, 04:40 AM
Last Post: Paul Dale

Forum Jump: