/[emacs]/emacs/lispref/numbers.texi
ViewVC logotype

Diff of /emacs/lispref/numbers.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by eliz, Tue Feb 19 11:03:54 2002 UTC revision 1.21.4.1 by miles, Fri Apr 4 06:20:42 2003 UTC
# Line 1  Line 1 
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
# Line 40  minimum range is @minus{}134217728 to 13 Line 40  minimum range is @minus{}134217728 to 13
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
# Line 76  binary (radix 2), @samp{#O@var{integer}} Line 76  binary (radix 2), @samp{#O@var{integer}}
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
# Line 746  like this (with 8-bit binary numbers): Line 746  like this (with 8-bit binary numbers):
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    
# Line 757  On the other hand, shifting one place to Line 757  On the other hand, shifting one place to
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    
# Line 787  In binary, in the 28-bit implementation, Line 787  In binary, in the 28-bit implementation,
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    
# Line 797  which becomes the following when left sh Line 797  which becomes the following when left sh
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
# Line 818  looks like this: Line 818  looks like this:
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
# Line 834  In contrast, shifting the pattern of bit Line 834  In contrast, shifting the pattern of bit
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
# Line 992  bit is one in the result if, and only if Line 992  bit is one in the result if, and only if
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}

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.21.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26