beautypg.com

HP Prime Graphing Wireless Calculator User Manual

Page 297

background image

Programming in HP PPL

293

B→R

Syntax: B→R(#integerm)
Converts an integer in base m to a decimal integer (base

10). The base marker m can be b (for binary), o (for

octal), or h (for hexadecimal).
Example: B→R(#1101b) returns 13

GETBASE

Syntax: GETBASE(#integer[m])
Returns the base for the specified integer (in whatever is

the current default base): 0 = default, 1 = binary, 2 =

octal, 3 = hexadecimal.
Examples: GETBASE(#1101b) returns #1h (if the

default base is hexadecimal) while GETBASE (#1101)

returns #0h.

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).