Showing posts with label hexadecimal. Show all posts
Showing posts with label hexadecimal. Show all posts

Wednesday, August 19, 2026

Spotlight: HP 16C Collector’s Edition

 Spotlight: HP 16C Collector’s Edition



Quick Facts: HP 16C Collector’s Edition



Model: HP 16C Collector’s Edition

Company: Hewlett Packard/Moravia


Type: RPN and Computer Science

Batteries: 2 x CR2032

Memory: Up to 34 memory registers

Programming Memory: Up to 203 memory registers

Years in Production:

Original: 1982-1989

Collector’s Edition: 2026 (limited edition)

Display: 8 digits (scrolling)


Store sites:

Europe: https://www.thecalculatorstore.com/i/the-hp16c

U.S.: https://shop.moravia.education/us/hp-16c-collector-s-edition.html





About the HP 16C


This is my first HP 16C from Hewlett Packard, and it’s a long awaited purchase. The HP 16C is a programmable calculator that is specialized in computer science. There are five main modes:


HEX: Hexadecimal integer mode (base 16, 2^4)

DEC: Decimal integer mode (base 10)

OCT: Octal integer mode (base 8, 2^3)

BIN: Binary integer mode (base 2)

FLOAT: Floating decimal mode.


The FLOAT mode is the only mode where calculations can involved fractions and non-integers. To make room for the Boolean logic and bit functions, the number of functions for floating point are limited to the reciprocal (1/x) and square root (√x).


The other four modes work with integers. The HP 16C is able to work with integers with up word sizes up to 64 bits. Each bit is is a binary bit. For example, a word size of 4 binary integers range from 0000 and 1111. Pressing [ 0 ] [ f ] [ STO ] (WSIZE) is a quick reset to a word size of 64 bits.


Integers can scroll beyond the initial screen of 8 digits, with multiple windows to show all the digits.


We have the classical Boolean functions available: AND, OR, NOT, and XOR. Part of what makes the HP 16C special is addition of bit manipulation functions:


* Shift bits left and right, including the carry over bit: SL, SR


* Arithmetic shift right, where bits are shifted right with the sign bit copied: ASR


* Rotate bits left and right: RL, RR, RL n, RR n (either a single bit or n bits); RLC, RRC, RLC n, RRC n (these are rotation functions including the carry over bit).


* Masks can be generated using the MASKL and MASKR functions.


* Integer division can be accomplished by finding the quotient (÷) and remainder (RMD).


* Finally, the HP 16C can work with double-sized words, potentially after 128 bits, with the double-multiply (DBL×), double-division (DBL÷), and double-remainder (DBLR).



The programming module can hold up to 203 steps, complete with loops, indirect addressing, testing, but no storage or recall arithmetic. Here are a couple of programs:


Integer Division: y |- x


Input Stack:
Y: dividend

X: divisor


Result: quotient, R/S, remainder


Code:


LBL D ; 001 43, 22, d

x<>y ; 002 34

STO 0 ; 003 44, 0

x<>y ; 004 34

÷ ; 005 10

R/S ; 006 31

RCL 0 ; 007 45, 0

LST x ; 008 43, 36

RMD ; 009 42, 9

RTN ; 010 43, 21


Examples


Example 1: 45 d |- 20 d = 2 d remainder 11 d

Keystrokes: DEC 45 ENTER 17 GSB D

Results: 2 d R/S 11 d


Example 2: 1F3 h |- 20 h = F h remainder 13 h

Keystrokes: HEX 1F3 ENTER 20 GSB D

Results: F h R/S 13 h


Hexadecimal: Showing One Hexadecimal Digit at a Time, From Right to Left


This program creates and then manipulates the mask to display each digit.


_ _ _ #

_ _ # 0

_ # 0 0

# 0 0 0


Code:


LBL A ; 001 43, 22, A

STO 0 ; 002 44, 0

CL x ; 003 43, 35

WSIZE ; 004 42, 44

HEX ; 005 23

F ; 006 F

ENTER ; 007 36

1 ; 008 1

