874
Appendix A: Functions and Instructions
shift()
CATALOG
shift(
integer1[
,
#ofShifts]
)
⇒
⇒
⇒
⇒
integer
Shifts the bits in a binary integer. You can enter
integer1
in any number base; it is converted
automatically to a signed, 32-bit binary form. If
the magnitude of
integer1
is too large for this
form, a symmetric modulo operation brings it
within the range.
If
#ofShifts
is positive, the shift is to the left. If
#ofShifts
is negative, the shift is to the right. The
default is
ë
1 (shift right one bit).
In a right shift, the rightmost bit is dropped and 0
or 1 is inserted to match the leftmost bit. In a left
shift, the leftmost bit is dropped and 0 is inserted
as the rightmost bit.
For example, in a right shift:
In Bin base mode:
shift(0b1111010110000110101)
¸
0b111101011000011010
shift(256,1)
¸
0b1000000000
In Hex base mode:
shift(0h78E)
¸
0h3C7
shift(0h78E,
ë
2)
¸
0h1E3
shift(0h78E,2)
¸
0h1E38
Important:
To enter a binary or hexadecimal
number, always use the 0b or 0h prefix (zero, not the
letter O).
0b00000000000001111010110000110101
produces:
0b00000000000000111101011000011010
The result is displayed according to the
Base
mode. Leading zeros are not shown.
shift(
list1 [
,
#ofShifts]
)
⇒
⇒
⇒
⇒
list
Returns a copy of
list1
shifted right or left by
#ofShifts
elements. Does not alter
list1
.
If
#ofShifts
is positive, the shift is to the left. If
#ofShifts
is negative, the shift is to the right. The
default is
ë
1 (shift right one element).
Elements introduced at the beginning or end of
list
by the shift are set to the symbol “undef”.
In Dec base mode:
shift({1,2,3,4})
¸
{undef 1 2 3}
shift({1,2,3,4},
ë
2)
¸
{undef undef 1 2}
shift({1,2,3,4},1)
¸
{2 3 4 undef}
shift(
string1 [
,
#ofShifts]
)
⇒
⇒
⇒
⇒
string
Returns a copy of
string1
shifted right or left by
#ofShifts
characters. Does not alter
string1
.
If
#ofShifts
is positive, the shift is to the left. If
#ofShifts
is negative, the shift is to the right. The
default is
ë
1 (shift right one character).
Characters introduced at the beginning or end of
string
by the shift are set to a space.
shift("abcd")
¸
"
abc"
shift("abcd",
ë
2)
¸
" ab"
shift("abcd",1)
¸
"bcd
"
Inserts 0 if leftmost bit is 0,
or 1 if leftmost bit is 1.
Each bit shifts right.
Dropped
Содержание Voyage 200
Страница 36: ...Getting Started 36 D B D B Press Result ...
Страница 45: ...Getting Started 45 3 0 D B D D B D Press Result ...
Страница 46: ...Getting Started 46 D 2 0 0 2 D B Scroll down to October and press Press Result ...
Страница 60: ...Getting Started 60 B D Press Result ...
Страница 139: ...Previews 139 8 Complete the operation Press 2 d Steps and keystrokes Display 5 f 2 ...
Страница 181: ...Operating the Calculator 181 From the Keyboard From the Keyboard From the Keyboard From the Keyboard ...
Страница 453: ...Differential Equation Graphing 453 ...
Страница 468: ...Tables 468 ...
Страница 515: ...Split Screens 515 Note Both Top Bottom and Left Right splits use the same methods to select an application ...
Страница 777: ...Activities 777 ...