comparison man/xemacs-faq.texi @ 1987:eacbf51ca0d2

[xemacs-hg @ 2004-04-06 15:52:00 by stephent] bignum FAQs <873c7hp0kw.fsf_-_@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Tue, 06 Apr 2004 15:52:00 +0000
parents 11812ec0334c
children e0dc83407d58
comparison
equal deleted inserted replaced
1986:83276542ee26 1987:eacbf51ca0d2
5 @setchapternewpage off 5 @setchapternewpage off
6 @c %**end of header 6 @c %**end of header
7 @finalout 7 @finalout
8 @titlepage 8 @titlepage
9 @title XEmacs FAQ 9 @title XEmacs FAQ
10 @subtitle Frequently asked questions about XEmacs @* Last Modified: $Date: 2004/01/21 09:03:42 $ 10 @subtitle Frequently asked questions about XEmacs @* Last Modified: $Date: 2004/04/06 15:52:00 $
11 @sp 1 11 @sp 1
12 @author Tony Rossini <rossini@@u.washington.edu> 12 @author Tony Rossini <rossini@@u.washington.edu>
13 @author Ben Wing <ben@@xemacs.org> 13 @author Ben Wing <ben@@xemacs.org>
14 @author Chuck Thompson <cthomp@@xemacs.org> 14 @author Chuck Thompson <cthomp@@xemacs.org>
15 @author Steve Baur <steve@@xemacs.org> 15 @author Steve Baur <steve@@xemacs.org>
377 * Q5.3.8:: How do I insert today's date into a buffer? 377 * Q5.3.8:: How do I insert today's date into a buffer?
378 * Q5.3.9:: Are only certain syntactic character classes available for abbrevs? 378 * Q5.3.9:: Are only certain syntactic character classes available for abbrevs?
379 * Q5.3.10:: How can I get those oh-so-neat X-Face lines? 379 * Q5.3.10:: How can I get those oh-so-neat X-Face lines?
380 * Q5.3.11:: How do I add new Info directories? 380 * Q5.3.11:: How do I add new Info directories?
381 * Q5.3.12:: What do I need to change to make printing work? 381 * Q5.3.12:: What do I need to change to make printing work?
382
383 Mathematics:
384 * Q5.4.1:: What are bignums, ratios, and bigfloats in Lisp?
385 * Q5.4.2:: XEmacs segfaults when I use very big numbers!
386 * Q5.4.3:: Bignums are really slow!
387 * Q5.4.4:: Equal bignums don't compare as equal! What's going on?
382 388
383 XEmacs on MS Windows 389 XEmacs on MS Windows
384 390
385 General Info: 391 General Info:
386 * Q6.0.1:: What is the status of the XEmacs port to Windows? 392 * Q6.0.1:: What is the status of the XEmacs port to Windows?
5048 * Q5.3.8:: How do I insert today's date into a buffer? 5054 * Q5.3.8:: How do I insert today's date into a buffer?
5049 * Q5.3.9:: Are only certain syntactic character classes available for abbrevs? 5055 * Q5.3.9:: Are only certain syntactic character classes available for abbrevs?
5050 * Q5.3.10:: How can I get those oh-so-neat X-Face lines? 5056 * Q5.3.10:: How can I get those oh-so-neat X-Face lines?
5051 * Q5.3.11:: How do I add new Info directories? 5057 * Q5.3.11:: How do I add new Info directories?
5052 * Q5.3.12:: What do I need to change to make printing work? 5058 * Q5.3.12:: What do I need to change to make printing work?
5059
5060 Mathematics:
5061 * Q5.4.1:: What are bignums, ratios, and bigfloats in Lisp?
5062 * Q5.4.2:: XEmacs segfaults when I use very big numbers!
5063 * Q5.4.3:: Bignums are really slow!
5064 * Q5.4.4:: Equal bignums don't compare as equal! What's going on?
5053 @end menu 5065 @end menu
5054 5066
5055 @node Q5.0.1, Q5.0.2, Miscellaneous, Miscellaneous 5067 @node Q5.0.1, Q5.0.2, Miscellaneous, Miscellaneous
5056 @unnumberedsec 5.0: Major & Minor Modes 5068 @unnumberedsec 5.0: Major & Minor Modes
5057 @unnumberedsubsec Q5.0.1: How can I do source code highlighting using font-lock? 5069 @unnumberedsubsec Q5.0.1: How can I do source code highlighting using font-lock?
5797 results using @kbd{M-x profile-results}. It should give you an idea of 5809 results using @kbd{M-x profile-results}. It should give you an idea of
5798 where the time is being spent. 5810 where the time is being spent.
5799 @end quotation 5811 @end quotation
5800 5812
5801 @node Q5.2.1, Q5.2.2, Q5.1.11, Miscellaneous 5813 @node Q5.2.1, Q5.2.2, Q5.1.11, Miscellaneous
5814 @unnumberedsec 5.2: Sound
5802 @unnumberedsubsec Q5.2.1: How do I turn off the sound? 5815 @unnumberedsubsec Q5.2.1: How do I turn off the sound?
5803 5816
5804 Add the following line to your @file{init.el}/@file{.emacs}: 5817 Add the following line to your @file{init.el}/@file{.emacs}:
5805 5818
5806 @lisp 5819 @lisp
6166 6179
6167 Another alternative is to convert the documentation to HTML with 6180 Another alternative is to convert the documentation to HTML with
6168 texi2html and read it from a web browser like Lynx or W3. 6181 texi2html and read it from a web browser like Lynx or W3.
6169 @end quotation 6182 @end quotation
6170 6183
6171 @node Q5.3.12, , Q5.3.11, Miscellaneous 6184 @node Q5.3.12, Q5.4.1, Q5.3.11, Miscellaneous
6172 @unnumberedsubsec Q5.3.12: What do I need to change to make printing work? 6185 @unnumberedsubsec Q5.3.12: What do I need to change to make printing work?
6173 6186
6174 For regular printing there are two variables that can be customized. 6187 For regular printing there are two variables that can be customized.
6175 6188
6176 @table @code 6189 @table @code
6209 @end table 6222 @end table
6210 6223
6211 NOTE: It is an undocumented limitation in XEmacs that postscript 6224 NOTE: It is an undocumented limitation in XEmacs that postscript
6212 printing (the @code{Pretty Print Buffer} menu item) @strong{requires} a 6225 printing (the @code{Pretty Print Buffer} menu item) @strong{requires} a
6213 window system environment. It cannot be used outside of X11. 6226 window system environment. It cannot be used outside of X11.
6227
6228
6229 @node Q5.4.1, Q5.4.2, Q5.3.12, Miscellaneous
6230 @unnumberedsec 5.4: Mathematics
6231 @unnumberedsubsec Q5.4.1: What are bignums, ratios, and bigfloats in Lisp?
6232
6233 Thanks to @email{james@@xemacs.org, Jerry James}, XEmacs 21.5.18 and
6234 later can use the capabilities of multiple-precision libraries that may
6235 be available for your platform. The GNU Multiple Precision (GMP) and
6236 BSD Multiple Precision (MP) libraries are partially supported. GMP
6237 gives you @dfn{bignums} (arbitrary precision integers), @dfn{ratios}
6238 (arbitrary precision fractions), and @dfn{bigfloats} (arbitrary
6239 precision floating point numbers). GNU MP is better-supported by XEmacs
6240 at the time of writing (2004-04-06). BSD MP support does not include
6241 ratios or bigfloats, and it throws errors that aren't understood.
6242
6243 In most cases, bignum support should be transparent to users and Lisp
6244 programmers. A bignum-enabled XEmacs will automatically convert from
6245 fixnums to bignums and back in pure integer arithmetic, and for GNU MP,
6246 from floats to bigfloats. (Bigfloats must be explicitly coerced to
6247 other types, even if they are exactly representable by less precise
6248 types.) The Lisp reader and printer have been enhanced to handle
6249 bignums, as have the mathematical functions. Rationals (fixnums,
6250 bignums, and ratios) are printed using the @samp{%d}, @samp{%o},
6251 @samp{%x}, and @samp{%u} format conversions. The read syntax for ratios
6252 is @samp{3/5}.
6253
6254 User-visible changes in behavior include (in probable order of annoyance)
6255
6256 @itemize
6257 @item
6258 Arithmetic can cause a segfault, depending on your MP library
6259 @ref{Q5.4.2}.
6260
6261 @item
6262 Terminology is not Common-Lisp-conforming. For example, ``integer'' for
6263 Emacs Lisp means what Common Lisp calls ``fixnum''. This issue is being
6264 investigated, but the use of ``integer'' for fixnum is pervasive and may
6265 cause backward-compatibility and GNU-Emacs-compatibility problems.
6266
6267 @item
6268 Many operations that used to cause a range error now succeed, with
6269 intermediate results and return values coerced to bignums as needed.
6270
6271 @item
6272 An atom with ratio read syntax now returns a number, not a symbol.
6273
6274 @item
6275 The @samp{%u} format conversion will now give an error if its argument
6276 is negative. (Without MP, it prints a number which Lisp can't read.)
6277 @end itemize
6278
6279 @emph{Surgeon General's Warning}: The automatic conversions cannot be
6280 disabled at runtime. New functions have been added which produce
6281 ratios, so there should be few surprises with type conflicts, but they
6282 can't be ruled out. ``Arbitrary'' precision means precisely what it
6283 says. If you work with extremely large numbers, your machine may
6284 arbitrarily decide to hand you an unpleasant surprise rather than a
6285 bignum @ref{Q5.4.2}.
6286
6287 To configure with GNU MP, add
6288 @samp{--use-number-lib=gmp}
6289 to your invocation of @file{configure}. For BSD MP, use
6290 @samp{--use-number-lib=mp}.
6291
6292 If you would like to help with bignum support, especially on BSD MP,
6293 please subscribe to the @uref{http://www.xemacs.org/Lists/#xemacs-beta,
6294 XEmacs Beta mailing list}, and book up on @file{number-gmp.h} and
6295 @file{number-mp.h}. Jerry has promised to write internals documentation
6296 eventually, but if your skills run more to analysis and documentation
6297 than to writing new code, feel free to fill in the gap!
6298
6299
6300 @node Q5.4.2, Q5.4.3, Q5.4.1, Miscellaneous
6301 @unnumberedsubsec Q5.4.2: XEmacs segfaults when I use very big numbers!
6302
6303 GMP by default allocates temporaries on the stack. If you run out of
6304 stack space, you're dead; there is no way that we know of to reliably
6305 detect this condition, because @samp{alloca} is typically implemented to
6306 be @emph{fast} rather than robust. If you just need a little more
6307 oomph, use a bigger stack (@emph{e.g.}, the @file{ulimit -s} command in
6308 bash(1)). If you want robustness at the cost of speed, configure GMP
6309 with @samp{--disable-alloca} and rebuild the GMP library.
6310
6311 We do not know whether BSD MP uses @samp{alloca} or not. Please send
6312 any information you have as a bug report (@kbd{M-x report-xemacs-bug
6313 @key{RET}}), which will give us platform information. (We do know that
6314 BSD MP implementations vary across vendors, but how much, we do not know
6315 yet.)
6316
6317
6318 @node Q5.4.3, Q5.4.4, Q5.4.2, Miscellaneous
6319 @unnumberedsubsec Q5.4.3: Bignums are really slow!
6320
6321 Many Linux distributions compile all their packages for the i386, and
6322 this is costly. An optimized version can give you two or three orders
6323 of magnitude better performance for a Pentium III or IV. (Yes, really.
6324 See @uref{http://www.swox.com/gmp/gmp-speed.html}.)
6325
6326
6327 @node Q5.4.4, , Q5.4.3, Miscellaneous
6328 @unnumberedsubsec Q5.4.4: Equal bignums don't compare as equal! What gives?
6329
6330 Ah, Grasshopper, I see you are using @code{(eq x y)}. The Bodhisattva
6331 CLTL2 warned of the illusion that equal numbers would be @samp{eq}!
6332 Meditate on the deeper truths of @samp{eql}, in which numbers of the same
6333 type which have equal values compare equal, and @samp{=}, which does any
6334 necessary type coercions before comparing for equality.
6335
6336 Yeah, yeah, it has always worked for integer types, because fixnums and
6337 characters have an immediate representation. Sorry about that;
6338 arbitrary precision obviously requires consing new objects because the
6339 objects are ``large'' and of variable size, and the definition of
6340 @samp{eq} does not permit different objects to compare as equal.
6341
6214 6342
6215 @node MS Windows, Current Events, Miscellaneous, Top 6343 @node MS Windows, Current Events, Miscellaneous, Top
6216 @unnumbered 6 XEmacs on MS Windows 6344 @unnumbered 6 XEmacs on MS Windows
6217 6345
6218 This is part 6 of the XEmacs Frequently Asked Questions list, written by 6346 This is part 6 of the XEmacs Frequently Asked Questions list, written by
6874 elements). 7002 elements).
6875 7003
6876 7004
6877 7005
6878 @node Q6.4.1, Q6.4.2, Q6.3.4, MS Windows 7006 @node Q6.4.1, Q6.4.2, Q6.3.4, MS Windows
6879 @unnumberedsec 6.3: Troubleshooting 7007 @unnumberedsec 6.4: Troubleshooting
6880 @unnumberedsubsec Q6.4.1 XEmacs won't start on Windows. 7008 @unnumberedsubsec Q6.4.1 XEmacs won't start on Windows.
6881 7009
6882 XEmacs relies on a process called "dumping" to generate a working 7010 XEmacs relies on a process called "dumping" to generate a working
6883 executable. Under MS-Windows this process effectively fixes the memory 7011 executable. Under MS-Windows this process effectively fixes the memory
6884 addresses of information in the executable. When XEmacs starts up it tries 7012 addresses of information in the executable. When XEmacs starts up it tries
7270 @menu 7398 @menu
7271 * Q8.0.1:: Gnus 5.10 won't display smileys in XEmacs 21.1. 7399 * Q8.0.1:: Gnus 5.10 won't display smileys in XEmacs 21.1.
7272 @end menu 7400 @end menu
7273 7401
7274 @node Q8.0.1, , , Legacy Versions 7402 @node Q8.0.1, , , Legacy Versions
7403 @unnumberedsec 8.0 XEmacs 21.1
7275 @unnumberedsubsec Q8.0.1: Gnus 5.10 won't display smileys in XEmacs 21.1. 7404 @unnumberedsubsec Q8.0.1: Gnus 5.10 won't display smileys in XEmacs 21.1.
7276 7405
7277 @email{eeide@@cs.utah.edu, Eric Eide} wrote: 7406 @email{eeide@@cs.utah.edu, Eric Eide} wrote:
7278 7407
7279 @quotation 7408 @quotation