Selecting a base mode in a program, Numbers entered in program lines – HP 35s Scientific Calculator User Manual

Page 207

Advertising
background image

Simple Programming

13-25

This allows you to write programs that accept numbers in any of the four bases, do
arithmetic in any base, and display results in any base.

When writing programs that use numbers in a base other than 10, set the base
mode both as the current setting for the calculator and in the program (as an
instruction).

Selecting a Base Mode in a Program

Insert a BIN, OCT, or HEX instruction into the beginning of the program. You should
usually include a DEC instruction at the end of the program so that the calculator's
setting will revert to Decimal mode when the program is done.

An instruction in a program to change the base mode will determine how input is
interpreted and how output looks during and after program execution, but it does
not affect the program lines as you enter them.

Numbers Entered in Program Lines

Before starting program entry, set the base mode. The current setting for the base
mode determines the result of program.

An annunciator tells you which base is the current setting. Compare the program
lines below in the decimal and non-decimal mode. All decimal and non-decimal
numbers are left–justified in the calculator's display.

Decimal mode set:

Binary mode set:

:
:

:
:

PRGM

PRGM BIN













Decimal number
can omit the sign
“d”





Binary number
should add the
base sign ”b”

:
:

:
:

Advertising