1 |
@c -*-texinfo-*- |
@c -*-texinfo-*- |
2 |
@c This is part of the GNU Emacs Lisp Reference Manual. |
@c This is part of the GNU Emacs Lisp Reference Manual. |
3 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 |
4 |
@c Free Software Foundation, Inc. |
@c Free Software Foundation, Inc. |
5 |
@c See the file elisp.texi for copying conditions. |
@c See the file elisp.texi for copying conditions. |
6 |
@setfilename ../info/numbers |
@setfilename ../info/numbers |
7 |
@node Numbers, Strings and Characters, Lisp Data Types, Top |
@node Numbers, Strings and Characters, Lisp Data Types, Top |
40 |
@ifnottex |
@ifnottex |
41 |
-2**27 |
-2**27 |
42 |
@end ifnottex |
@end ifnottex |
43 |
@tex |
@tex |
44 |
@math{-2^{27}} |
@math{-2^{27}} |
45 |
@end tex |
@end tex |
46 |
to |
to |
47 |
@ifnottex |
@ifnottex |
48 |
2**27 - 1), |
2**27 - 1), |
49 |
@end ifnottex |
@end ifnottex |
50 |
@tex |
@tex |
51 |
@math{2^{27}-1}), |
@math{2^{27}-1}), |
52 |
@end tex |
@end tex |
53 |
but some machines may provide a wider range. Many examples in this |
but some machines may provide a wider range. Many examples in this |
76 |
(radix 8), @samp{#X@var{integer}} reads @var{integer} in hexadecimal |
(radix 8), @samp{#X@var{integer}} reads @var{integer} in hexadecimal |
77 |
(radix 16), and @samp{#@var{radix}r@var{integer}} reads @var{integer} |
(radix 16), and @samp{#@var{radix}r@var{integer}} reads @var{integer} |
78 |
in radix @var{radix} (where @var{radix} is between 2 and 36, |
in radix @var{radix} (where @var{radix} is between 2 and 36, |
79 |
inclusivley). Case is not significant for the letter after @samp{#} |
inclusively). Case is not significant for the letter after @samp{#} |
80 |
(@samp{B}, @samp{O}, etc.) that denotes the radix. |
(@samp{B}, @samp{O}, etc.) that denotes the radix. |
81 |
|
|
82 |
To understand how various functions work on integers, especially the |
To understand how various functions work on integers, especially the |
746 |
(lsh 3 2) |
(lsh 3 2) |
747 |
@result{} 12 |
@result{} 12 |
748 |
;; @r{Decimal 3 becomes decimal 12.} |
;; @r{Decimal 3 becomes decimal 12.} |
749 |
00000011 @result{} 00001100 |
00000011 @result{} 00001100 |
750 |
@end group |
@end group |
751 |
@end example |
@end example |
752 |
|
|
757 |
(lsh 6 -1) |
(lsh 6 -1) |
758 |
@result{} 3 |
@result{} 3 |
759 |
;; @r{Decimal 6 becomes decimal 3.} |
;; @r{Decimal 6 becomes decimal 3.} |
760 |
00000110 @result{} 00000011 |
00000110 @result{} 00000011 |
761 |
@end group |
@end group |
762 |
|
|
763 |
@group |
@group |
764 |
(lsh 5 -1) |
(lsh 5 -1) |
765 |
@result{} 2 |
@result{} 2 |
766 |
;; @r{Decimal 5 becomes decimal 2.} |
;; @r{Decimal 5 becomes decimal 2.} |
767 |
00000101 @result{} 00000010 |
00000101 @result{} 00000010 |
768 |
@end group |
@end group |
769 |
@end example |
@end example |
770 |
|
|
787 |
@example |
@example |
788 |
@group |
@group |
789 |
;; @r{Decimal 134,217,727} |
;; @r{Decimal 134,217,727} |
790 |
0111 1111 1111 1111 1111 1111 1111 |
0111 1111 1111 1111 1111 1111 1111 |
791 |
@end group |
@end group |
792 |
@end example |
@end example |
793 |
|
|
797 |
@example |
@example |
798 |
@group |
@group |
799 |
;; @r{Decimal @minus{}2} |
;; @r{Decimal @minus{}2} |
800 |
1111 1111 1111 1111 1111 1111 1110 |
1111 1111 1111 1111 1111 1111 1110 |
801 |
@end group |
@end group |
802 |
@end example |
@end example |
803 |
@end defun |
@end defun |
818 |
|
|
819 |
@example |
@example |
820 |
@group |
@group |
821 |
(ash -6 -1) @result{} -3 |
(ash -6 -1) @result{} -3 |
822 |
;; @r{Decimal @minus{}6 becomes decimal @minus{}3.} |
;; @r{Decimal @minus{}6 becomes decimal @minus{}3.} |
823 |
1111 1111 1111 1111 1111 1111 1010 |
1111 1111 1111 1111 1111 1111 1010 |
824 |
@result{} |
@result{} |
825 |
1111 1111 1111 1111 1111 1111 1101 |
1111 1111 1111 1111 1111 1111 1101 |
826 |
@end group |
@end group |
827 |
@end example |
@end example |
834 |
(lsh -6 -1) @result{} 134217725 |
(lsh -6 -1) @result{} 134217725 |
835 |
;; @r{Decimal @minus{}6 becomes decimal 134,217,725.} |
;; @r{Decimal @minus{}6 becomes decimal 134,217,725.} |
836 |
1111 1111 1111 1111 1111 1111 1010 |
1111 1111 1111 1111 1111 1111 1010 |
837 |
@result{} |
@result{} |
838 |
0111 1111 1111 1111 1111 1111 1101 |
0111 1111 1111 1111 1111 1111 1101 |
839 |
@end group |
@end group |
840 |
@end example |
@end example |
992 |
@var{integer}, and vice-versa. |
@var{integer}, and vice-versa. |
993 |
|
|
994 |
@example |
@example |
995 |
(lognot 5) |
(lognot 5) |
996 |
@result{} -6 |
@result{} -6 |
997 |
;; 5 = @r{0000 0000 0000 0000 0000 0000 0101} |
;; 5 = @r{0000 0000 0000 0000 0000 0000 0101} |
998 |
;; @r{becomes} |
;; @r{becomes} |