beautypg.com

HP Prime Graphing Calculator User Manual

Page 549

background image

Programming

545

Examples:

BITSL(28,2) returns 112

BITSL(5) returns 10.

BITSR

Syntax: BITRL(int1 [,int2])
Bitwise Shift Right. Takes one or two integers as input and

returns the result of shifting the bits in the first integer to the

right by the number places indicated by the second

integer. If there is no second integer, the bits are shifted to

the right by one place.
Examples:

BITSR(112,2) returns 28

BITSR(10) returns 5.

BITXOR

Syntax: BITXOR(int1, int2, … intn)
Returns the bitwise logical exclusive OR of the specified

integers.
Example: BITAND(9,26) returns 19.

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 (if the

default base is hexadecimal)