+ ; 009 40

WSIZE ; 010 42, 44


RCL 0 ; 011 45, 0

4 ; 012 4

MASK4 ; 013 42, 8

AND ; 014 42, 40

R/S ; 015 31


3 ; 016 3

STO I ; 017 44, 32

LBL 0 ; 018 43, 22, 0

LST x ; 019 43, 36

4 ; 020 4

RL n ; 021 42 E

RCL 0 ; 022 45, 0

x<>y ; 023 34

AND ; 024 42, 20

R/S ; 025 31

DSZ ; 026 43, 23

GTO 0 ; 027 22, 0

RTN ; 028 43, 21


Examples


4F37 h GSB A: 1 R/S 20 R/S 400 R/S 5000


17695 d GSB A: F R/S 10 R/S 500 R/S 4000 (451F h)


The speed of the HP 16C Collector’s Edition is comparable to the HP 15C Collector’s Edition. I found the keys to be responsive and reliable.


Eddie


Sources:


“HP-16C” The Museum of HP Calculators. https://www.hpmuseum.org/hp16.htm Retrieved August 17, 2026.


Hewlett Packard. HP 16c Collector’s Edition: Owner’s Handbook. Edition 2, November 2025. From the HP Calculator Literature website: https://literature.hpcalc.org/items/2714





Eddie


All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Saturday, August 16, 2025

RPN: HP 32S & DM42: Converting Real Numbers to Hexadecimal Approximations

RPN: HP 32S & DM42: Converting Real Numbers to Hexadecimal Approximations



Introduction


We know calculators that have base conversions easily convert integers to different bases. But what about all real numbers? Not so much. Today’s blog will tackle it.


The procedure given today should work for converting from decimal to octal, binary, and hexadecimal. I chose hexadecimal:


0.A B C D… _16

The digit A is in units of 1/16.

The digit B is in units of 1/16^2 or 1/256.

The digit C is in units of 1/16^3 or 1/4096.

The digit D is in units of 1/16^2 or 1/65536.

and so on.


Note: The procedure considers positive real numbers only.


Example: Convert 7.86 to hexadecimal using 4 places


In hexadecimal, 4 places translates to terms of 1/65536.


Separate 7.86 into its integer and fractional parts.

Integer Part: 7

Fractional Part: 0.86

Convert the fractional part to n parts of 65536. (16^4)*

0.86 * 65536 = 56360.96

Round n to the nearest integer. Use the formula: int(n + 0.5) = int(n + 1/2)

Int(56360.96 + 0.5) = 53361

(round(56360.96, 0) = 53361)

Convert both original integer part and the last result to hexadecimal.

Integer Part: 7_10 → 7_16

Frac in terms of 65536: 53361_10 → DC29_16

**If the fractional part has less than four* digits showing in the calculator, pad the converted part with zeros on the left.


The approximate answer reads as:

7.86_10 → 7.DC29_16

Recall in Hexadecimal:

A=10, B=11, C=12, D=13, E=14, F=15.


* precision: number of places.


HP 32S/HP 32SII/DM32 Code


H01 LBL H

H02 ENTER

H03 IP

H04 x<>y

H05 FP

H06 16

H07 4 (** - accuracy level, number of places)

H08 y^x

H09 ×

H10 2

H11 1/x

H12 +

H13 IP

H14 HEX

H15 STOP

H16 DEC

H17 RTN



HP 42S/DM42 Code


01 LBL “→HEX”

02 ENTER

03 IP

04 x<>y

05 FP

06 16

07 4 (** - accuracy level, number of places)

08 Y↑X

09 ×

10 0.5

11 +

12 IP

13 HEXM

14 STOP

15 EXITALL

16 RTN



When the program stops initially, the results are shown as follows:

Y: integer part

X: fractional part – right justified


Remember the number of places (precision) because if the fractional part has less digits, pad zeroes to the left.


Examples


n = precision = 4

Decimal

Y: Hex Integer

X: Hex Fractional (displayed)

Result (base 16)

3.5

3

