The Museum of HP Calculators

HP Forum Archive 14

[ Return to Index | Top of Index ]

HP-16C limits?
Message #1 Posted by VPN on 9 Apr 2005, 3:33 p.m.

Can anyone code this:
http://www2.hursley.ibm.com/decimal/DPDecimal.html
[VPN]

      
Re: HP-16C limits?
Message #2 Posted by Gunnar Degnbol on 10 Apr 2005, 10:22 a.m.,
in response to message #1 by VPN

I don't think it can be squeezed into an HP-16C. I implemented it in Java, and the classes are about 5 KB in total. You can get my Java code, if you want, but it is just a translation of the NetRexx code.

      
Re: HP-16C limits?
Message #3 Posted by Patrice on 11 Apr 2005, 11:41 a.m.,
in response to message #1 by VPN

This quick and dirty HP16C program must do for the compressor !

001- LBL C STO 0 8 8 8 AND STO 2 RCL 0 XOR 010- 7 7 X<>Y AND LST X + SR STO 1 RCL 2 X=0? 020- GTO 1 0 GSB 0 GSB 0 GSB 0 3 RLn STO 2 X<>I RCL 1 030- 8 + STO 1 GTO I 034- LBL 0 x<>Y 4 RRn X<>Y RRC RTN 041- LBL 1 RCL 1 RTN 044- LBL 3 4 6 RCL 1 OR RTN 050- LBL 7 6 6 RCL 1 OR RTN 056- LBL 2 2 ENTER 4 ENTER 6 GTO 8 063- LBL 4 4 ENTER 7 ENTER 6 GTO 8 070- LBL 6 6 ENTER 7 ENTER 6 GTO 8 077- LBL 5 2 6 ENTER 3 ENTER 6 0 GTO 8 086- LBL 8 RCL 1 XOR RCL 1 X<>Y XOR x<>Y LST X X<>Y RLn OR OR STO 1 099- RTN

Patrice Torchet

            
Allow me? (was: Re: HP-16C limits?)
Message #4 Posted by Vieira, Luiz C. (Brazil) on 11 Apr 2005, 1:50 p.m.,
in response to message #3 by Patrice

Hi, Patrice;

I see you are trying to format your listing. Please, let me know if this is what you want:

001- LBL C  STO 0  8 8 8 AND STO 2  RCL 0  XOR
010- 7 7 X<>Y AND LST X  + SR STO 1  RCL 2 X=0?
020- GTO 1  0 GSB 0  GSB 0  GSB 0  3 RLn STO 2 X<>I RCL 1
030- 8 + STO 1  GTO I
034- LBL 0  x<>Y 4 RRn X<>Y RRC RTN
041- LBL 1  RCL 1 RTN
044- LBL 3  4 6 RCL 1  OR RTN
050- LBL 7  6 6 RCL 1  OR RTN
056- LBL 2  2 ENTER 4 ENTER 6 GTO 8
063- LBL 4  4 ENTER 7 ENTER 6 GTO 8
070- LBL 6  6 ENTER 7 ENTER 6 GTO 8
077- LBL 5  2 6 ENTER 3 ENTER 6 0 GTO 8
086- LBL 8  RCL 1  XOR RCL 1  X<>Y XOR x<>Y LST X  X<>Y RLn OR OR STO 1
099- RTN

To accomplish this, add a [pre] in the begining of the listing, and a [/pre] in the end of it. Like this:

[pre]001- LBL C  STO 0  8 8 8 AND STO 2  RCL 0  XOR
010- 7 7 X<>Y AND LST X  + SR STO 1  RCL 2 X=0?
020- GTO 1  0 GSB 0  GSB 0  GSB 0  3 RLn STO 2 X<>I RCL 1
030- 8 + STO 1  GTO I
034- LBL 0  x<>Y 4 RRn X<>Y RRC RTN
041- LBL 1  RCL 1 RTN
044- LBL 3  4 6 RCL 1  OR RTN
050- LBL 7  6 6 RCL 1  OR RTN
056- LBL 2  2 ENTER 4 ENTER 6 GTO 8
063- LBL 4  4 ENTER 7 ENTER 6 GTO 8
070- LBL 6  6 ENTER 7 ENTER 6 GTO 8
077- LBL 5  2 6 ENTER 3 ENTER 6 0 GTO 8
086- LBL 8  RCL 1  XOR RCL 1  X<>Y XOR x<>Y LST X  X<>Y RLn OR OR STO 1
099- RTN [/pre]
and, of course, congrats. Your suggestion is a very good example of efficient programming with the HP16C.

