beautypg.com

HP Prime Graphing Calculator User Manual

Page 555

background image

Programming in HP PPL

549

GETBITS

Syntax: GETBITS(#integer)
Returns the number of bits used by integer, expressed in

the default base.
Example: GETBITS(#22122) returns #20h or 32

R→B

Syntax: R→B(integer)
Converts a decimal integer (base 10) to an integer in the

default base.
Example: R→B(13) returns #1101b (if the default base is

binary) or #Dh (if the default base is hexadecimal).

SETBITS

Syntax: SETBITS(#integer[m] [,bits])
Sets the number of bits to represent integer. Valid values

are in the range –64 to 65. If m or bits is omitted, the

default value is used.
Example: SETBITS(#1111b, 15) returns #1111:b15

SETBASE

Syntax: SETBASE(#integer[m][c])
Displays integer expressed in base m in whatever base is

indicated by c, where c can be 1 (for binary), 2 (for

octal), or 3 (for hexadecimal). Parameter m can be b (for

binary), d (for decimal), o (for octal), or h (for

hexadecimal). If m is omitted, the input is assumed to be

in the default base. Likewise, if c is omitted, the output is

displayed in the default base.
Examples: SETBASE (#34o,1) returns #11100b while
SETBASE (#1101) returns #0h ((if the default base is

hexadecimal).

I/O

I/O commands are used for inputting data into a
program, and for outputting data from a program. They
allow users to interact with programs.

CHOOSE

Syntax: CHOOSE(var, "title", "item1",

"item2",…,"itemn")
Displays a choose box with the title and containing the
choose items. If the user selects an object, the variable
whose name is provided will be updated to contain the
number of the selected object (an integer, 1, 2, 3, …) or
0 if the user taps

.