8000

3.8000

Ï€

3

243F

3.243F

√2

1

6A0A

1.6A0A

0.6732

0

AC57

0.AC57

0.0002

0

D

0.000D

e^4.1

3C

571D

3C.571D

8.2^1.7

23

C460

23.C460



Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


All posts are 100% generated by human effort.  The author does not use AI engines and never will.


Sunday, June 12, 2022

TI-65 Programs

TI-65 Programs


Conversions:  Miles and Kilometers 


TI-65 Conversion:  

F1:  Miles to Kilometers

F2:  Kilometers to Miles


00  2nd 53.53     LBL F1

01  38     ×

02   6     6

03   3     3

04   3     3

05   6     6

06   0     0

07  39     =

08  3rd 25     in-cm

09  28     ÷

10   1     1

11  15     EE

12   5     5

13   39   =

14   -15   INV EE    // remove scientific notation

15   2nd 52    RTN


16   2nd 53.54     LBL F2

17   38     ×

18   1      1

19   15    EE

20   5      5

21   -3rd 25     INV in-cm

22   28     ÷

23   6      6

24   3      3

25   3      3

26   6      6

27   0      0

28   39   ×

29   -15      INV EE

30   2nd 52    RTN


4.9 mi to km:

4.9 [ F1 ]

Result:  7.8857856  km


150 km to mi: 

150 [ F2 ]

Result:  93.20567884 mi


Conversions:  RGB (Red/Green/Blue) Color Code and Hexadecimal Codes


TI-65 Conversions:

F1:  RGB to Hexadecimal

F2:  Hexadecimal to RGB


00   2nd 53.53      LBL F1

01    38     ×

02    1       1

03    6       6

04    18     y^x

05    4       4

06    39     =

07    12.0    STO 0

08    51    R/S

09    38    ×

10    2      2

11    5      5

12    6      6

13    39    =

14    12.59   STO+

15    0      0

16    51    R/S

17    12.59    STO+

18    0       0

19    13.0    RCL 0

20    3rd 13   HEX

21    2nd 52  RTN


22    2nd 53.54   LBL F2

23    12.0   STO 0

24    3rd 12    DEC

25    28      ÷

26    1        1

27    6        6

28    18      y^x

29    4        4

30    39      =

31    2nd 27   INTG

32    51     R/S

33    38     ×

34    1       1

35    6       6

36    18     y^x    

37    4       4

38    39     =

39    12.49  STO-

40    0      0

41    13.0    RCL 0

42    28    ÷

43    2      2

44    5      5

45    6      6

46    39    =

47   2nd 27   INTG

48   51     R/S

49   38     ×

50   2       2

51   5       5

52   6       6

53   39     =

54  12.49   STO-

55   0        0

56   13.0   RCL 0

57   2nd 52  RTN


RGB to HEX:   red  [ F1 ]  green [ R/S ] blue [ R/S ] 

Example:  Red:  108, Blue:  4, Green: 82

108 [ F1 ]  4 [ R/S ] 82 [ R/S ]

Result:  6C0452  (HEX mode)


HEX to RGB:   [ 3rd ] (HEX) hex code [ F2 ]  

Example:  Hex Code: 3401D2

[ 3rd ] (HEX) 3401D2 [ F2 ] 

Result:  52 (red) [ R/S ], 1 (green) [ R/S ], 210 (blue)



Electronics:  Primary Filter and Voltage Gain


F1:  Calculate frequency.  f = 1 ÷ ( 2 * Ï€ * R * C ).   

Syntax:  R [ F1 ] C [ R/S ]

R = resistance in ohms ( Ω )

C = capacitance in farads ( F )

f = frequency in Hertz (Hz)


F2:  Voltage Gain.  G = 20 * log( E_output ÷ E_input ).  

Syntax:  E_output [ F2 ] E_input [ R/S ]

E_output = output voltage ( V )

E_input = input voltage ( V )

G = voltage gain in decibels ( dB )


Source:  Casio fx-61f User's Manual


00  2nd 53.53  LBL F1

01  38    ×

02  51    R/S

03  38    ×

04  2      2

05  38    ×

06  2nd 17  Ï€

07  39    =

08  34    1/x

09 2nd 52  RTN


10  2nd 53.54  10

11  28    ÷

12  51    R/S

13  39    =

14  2nd 32  LOG

15  38   ×

16  2     2

17  0     0

18  39   =

19  2nd 52  RTN



R = 8400 Ω, C = 0.05*10^-6 F

8400 [ F1 ] 0.05E-6 [ R/S ]

Result:  3.789403407E2 Hz


E_output = 54 V, E_input = 28 V

54 [ F2 ] 28 [ R/S ]

Result:  5.70471457 dB


Eddie


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Sunday, May 29, 2022

HP 42S/DM42: Base Programs

 HP 42S/DM42:   Base Programs


Unsigned NOT


The program UNOT applies a NOT to a binary integer (flips zeros to ones and ones to zeros) using unsigned binary integers.  The number of bits (size) is prompted.


HP 42S/DM42 Program UNOT


00  {40-Byte Prgm}

01  LBL "UNOT"

02  BINM

03  "BIN?"

04  PROMPT

05  STO 01

06  EXITALL

07  "SIZE?"

08  PROMPT

09  STO 02

10  2

11  X<>Y

12  Y↑X

13  RCL- 01

14  STO 02

15  1

16  -  

17  BINM

18  END


Examples:


Unsigned NOT of 10100, size 5:  1011  (01011)


Unsigned NOT of 10100, size 8:  11101011


Shift Left


Makes a binary integer shift left: a zero is added to the right side of the integer and "drops" off the left most digit.  The number of bits (size) is prompted.  The binary number is assumed to be non-negative. 


HP 42S/DM42 Program SL16


00  {35-Byte Prgm}

01  LBL "SL16"

02  BINM

03  "BIN?"

04  PROMPT

05  EXITALL

06  2

07  ×

08  "SIZE?"

09  PROMPT

10  2

11  X<>Y

12  Y↑X

13  MOD

14  BINM

15  END


Examples:


Shift Left:  10100, size 5:  1000   (01000)


Shift Left:  10100, size 8:  101000  (00101000)


Shift Right (Logical)


Makes a binary integer shift right: a zero is added to the left side of the integer and "drops" off the left most digit.  The binary number is assumed to be non-negative. A logical shift right divides an integer by 2 and taking the integer result.


HP 42S/DM42 Program SR16


00  {24-Byte Prgm}

01  LBL "SR16"

02  BINM

03  "BIN?"

04  PROMPT

05  EXITALL

06  2

07  ÷

08  IP

09  BINM

10  END


Examples:


Shift Right:  10100:  1010


Shift Right:  1010:  101


The next two programs deals with RGB and HEX codes for computer colors.


HP 42S/DM42 Program CLR→:   RBG to Hexadecimal Code


00  {51-Byte Prgm}

01  LBL "CLR→"

02  DECM

03  "RED?"

04  PROMPT

05  65536

06  BASE×

07  "GREEN?"

08  PROMPT

09  256

10  BASE×

11  BASE+

12  "BLUE?"

13  PROMPT

14  BASE+

15  HEXM

16  END


Example:

Red: 221, Green: 80, Blue 109

Result:  HEX Code:  DD506D


HP 42S/DM42 Program  →CLR:   Hexadecimal to RGB Code


00  {63-Byte Prgm}

01  LBL "→CLR"

02  HEXM

03  "HEX CODE?"

04  PROMPT

05  STO 00

06  DECM

07  65536

08  BASE÷

09  STOP   // Red

10  65536

11  BASE×

12  RCL 00

13  X<>Y

14  BASE-

15  STO 00

16  256

17  BASE÷

18  STOP   // Green

19  256

20  BASE×

21  RCL 00

22  X<>Y

23  BASE-

24  END


Example:  

HEX Code:  103E22

Result:  Red:  16, Green:  62,  Blue:  34


Eddie



