(Free42, DM42, HP 42S): Some Base Integer Programs
|
04-18-2022, 04:10 AM
Post: #1
|
|||
|
|||
(Free42, DM42, HP 42S): Some Base Integer 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 Code: 00 {40-Byte Prgm} 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 Code: 00 {35-Byte Prgm} 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 Code: 00 {24-Byte Prgm} 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 Code: 00 {51-Byte Prgm} Example: Red: 221, Green: 80, Blue 109 Result: HEX Code: DD506D HP 42S/DM42 Program →CLR: Hexadecimal to RGB Code Code: 00 {63-Byte Prgm} Example: HEX Code: 103E22 Result: Red: 16, Green: 62, Blue: 34 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(Free42, DM42, HP 42S): Some Base Integer Programs - Eddie W. Shore - 04-18-2022 04:10 AM
|
User(s) browsing this thread: 2 Guest(s)