HP Prime Graphing Calculator User Manual

Page 550

Advertising
background image

546

Programming

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(#1111,b15) returns #1111b:15

SETBASE

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

indicated by c, where 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
GETBASE (#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.
These commands start the Matrix and List editors.

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

.

Returns true (not zero) if the user selects an object,
otherwise return false (0).

Advertising