Comparing or manipulating bits, Boolean operations – Texas Instruments PLUS TI-89 User Manual

Page 364

Advertising
background image

Chapter 20: Number Bases 347

20NUMBAS.DOC TI-89/TI-92 Plus: Number Bases (English) Susan Gullord Revised: 02/23/01 1:17 PM Printed: 02/23/01 2:19 PM Page 347 of 6

Operator with syntax

Description

not

integer

Returns the one’s complement, where
each bit is flipped.

· integer

Returns the two’s complement, which is
the one’s complement + 1.

integer1

and

integer2

In a bit-by-bit

and

comparison, the result

is 1 if both bits are 1; otherwise, the result
is 0. The returned value represents the bit
results.

integer1

or

integer2

In a bit-by-bit

or

comparison, the result is

1 if either bit is 1; the result is 0 only if
both bits are 0. The returned value
represents the bit results.

integer1

xor

integer2

In a bit-by-bit

xor

comparison, the result

is 1 if either bit (but not both) is 1; the
result is 0 if both bits are 0 or both bits
are 1. The returned value represents the
bit results.

Suppose you enter:

0h7AC36

and

0h3D5F

Internally, the hexadecimal
integers are converted to a
signed, 32-bit binary number.

Then corresponding bits are
compared.

If Base mode = HEX:

If Base mode = BIN:

0h7AC36 = 0b00000000000001111010110000110110

and

and

0h3D5F

= 0b00000000000000000011110101011111

0b00000000000000000010110000010110 = 0h2C16

The result is displayed according to the

Base

mode.

Comparing or Manipulating Bits

The following operators and functions let you compare or
manipulate bits in a binary number. You can enter an integer in
any number base. Your entries are converted to binary
automatically for the bitwise operation, and results are
displayed according to the Base mode.

Boolean Operations

Note: You can select these
operators from the
MATH

/Base

menu. For an

example using each
operator, refer to
Appendix A in this book.

Note: If you enter an integer
that is too large to be stored
in a signed, 32-bit binary
form, a symmetric modulo
operation brings the value
into the range (page 346).

Leading zeros are not shown
in the result.

Advertising
This manual is related to the following products: