aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-06-06 12:43:39 -0700
committerPaul Eggert2011-06-06 12:43:39 -0700
commit001903b5498d4898455e1a69bff166a9cc699ec0 (patch)
tree5269347eaadca67c12e854c7fbd666286cedfc90
parentb862a52ad38e14c7f7c9000662af834c75668012 (diff)
parentcad02d3b8074b286b5c2796294c477cd2056bcc1 (diff)
downloademacs-001903b5498d4898455e1a69bff166a9cc699ec0.tar.gz
emacs-001903b5498d4898455e1a69bff166a9cc699ec0.zip
Merge: Document wide integers better.
-rw-r--r--doc/emacs/ChangeLog7
-rw-r--r--doc/emacs/buffers.texi7
-rw-r--r--doc/emacs/files.texi3
-rw-r--r--doc/lispref/ChangeLog12
-rw-r--r--doc/lispref/files.texi7
-rw-r--r--doc/lispref/numbers.texi117
-rw-r--r--doc/lispref/objects.texi12
-rw-r--r--doc/lispref/os.texi8
8 files changed, 99 insertions, 74 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 89a78263e94..6e69a96a2a8 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,10 @@
12011-06-02 Paul Eggert <eggert@cs.ucla.edu>
2
3 Document wide integers better.
4 * buffers.texi (Buffers):
5 * files.texi (Visiting): Document maxima for 64-bit machines,
6 and mention virtual memory limits.
7
12011-05-28 Chong Yidong <cyd@stupidchicken.com> 82011-05-28 Chong Yidong <cyd@stupidchicken.com>
2 9
3 * custom.texi (Hooks): Reorganize. Mention Prog mode. 10 * custom.texi (Hooks): Reorganize. Mention Prog mode.
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index ae0d85f249b..d4cc4f7bb6a 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -43,8 +43,11 @@ can be different from the value in other buffers. @xref{Locals}.
43 A buffer's size cannot be larger than some maximum, which is defined 43 A buffer's size cannot be larger than some maximum, which is defined
44by the largest buffer position representable by the @dfn{Emacs 44by the largest buffer position representable by the @dfn{Emacs
45integer} data type. This is because Emacs tracks buffer positions 45integer} data type. This is because Emacs tracks buffer positions
46using that data type. For 32-bit machines, the largest buffer size is 46using that data type. For typical 64-bit machines, the maximum buffer size
47512 megabytes. 47enforced by the data types is @math{2^61 - 2} bytes, or about 2 EiB.
48For typical 32-bit machines, the maximum is @math{2^29 - 2} bytes, or
49about 512 MiB. Buffer sizes are also limited by the size of Emacs's
50virtual memory.
48 51
49@menu 52@menu
50* Select Buffer:: Creating a new buffer or reselecting an old one. 53* Select Buffer:: Creating a new buffer or reselecting an old one.
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 40bd065610c..793a11e62ed 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -209,7 +209,8 @@ to reread it.
209about 10 megabytes), Emacs asks you for confirmation first. You can 209about 10 megabytes), Emacs asks you for confirmation first. You can
210answer @kbd{y} to proceed with visiting the file. Note, however, that 210answer @kbd{y} to proceed with visiting the file. Note, however, that
211Emacs cannot visit files that are larger than the maximum Emacs buffer 211Emacs cannot visit files that are larger than the maximum Emacs buffer
212size, which is around 512 megabytes on 32-bit machines 212size, which is limited by the amount of memory Emacs can allocate
213and by the integers that Emacs can represent
213(@pxref{Buffers}). If you try, Emacs will display an error message 214(@pxref{Buffers}). If you try, Emacs will display an error message
214saying that the maximum buffer size has been exceeded. 215saying that the maximum buffer size has been exceeded.
215 216
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 83cee10f899..54ad6abdb07 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,15 @@
12011-06-03 Paul Eggert <eggert@cs.ucla.edu>
2
3 Document wide integers better.
4 * files.texi (File Attributes): Document ino_t values better.
5 ino_t values no longer map to anything larger than a single cons.
6 * numbers.texi (Integer Basics, Integer Basics, Arithmetic Operations):
7 (Bitwise Operations):
8 * objects.texi (Integer Type): Use a binary notation that is a bit easier
9 to read, and that will port better if 62-bits becomes the default.
10 Fix or remove incorrect examples.
11 * os.texi (Time Conversion): Document time_t values better.
12
12011-05-31 Lars Magne Ingebrigtsen <larsi@gnus.org> 132011-05-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 14
3 * processes.texi (Process Information): Document 15 * processes.texi (Process Information): Document
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 72f39f681ae..4d992bd2c51 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -1237,11 +1237,12 @@ deleted and recreated; @code{nil} otherwise.
1237@item 1237@item
1238The file's inode number. If possible, this is an integer. If the 1238The file's inode number. If possible, this is an integer. If the
1239inode number is too large to be represented as an integer in Emacs 1239inode number is too large to be represented as an integer in Emacs
1240Lisp, but still fits into a 32-bit integer, then the value has the 1240Lisp but dividing it by @math{2^16} yields a representable integer,
1241then the value has the
1241form @code{(@var{high} . @var{low})}, where @var{low} holds the low 16 1242form @code{(@var{high} . @var{low})}, where @var{low} holds the low 16
1242bits. If the inode is wider than 32 bits, the value is of the form 1243bits. If the inode number is too wide for even that, the value is of the form
1243@code{(@var{high} @var{middle} . @var{low})}, where @code{high} holds 1244@code{(@var{high} @var{middle} . @var{low})}, where @code{high} holds
1244the high 24 bits, @var{middle} the next 24 bits, and @var{low} the low 1245the high bits, @var{middle} the middle 24 bits, and @var{low} the low
124516 bits. 124616 bits.
1246 1247
1247@item 1248@item
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index 2c73a03a26c..65921f444e0 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -50,8 +50,9 @@ to
50@tex 50@tex
51@math{2^{29}-1}), 51@math{2^{29}-1}),
52@end tex 52@end tex
53but some machines may provide a wider range. Many examples in this 53but some machines provide a wider range. Many examples in this
54chapter assume an integer has 30 bits. 54chapter assume that an integer has 30 bits and that floating point
55numbers are IEEE double precision.
55@cindex overflow 56@cindex overflow
56 57
57 The Lisp reader reads an integer as a sequence of digits with optional 58 The Lisp reader reads an integer as a sequence of digits with optional
@@ -97,17 +98,18 @@ view the numbers in their binary form.
97 In 30-bit binary, the decimal integer 5 looks like this: 98 In 30-bit binary, the decimal integer 5 looks like this:
98 99
99@example 100@example
10000 0000 0000 0000 0000 0000 0000 0101 1010000...000101 (30 bits total)
101@end example 102@end example
102 103
103@noindent 104@noindent
104(We have inserted spaces between groups of 4 bits, and two spaces 105(The @samp{...} stands for enough bits to fill out a 30-bit word; in
105between groups of 8 bits, to make the binary integer easier to read.) 106this case, @samp{...} stands for twenty 0 bits. Later examples also
107use the @samp{...} notation to make binary integers easier to read.)
106 108
107 The integer @minus{}1 looks like this: 109 The integer @minus{}1 looks like this:
108 110
109@example 111@example
11011 1111 1111 1111 1111 1111 1111 1111 1121111...111111 (30 bits total)
111@end example 113@end example
112 114
113@noindent 115@noindent
@@ -120,14 +122,14 @@ complement} notation.)
120@minus{}5 looks like this: 122@minus{}5 looks like this:
121 123
122@example 124@example
12311 1111 1111 1111 1111 1111 1111 1011 1251111...111011 (30 bits total)
124@end example 126@end example
125 127
126 In this implementation, the largest 30-bit binary integer value is 128 In this implementation, the largest 30-bit binary integer value is
127536,870,911 in decimal. In binary, it looks like this: 129536,870,911 in decimal. In binary, it looks like this:
128 130
129@example 131@example
13001 1111 1111 1111 1111 1111 1111 1111 1320111...111111 (30 bits total)
131@end example 133@end example
132 134
133 Since the arithmetic functions do not check whether integers go 135 Since the arithmetic functions do not check whether integers go
@@ -137,7 +139,7 @@ negative integer @minus{}536,870,912:
137@example 139@example
138(+ 1 536870911) 140(+ 1 536870911)
139 @result{} -536870912 141 @result{} -536870912
140 @result{} 10 0000 0000 0000 0000 0000 0000 0000 142 @result{} 1000...000000 (30 bits total)
141@end example 143@end example
142 144
143 Many of the functions described in this chapter accept markers for 145 Many of the functions described in this chapter accept markers for
@@ -508,8 +510,8 @@ commonly used.
508if any argument is floating. 510if any argument is floating.
509 511
510 It is important to note that in Emacs Lisp, arithmetic functions 512 It is important to note that in Emacs Lisp, arithmetic functions
511do not check for overflow. Thus @code{(1+ 268435455)} may evaluate to 513do not check for overflow. Thus @code{(1+ 536870911)} may evaluate to
512@minus{}268435456, depending on your hardware. 514@minus{}536870912, depending on your hardware.
513 515
514@defun 1+ number-or-marker 516@defun 1+ number-or-marker
515This function returns @var{number-or-marker} plus 1. 517This function returns @var{number-or-marker} plus 1.
@@ -829,19 +831,19 @@ value of a positive integer by two, rounding downward.
829The function @code{lsh}, like all Emacs Lisp arithmetic functions, does 831The function @code{lsh}, like all Emacs Lisp arithmetic functions, does
830not check for overflow, so shifting left can discard significant bits 832not check for overflow, so shifting left can discard significant bits
831and change the sign of the number. For example, left shifting 833and change the sign of the number. For example, left shifting
832536,870,911 produces @minus{}2 on a 30-bit machine: 834536,870,911 produces @minus{}2 in the 30-bit implementation:
833 835
834@example 836@example
835(lsh 536870911 1) ; @r{left shift} 837(lsh 536870911 1) ; @r{left shift}
836 @result{} -2 838 @result{} -2
837@end example 839@end example
838 840
839In binary, in the 30-bit implementation, the argument looks like this: 841In binary, the argument looks like this:
840 842
841@example 843@example
842@group 844@group
843;; @r{Decimal 536,870,911} 845;; @r{Decimal 536,870,911}
84401 1111 1111 1111 1111 1111 1111 1111 8460111...111111 (30 bits total)
845@end group 847@end group
846@end example 848@end example
847 849
@@ -851,7 +853,7 @@ which becomes the following when left shifted:
851@example 853@example
852@group 854@group
853;; @r{Decimal @minus{}2} 855;; @r{Decimal @minus{}2}
85411 1111 1111 1111 1111 1111 1111 1110 8561111...111110 (30 bits total)
855@end group 857@end group
856@end example 858@end example
857@end defun 859@end defun
@@ -874,9 +876,9 @@ looks like this:
874@group 876@group
875(ash -6 -1) @result{} -3 877(ash -6 -1) @result{} -3
876;; @r{Decimal @minus{}6 becomes decimal @minus{}3.} 878;; @r{Decimal @minus{}6 becomes decimal @minus{}3.}
87711 1111 1111 1111 1111 1111 1111 1010 8791111...111010 (30 bits total)
878 @result{} 880 @result{}
87911 1111 1111 1111 1111 1111 1111 1101 8811111...111101 (30 bits total)
880@end group 882@end group
881@end example 883@end example
882 884
@@ -887,9 +889,9 @@ In contrast, shifting the pattern of bits one place to the right with
887@group 889@group
888(lsh -6 -1) @result{} 536870909 890(lsh -6 -1) @result{} 536870909
889;; @r{Decimal @minus{}6 becomes decimal 536,870,909.} 891;; @r{Decimal @minus{}6 becomes decimal 536,870,909.}
89011 1111 1111 1111 1111 1111 1111 1010 8921111...111010 (30 bits total)
891 @result{} 893 @result{}
89201 1111 1111 1111 1111 1111 1111 1101 8940111...111101 (30 bits total)
893@end group 895@end group
894@end example 896@end example
895 897
@@ -899,34 +901,35 @@ Here are other examples:
899@c with smallbook but not with regular book! --rjc 16mar92 901@c with smallbook but not with regular book! --rjc 16mar92
900@smallexample 902@smallexample
901@group 903@group
902 ; @r{ 30-bit binary values} 904 ; @r{ 30-bit binary values}
903 905
904(lsh 5 2) ; 5 = @r{00 0000 0000 0000 0000 0000 0000 0101} 906(lsh 5 2) ; 5 = @r{0000...000101}
905 @result{} 20 ; = @r{00 0000 0000 0000 0000 0000 0001 0100} 907 @result{} 20 ; = @r{0000...010100}
906@end group 908@end group
907@group 909@group
908(ash 5 2) 910(ash 5 2)
909 @result{} 20 911 @result{} 20
910(lsh -5 2) ; -5 = @r{11 1111 1111 1111 1111 1111 1111 1011} 912(lsh -5 2) ; -5 = @r{1111...111011}
911 @result{} -20 ; = @r{11 1111 1111 1111 1111 1111 1110 1100} 913 @result{} -20 ; = @r{1111...101100}
912(ash -5 2) 914(ash -5 2)
913 @result{} -20 915 @result{} -20
914@end group 916@end group
915@group 917@group
916(lsh 5 -2) ; 5 = @r{00 0000 0000 0000 0000 0000 0000 0101} 918(lsh 5 -2) ; 5 = @r{0000...000101}
917 @result{} 1 ; = @r{00 0000 0000 0000 0000 0000 0000 0001} 919 @result{} 1 ; = @r{0000...000001}
918@end group 920@end group
919@group 921@group
920(ash 5 -2) 922(ash 5 -2)
921 @result{} 1 923 @result{} 1
922@end group 924@end group
923@group 925@group
924(lsh -5 -2) ; -5 = @r{11 1111 1111 1111 1111 1111 1111 1011} 926(lsh -5 -2) ; -5 = @r{1111...111011}
925 @result{} 268435454 ; = @r{00 0111 1111 1111 1111 1111 1111 1110} 927 @result{} 268435454
928 ; = @r{0011...111110}
926@end group 929@end group
927@group 930@group
928(ash -5 -2) ; -5 = @r{11 1111 1111 1111 1111 1111 1111 1011} 931(ash -5 -2) ; -5 = @r{1111...111011}
929 @result{} -2 ; = @r{11 1111 1111 1111 1111 1111 1111 1110} 932 @result{} -2 ; = @r{1111...111110}
930@end group 933@end group
931@end smallexample 934@end smallexample
932@end defun 935@end defun
@@ -961,23 +964,23 @@ because its binary representation consists entirely of ones. If
961 964
962@smallexample 965@smallexample
963@group 966@group
964 ; @r{ 30-bit binary values} 967 ; @r{ 30-bit binary values}
965 968
966(logand 14 13) ; 14 = @r{00 0000 0000 0000 0000 0000 0000 1110} 969(logand 14 13) ; 14 = @r{0000...001110}
967 ; 13 = @r{00 0000 0000 0000 0000 0000 0000 1101} 970 ; 13 = @r{0000...001101}
968 @result{} 12 ; 12 = @r{00 0000 0000 0000 0000 0000 0000 1100} 971 @result{} 12 ; 12 = @r{0000...001100}
969@end group 972@end group
970 973
971@group 974@group
972(logand 14 13 4) ; 14 = @r{00 0000 0000 0000 0000 0000 0000 1110} 975(logand 14 13 4) ; 14 = @r{0000...001110}
973 ; 13 = @r{00 0000 0000 0000 0000 0000 0000 1101} 976 ; 13 = @r{0000...001101}
974 ; 4 = @r{00 0000 0000 0000 0000 0000 0000 0100} 977 ; 4 = @r{0000...000100}
975 @result{} 4 ; 4 = @r{00 0000 0000 0000 0000 0000 0000 0100} 978 @result{} 4 ; 4 = @r{0000...000100}
976@end group 979@end group
977 980
978@group 981@group
979(logand) 982(logand)
980 @result{} -1 ; -1 = @r{11 1111 1111 1111 1111 1111 1111 1111} 983 @result{} -1 ; -1 = @r{1111...111111}
981@end group 984@end group
982@end smallexample 985@end smallexample
983@end defun 986@end defun
@@ -991,18 +994,18 @@ passed just one argument, it returns that argument.
991 994
992@smallexample 995@smallexample
993@group 996@group
994 ; @r{ 30-bit binary values} 997 ; @r{ 30-bit binary values}
995 998
996(logior 12 5) ; 12 = @r{00 0000 0000 0000 0000 0000 0000 1100} 999(logior 12 5) ; 12 = @r{0000...001100}
997 ; 5 = @r{00 0000 0000 0000 0000 0000 0000 0101} 1000 ; 5 = @r{0000...000101}
998 @result{} 13 ; 13 = @r{00 0000 0000 0000 0000 0000 0000 1101} 1001 @result{} 13 ; 13 = @r{0000...001101}
999@end group 1002@end group
1000 1003
1001@group 1004@group
1002(logior 12 5 7) ; 12 = @r{00 0000 0000 0000 0000 0000 0000 1100} 1005(logior 12 5 7) ; 12 = @r{0000...001100}
1003 ; 5 = @r{00 0000 0000 0000 0000 0000 0000 0101} 1006 ; 5 = @r{0000...000101}
1004 ; 7 = @r{00 0000 0000 0000 0000 0000 0000 0111} 1007 ; 7 = @r{0000...000111}
1005 @result{} 15 ; 15 = @r{00 0000 0000 0000 0000 0000 0000 1111} 1008 @result{} 15 ; 15 = @r{0000...001111}
1006@end group 1009@end group
1007@end smallexample 1010@end smallexample
1008@end defun 1011@end defun
@@ -1016,18 +1019,18 @@ result is 0, which is an identity element for this operation. If
1016 1019
1017@smallexample 1020@smallexample
1018@group 1021@group
1019 ; @r{ 30-bit binary values} 1022 ; @r{ 30-bit binary values}
1020 1023
1021(logxor 12 5) ; 12 = @r{00 0000 0000 0000 0000 0000 0000 1100} 1024(logxor 12 5) ; 12 = @r{0000...001100}
1022 ; 5 = @r{00 0000 0000 0000 0000 0000 0000 0101} 1025 ; 5 = @r{0000...000101}
1023 @result{} 9 ; 9 = @r{00 0000 0000 0000 0000 0000 0000 1001} 1026 @result{} 9 ; 9 = @r{0000...001001}
1024@end group 1027@end group
1025 1028
1026@group 1029@group
1027(logxor 12 5 7) ; 12 = @r{00 0000 0000 0000 0000 0000 0000 1100} 1030(logxor 12 5 7) ; 12 = @r{0000...001100}
1028 ; 5 = @r{00 0000 0000 0000 0000 0000 0000 0101} 1031 ; 5 = @r{0000...000101}
1029 ; 7 = @r{00 0000 0000 0000 0000 0000 0000 0111} 1032 ; 7 = @r{0000...000111}
1030 @result{} 14 ; 14 = @r{00 0000 0000 0000 0000 0000 0000 1110} 1033 @result{} 14 ; 14 = @r{0000...001110}
1031@end group 1034@end group
1032@end smallexample 1035@end smallexample
1033@end defun 1036@end defun
@@ -1040,9 +1043,9 @@ bit is one in the result if, and only if, the @var{n}th bit is zero in
1040@example 1043@example
1041(lognot 5) 1044(lognot 5)
1042 @result{} -6 1045 @result{} -6
1043;; 5 = @r{00 0000 0000 0000 0000 0000 0000 0101} 1046;; 5 = @r{0000...000101} (30 bits total)
1044;; @r{becomes} 1047;; @r{becomes}
1045;; -6 = @r{11 1111 1111 1111 1111 1111 1111 1010} 1048;; -6 = @r{1111...111010} (30 bits total)
1046@end example 1049@end example
1047@end defun 1050@end defun
1048 1051
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index c58d54f13fc..27d9ba10aef 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -179,10 +179,9 @@ to
179@tex 179@tex
180@math{2^{29}-1}) 180@math{2^{29}-1})
181@end tex 181@end tex
182on most machines. (Some machines may provide a wider range.) It is 182on typical 32-bit machines. (Some machines provide a wider range.)
183important to note that the Emacs Lisp arithmetic functions do not check 183Emacs Lisp arithmetic functions do not check for overflow. Thus
184for overflow. Thus @code{(1+ 536870911)} is @minus{}536870912 on most 184@code{(1+ 536870911)} is @minus{}536870912 if Emacs integers are 30 bits.
185machines.
186 185
187 The read syntax for integers is a sequence of (base ten) digits with an 186 The read syntax for integers is a sequence of (base ten) digits with an
188optional sign at the beginning and an optional period at the end. The 187optional sign at the beginning and an optional period at the end. The
@@ -195,7 +194,6 @@ leading @samp{+} or a final @samp{.}.
1951 ; @r{The integer 1.} 1941 ; @r{The integer 1.}
1961. ; @r{Also the integer 1.} 1951. ; @r{Also the integer 1.}
197+1 ; @r{Also the integer 1.} 196+1 ; @r{Also the integer 1.}
1981073741825 ; @r{Also the integer 1 on a 30-bit implementation.}
199@end group 197@end group
200@end example 198@end example
201 199
@@ -203,8 +201,8 @@ leading @samp{+} or a final @samp{.}.
203As a special exception, if a sequence of digits specifies an integer 201As a special exception, if a sequence of digits specifies an integer
204too large or too small to be a valid integer object, the Lisp reader 202too large or too small to be a valid integer object, the Lisp reader
205reads it as a floating-point number (@pxref{Floating Point Type}). 203reads it as a floating-point number (@pxref{Floating Point Type}).
206For instance, on most machines @code{536870912} is read as the 204For instance, if Emacs integers are 30 bits, @code{536870912} is read
207floating-point number @code{536870912.0}. 205as the floating-point number @code{536870912.0}.
208 206
209 @xref{Numbers}, for more information. 207 @xref{Numbers}, for more information.
210 208
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index b226d676462..5f422065c5b 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1193,11 +1193,11 @@ to calendrical information and vice versa. You can get time values
1193from the functions @code{current-time} (@pxref{Time of Day}) and 1193from the functions @code{current-time} (@pxref{Time of Day}) and
1194@code{file-attributes} (@pxref{Definition of file-attributes}). 1194@code{file-attributes} (@pxref{Definition of file-attributes}).
1195 1195
1196 Many operating systems are limited to time values that contain 32 bits 1196 Many 32-bit operating systems are limited to time values that contain 32 bits
1197of information; these systems typically handle only the times from 1197of information; these systems typically handle only the times from
11981901-12-13 20:45:52 UTC through 2038-01-19 03:14:07 UTC. However, some 11981901-12-13 20:45:52 UTC through 2038-01-19 03:14:07 UTC. However, 64-bit
1199operating systems have larger time values, and can represent times far 1199and some 32-bit operating systems have larger time values, and can
1200in the past or future. 1200represent times far in the past or future.
1201 1201
1202 Time conversion functions always use the Gregorian calendar, even 1202 Time conversion functions always use the Gregorian calendar, even
1203for dates before the Gregorian calendar was introduced. Year numbers 1203for dates before the Gregorian calendar was introduced. Year numbers