All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Thursday, September 6, 2018

Floating Point Base Conversions with Scientific Calculators


Floating Point Base Conversions with Scientific Calculators

Introduction

Any scientific calculator that has base conversions will operate on integers only.  But what if we want to find hexadecimal representation of Ï€?  According to the TI LCD Programming there is a procedure. 

This blog post will focus on conversions between binary (base 2), octal (base 8), hexadecimal (base 16), and decimal (base 10).  This can easily be worked with other bases.

Decimal to Other Bases

Let x = the number to be converted.

Steps:

1. Let n be the number of decimal places x has.  Designate b to the designated base.  Here’s a point:  please be aware of your decimal point.  Being aware of your values is key coming up with the correct conversion. 

2. In Decimal mode, Multiply x * b^(n-1).

3. Convert the result to the destination base. The conversion will be shown as a decimal.  You will need to place the decimal point in the answer yourself. 

Example:  Convert 3.1415 to Binary, Octal, and Hexadecimal. 

x = 3.1415 has 4 decimal places, hence n = 4.

Binary   (b = 2)

In Decimal mode:  3.1415 * 2^(4- 1) = 25.132

Convert to Binary ([2nd/SHIFT] (BIN)), display:  11001

Since 3_10 = 11_2, place the decimal point as such:  11.001

Octal  (b = 8)

In Decimal mode:  3.1415 * 8^(4- 1) = 1608.448

Convert to Octal ([2nd/SHIFT] (OCT)), display:  3110

Since 3_10 = 3_8, place the decimal point as such:  3.110

Hexadecimal (b = 16)

In Decimal mode:  3.1415 *16^(4- 1) = 12867.584

Convert to Octal ([2nd/SHIFT] (HEX)), display:  3243

Since 3_10 = 3_16, place the decimal point as such:  3.243

As a result:  3.1415_10 ≈ 11.001_2 ≈ 3.110_8 ≈ 3.243_16

Other Bases to Decimal

Let x = the number to be converted.

Steps:

1. Let n be the number of decimal places x has.  Designate b to the designated base.  Here’s a point:  please be aware of your decimal point.  Being aware of your values is key coming up with the correct conversion. 

2. In the destination base mode, type the number without the decimal point. 

3. Convert the number to decimal. (Change the number to Decimal mode) 

4. Divide the result by b^n.

Examples

Example 1:  Convert 11.01101_2 to decimal.

1.01101_2 has 5 decimal places, n = 5. Enter in BIN mode:  1101101.  Remember not to include decimal point.

Convert to decimal ([2nd/Shift] (DEC)):  109

To get the final result:  109 / 2^5 = 3.40625

Example 2:  Convert 4.7076_8 to decimal.

4.7076_8 has 4 decimal places, n = 4. Enter in OCT mode:  47076.  Remember not to include decimal point.

Convert to decimal ([2nd/Shift] (DEC)):  20030

To get the final result:  20030 / 8^4 = 4.890136719

Example 3:  Convert  3A.19B1_16 to decimal

3A.19B1_16 has 4 decimal places, n = 4. Enter in HEX mode:  3A19B1.  Remember not to include decimal point.

Convert to decimal ([2nd/Shift] (DEC)):  3807665

To get the final result:  3807665 / 16^4 = 58.10035706

Source:

Texas Instruments TI LCD Programmer User Manual.  Texas Instruments. 1981.

You can find a PDF of the manual from Datamath’s website here:  http://www.datamath.org/Sci/Slanted/LCD-Programmer.htm 

Hopefully you find this helpful.

P.S.  I hope the next update to the TI-84 Plus CE and the Casio fx-CG 50 have adds operating system base conversions and Boolean functions. HP Prime has base conversions.

I have am working on a retro review, working on blog about adjustable rate mortgages, and HHC 2018 is coming up at the end of the month (http://hhuc.us/2018/). 

Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

Symmetric Quartic Equation - Python

Symmetric Quartic Equation - Python Note: The code is programmed with a TI-84 Evo. No modules are used, so the scripts should be adopt...