aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/numbers.texi113
-rw-r--r--etc/NEWS10
2 files changed, 62 insertions, 61 deletions
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index 9c16b1a64c4..dd78bce4c90 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -112,18 +112,18 @@ view the numbers in their binary form.
112 In binary, the decimal integer 5 looks like this: 112 In binary, the decimal integer 5 looks like this:
113 113
114@example 114@example
115...000101 115@dots{}000101
116@end example 116@end example
117 117
118@noindent 118@noindent
119(The @samp{...} stands for a conceptually infinite number of bits that 119(The ellipsis @samp{@dots{}} stands for a conceptually infinite number
120match the leading bit; here, an infinite number of 0 bits. Later 120of bits that match the leading bit; here, an infinite number of 0
121examples also use this @samp{...} notation.) 121bits. Later examples also use this @samp{@dots{}} notation.)
122 122
123 The integer @minus{}1 looks like this: 123 The integer @minus{}1 looks like this:
124 124
125@example 125@example
126...111111 126@dots{}111111
127@end example 127@end example
128 128
129@noindent 129@noindent
@@ -136,7 +136,7 @@ In binary, the decimal integer 4 is 100. Consequently,
136@minus{}5 looks like this: 136@minus{}5 looks like this:
137 137
138@example 138@example
139...111011 139@dots{}111011
140@end example 140@end example
141 141
142 Many of the functions described in this chapter accept markers for 142 Many of the functions described in this chapter accept markers for
@@ -189,15 +189,16 @@ on 64-bit platforms.
189 189
190@cindex bignum range 190@cindex bignum range
191@cindex integer range 191@cindex integer range
192@cindex number of bignum bits, limit on
192@defvar integer-width 193@defvar integer-width
193The value of this variable is a nonnegative integer that is an upper 194The value of this variable is a nonnegative integer that is an upper
194bound on the number of bits in a bignum. Integers outside the fixnum 195bound on the number of bits in a bignum. Integers outside the fixnum
195range are limited to absolute values less than 2@sup{@var{n}}, where 196range are limited to absolute values less than 2@sup{@var{n}}, where
196@var{n} is this variable's value. Attempts to create bignums outside 197@var{n} is this variable's value. Attempts to create bignums outside
197this range result in integer overflow. Setting this variable to zero 198this range result in an integer overflow error. Setting this variable
198disables creation of bignums; setting it to a large number can cause 199to zero disables creation of bignums; setting it to a large number can
199Emacs to consume large quantities of memory if a computation creates 200cause Emacs to consume large quantities of memory if a computation
200huge integers. 201creates huge integers.
201@end defvar 202@end defvar
202 203
203 In Emacs Lisp, text characters are represented by integers. Any 204 In Emacs Lisp, text characters are represented by integers. Any
@@ -871,30 +872,30 @@ equivalent to dividing by two and then rounding toward minus infinity.
871@group 872@group
872(ash 7 1) @result{} 14 873(ash 7 1) @result{} 14
873;; @r{Decimal 7 becomes decimal 14.} 874;; @r{Decimal 7 becomes decimal 14.}
874...000111 875@dots{}000111
875 @result{} 876 @result{}
876...001110 877@dots{}001110
877@end group 878@end group
878 879
879@group 880@group
880(ash 7 -1) @result{} 3 881(ash 7 -1) @result{} 3
881...000111 882@dots{}000111
882 @result{} 883 @result{}
883...000011 884@dots{}000011
884@end group 885@end group
885 886
886@group 887@group
887(ash -7 1) @result{} -14 888(ash -7 1) @result{} -14
888...111001 889@dots{}111001
889 @result{} 890 @result{}
890...110010 891@dots{}110010
891@end group 892@end group
892 893
893@group 894@group
894(ash -7 -1) @result{} -4 895(ash -7 -1) @result{} -4
895...111001 896@dots{}111001
896 @result{} 897 @result{}
897...111100 898@dots{}111100
898@end group 899@end group
899@end example 900@end example
900 901
@@ -903,18 +904,18 @@ Here are examples of shifting left or right by two bits:
903@smallexample 904@smallexample
904@group 905@group
905 ; @r{ binary values} 906 ; @r{ binary values}
906(ash 5 2) ; 5 = @r{...000101} 907(ash 5 2) ; 5 = @r{@dots{}000101}
907 @result{} 20 ; = @r{...010100} 908 @result{} 20 ; = @r{@dots{}010100}
908(ash -5 2) ; -5 = @r{...111011} 909(ash -5 2) ; -5 = @r{@dots{}111011}
909 @result{} -20 ; = @r{...101100} 910 @result{} -20 ; = @r{@dots{}101100}
910@end group 911@end group
911@group 912@group
912(ash 5 -2) 913(ash 5 -2)
913 @result{} 1 ; = @r{...000001} 914 @result{} 1 ; = @r{@dots{}000001}
914@end group 915@end group
915@group 916@group
916(ash -5 -2) 917(ash -5 -2)
917 @result{} -2 ; = @r{...111110} 918 @result{} -2 ; = @r{@dots{}111110}
918@end group 919@end group
919@end smallexample 920@end smallexample
920@end defun 921@end defun
@@ -938,16 +939,16 @@ exceptional cases. These examples assume 30-bit fixnums.
938@smallexample 939@smallexample
939@group 940@group
940 ; @r{ binary values} 941 ; @r{ binary values}
941(ash -7 -1) ; -7 = @r{...111111111111111111111111111001} 942(ash -7 -1) ; -7 = @r{@dots{}111111111111111111111111111001}
942 @result{} -4 ; = @r{...111111111111111111111111111100} 943 @result{} -4 ; = @r{@dots{}111111111111111111111111111100}
943(lsh -7 -1) 944(lsh -7 -1)
944 @result{} 536870908 ; = @r{...011111111111111111111111111100} 945 @result{} 536870908 ; = @r{@dots{}011111111111111111111111111100}
945@end group 946@end group
946@group 947@group
947(ash -5 -2) ; -5 = @r{...111111111111111111111111111011} 948(ash -5 -2) ; -5 = @r{@dots{}111111111111111111111111111011}
948 @result{} -2 ; = @r{...111111111111111111111111111110} 949 @result{} -2 ; = @r{@dots{}111111111111111111111111111110}
949(lsh -5 -2) 950(lsh -5 -2)
950 @result{} 268435454 ; = @r{...001111111111111111111111111110} 951 @result{} 268435454 ; = @r{@dots{}001111111111111111111111111110}
951@end group 952@end group
952@end smallexample 953@end smallexample
953@end defun 954@end defun
@@ -983,21 +984,21 @@ because its binary representation consists entirely of ones. If
983@group 984@group
984 ; @r{ binary values} 985 ; @r{ binary values}
985 986
986(logand 14 13) ; 14 = @r{...001110} 987(logand 14 13) ; 14 = @r{@dots{}001110}
987 ; 13 = @r{...001101} 988 ; 13 = @r{@dots{}001101}
988 @result{} 12 ; 12 = @r{...001100} 989 @result{} 12 ; 12 = @r{@dots{}001100}
989@end group 990@end group
990 991
991@group 992@group
992(logand 14 13 4) ; 14 = @r{...001110} 993(logand 14 13 4) ; 14 = @r{@dots{}001110}
993 ; 13 = @r{...001101} 994 ; 13 = @r{@dots{}001101}
994 ; 4 = @r{...000100} 995 ; 4 = @r{@dots{}000100}
995 @result{} 4 ; 4 = @r{...000100} 996 @result{} 4 ; 4 = @r{@dots{}000100}
996@end group 997@end group
997 998
998@group 999@group
999(logand) 1000(logand)
1000 @result{} -1 ; -1 = @r{...111111} 1001 @result{} -1 ; -1 = @r{@dots{}111111}
1001@end group 1002@end group
1002@end smallexample 1003@end smallexample
1003@end defun 1004@end defun
@@ -1013,16 +1014,16 @@ passed just one argument, it returns that argument.
1013@group 1014@group
1014 ; @r{ binary values} 1015 ; @r{ binary values}
1015 1016
1016(logior 12 5) ; 12 = @r{...001100} 1017(logior 12 5) ; 12 = @r{@dots{}001100}
1017 ; 5 = @r{...000101} 1018 ; 5 = @r{@dots{}000101}
1018 @result{} 13 ; 13 = @r{...001101} 1019 @result{} 13 ; 13 = @r{@dots{}001101}
1019@end group 1020@end group
1020 1021
1021@group 1022@group
1022(logior 12 5 7) ; 12 = @r{...001100} 1023(logior 12 5 7) ; 12 = @r{@dots{}001100}
1023 ; 5 = @r{...000101} 1024 ; 5 = @r{@dots{}000101}
1024 ; 7 = @r{...000111} 1025 ; 7 = @r{@dots{}000111}
1025 @result{} 15 ; 15 = @r{...001111} 1026 @result{} 15 ; 15 = @r{@dots{}001111}
1026@end group 1027@end group
1027@end smallexample 1028@end smallexample
1028@end defun 1029@end defun
@@ -1038,16 +1039,16 @@ result is 0, which is an identity element for this operation. If
1038@group 1039@group
1039 ; @r{ binary values} 1040 ; @r{ binary values}
1040 1041
1041(logxor 12 5) ; 12 = @r{...001100} 1042(logxor 12 5) ; 12 = @r{@dots{}001100}
1042 ; 5 = @r{...000101} 1043 ; 5 = @r{@dots{}000101}
1043 @result{} 9 ; 9 = @r{...001001} 1044 @result{} 9 ; 9 = @r{@dots{}001001}
1044@end group 1045@end group
1045 1046
1046@group 1047@group
1047(logxor 12 5 7) ; 12 = @r{...001100} 1048(logxor 12 5 7) ; 12 = @r{@dots{}001100}
1048 ; 5 = @r{...000101} 1049 ; 5 = @r{@dots{}000101}
1049 ; 7 = @r{...000111} 1050 ; 7 = @r{@dots{}000111}
1050 @result{} 14 ; 14 = @r{...001110} 1051 @result{} 14 ; 14 = @r{@dots{}001110}
1051@end group 1052@end group
1052@end smallexample 1053@end smallexample
1053@end defun 1054@end defun
@@ -1060,9 +1061,9 @@ bit is one in the result if, and only if, the @var{n}th bit is zero in
1060@example 1061@example
1061(lognot 5) 1062(lognot 5)
1062 @result{} -6 1063 @result{} -6
1063;; 5 = @r{...000101} 1064;; 5 = @r{@dots{}000101}
1064;; @r{becomes} 1065;; @r{becomes}
1065;; -6 = @r{...111010} 1066;; -6 = @r{@dots{}111010}
1066@end example 1067@end example
1067@end defun 1068@end defun
1068 1069
@@ -1077,9 +1078,9 @@ its two's complement binary representation. The result is always
1077nonnegative. 1078nonnegative.
1078 1079
1079@example 1080@example
1080(logcount 43) ; 43 = @r{...000101011} 1081(logcount 43) ; 43 = @r{@dots{}000101011}
1081 @result{} 4 1082 @result{} 4
1082(logcount -43) ; -43 = @r{...111010101} 1083(logcount -43) ; -43 = @r{@dots{}111010101}
1083 @result{} 3 1084 @result{} 3
1084@end example 1085@end example
1085@end defun 1086@end defun
diff --git a/etc/NEWS b/etc/NEWS
index 9a741644213..892797b2dde 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -871,11 +871,11 @@ bignums. However, note that unlike fixnums, bignums will not compare
871equal with 'eq', you must use 'eql' instead. (Numerical comparison 871equal with 'eq', you must use 'eql' instead. (Numerical comparison
872with '=' works on both, of course.) 872with '=' works on both, of course.)
873 873
874+++ 874Since large bignums consume a lot of memory, Emacs limits the size of
875** New variable 'integer-width'. 875the largest bignum a Lisp program is allowed to create. The
876It is a nonnegative integer specifying the maximum number of bits 876nonnegative value of the new variable 'integer-width' specifies the
877allowed in a bignum. Integer overflow occurs if this limit is 877maximum number of bits allowed in a bignum. Emacs signals an integer
878exceeded. 878overflow error if this limit is exceeded.
879 879
880** define-minor-mode automatically documents the meaning of ARG 880** define-minor-mode automatically documents the meaning of ARG
881 881