Cheers.

Luiz (Brazil)

                  
Re: Allow me? (was: Re: HP-16C limits?)
Message #5 Posted by James M. Prange (Michigan) on 11 Apr 2005, 3:00 p.m.,
in response to message #4 by Vieira, Luiz C. (Brazil)

Quote:
To accomplish this, add a [pre] in the begining of the listing, and a [/pre] in the end of it.
And see http://www.hpmuseum.org/artfmt.htm for more neat formatting tricks.

Regards,
James

                        
Re: Allow me? (was: Re: HP-16C limits?)
Message #6 Posted by Patrice on 11 Apr 2005, 3:58 p.m.,
in response to message #5 by James M. Prange (Michigan)

Thanks, I will read it.

                  
Re: Allow me? (was: Re: HP-16C limits?)
Message #7 Posted by Patrice on 11 Apr 2005, 3:37 p.m.,
in response to message #4 by Vieira, Luiz C. (Brazil)

Thanks for the tip, I'am not used to poste often on this forum.

> Your suggestion is a very good example of efficient >programming with the HP16C. Yes but I think we can do better, as I said, it is quick and dirty.

Patrice Torchet

            
Re: HP-16C limits?
Message #8 Posted by Gunnar Degnbol on 11 Apr 2005, 4:07 p.m.,
in response to message #3 by Patrice

I think this is the IEEE 754 binary floating point format. The question was about the upcoming IEEE 754R decimal format. It is a kind of Huffman compressed BCD, with some bits carrying information on both the exponent and the coefficient (mantissa). This gives 16 digits of precision, with an exponent from -383 to 384.

This format is designed to be hardware-friendly, so a decimal FPU can easily split it into BCD digits. The IEEE 754R guys think that decimal arithmetic will take over from binary.

As I said, it is 5 KB of Java classes, and though RPN may be more compact, there is no way to squeeze it into an HP 16C.

      
Re: HP-16C limits?
Message #9 Posted by Patrice on 11 Apr 2005, 11:45 a.m.,
in response to message #1 by VPN

This quick and dirty HP16C program must do for the compressor !

001- LBL C STO 0 8 8 8 AND STO 2 RCL 0 XOR 010- 7 7 X<>Y AND LST X + SR STO 1 RCL 2 X=0? 020- GTO 1 0 GSB 0 GSB 0 GSB 0 3 RLn STO 2 X<>I RCL 1 030- 8 + STO 1 GTO I 034- LBL 0 x<>Y 4 RRn X<>Y RRC RTN 041- LBL 1 RCL 1 RTN 044- LBL 3 4 6 RCL 1 OR RTN 050- LBL 7 6 6 RCL 1 OR RTN 056- LBL 2 2 ENTER 4 ENTER 6 GTO 8 063- LBL 4 4 ENTER 7 ENTER 6 GTO 8 070- LBL 6 6 ENTER 7 ENTER 6 GTO 8 077- LBL 5 2 6 ENTER 3 ENTER 6 0 GTO 8 086- LBL 8 RCL 1 XOR RCL 1 X<>Y XOR x<>Y LST X X<>Y RLn OR OR STO 1 099- RTN

Patrice Torchet

            
Re: HP-16C limits?
Message #10 Posted by patrice on 11 Apr 2005, 12:06 p.m.,
in response to message #9 by Patrice

For a better formatting, go to new line at every step number.

001- 010- 020- 030- 034- 041- 044- 050- 056- 063- 070- 077- 086- 099-


[ Return to Index | Top of Index ]

Go back to the main exhibit hall