Mercurial > hg > xemacs-beta
comparison man/xemacs-faq.texi @ 5739:a2912073be85
Support bignums with MPIR. Add documentation on the bignum, ratio,
and bigfloat implementations. See xemacs-patches message with ID
<CAHCOHQkytZao7Uk9ggeo1HKKJtN1bqO054X2mPsGYyQFjbHrZA@mail.gmail.com>
and following messages.
author | Jerry James <james@xemacs.org> |
---|---|
date | Wed, 19 Jun 2013 09:30:30 -0600 |
parents | 40a52efbf3a3 |
children | d11efddf3617 |
comparison
equal
deleted
inserted
replaced
5738:f6af091ac654 | 5739:a2912073be85 |
---|---|
7948 @node Q7.2.1, Q7.2.2, Q7.1.11, Advanced | 7948 @node Q7.2.1, Q7.2.2, Q7.1.11, Advanced |
7949 @unnumberedsubsec Q7.2.1: What are bignums, ratios, and bigfloats in Lisp? | 7949 @unnumberedsubsec Q7.2.1: What are bignums, ratios, and bigfloats in Lisp? |
7950 | 7950 |
7951 Thanks to @email{james@@xemacs.org, Jerry James}, XEmacs 21.5.18 and | 7951 Thanks to @email{james@@xemacs.org, Jerry James}, XEmacs 21.5.18 and |
7952 later can use the capabilities of multiple-precision libraries that may | 7952 later can use the capabilities of multiple-precision libraries that may |
7953 be available for your platform. The GNU Multiple Precision (GMP) and | 7953 be available for your platform. The GNU Multiple Precision (GMP), |
7954 BSD Multiple Precision (MP) libraries are partially supported. GMP | 7954 Multiple Precision Integers and Rationals (MPIR), and BSD Multiple |
7955 gives you @dfn{bignums} (arbitrary precision integers), @dfn{ratios} | 7955 Precision (MP) libraries are supported. GMP and MPIR give you |
7956 (arbitrary precision fractions), and @dfn{bigfloats} (arbitrary | 7956 @dfn{bignums} (arbitrary precision integers), @dfn{ratios} (arbitrary |
7957 precision floating point numbers). GNU MP is better-supported by XEmacs | 7957 precision fractions), and @dfn{bigfloats} (arbitrary precision floating |
7958 at the time of writing (2004-04-06). BSD MP support does not include | 7958 point numbers). GMP and MPIR are better-supported by XEmacs. BSD MP |
7959 ratios or bigfloats, and it throws errors that aren't understood. | 7959 support does not include ratios or bigfloats. |
7960 | 7960 |
7961 In most cases, bignum support should be transparent to users and Lisp | 7961 In most cases, bignum support should be transparent to users and Lisp |
7962 programmers. A bignum-enabled XEmacs will automatically convert from | 7962 programmers. A bignum-enabled XEmacs will automatically convert from |
7963 fixnums to bignums and back in pure integer arithmetic, and for GNU MP, | 7963 fixnums to bignums and back in pure integer arithmetic, and for GMP and |
7964 from floats to bigfloats. (Bigfloats must be explicitly coerced to | 7964 MPIR, from floats to bigfloats. (Bigfloats must be explicitly coerced |
7965 other types, even if they are exactly representable by less precise | 7965 to other types, even if they are exactly representable by less precise |
7966 types.) The Lisp reader and printer have been enhanced to handle | 7966 types.) The Lisp reader and printer have been enhanced to handle |
7967 bignums, as have the mathematical functions. Rationals (fixnums, | 7967 bignums, as have the mathematical functions. Rationals (fixnums, |
7968 bignums, and ratios) are printed using the @samp{%d}, @samp{%o}, | 7968 bignums, and ratios) are printed using the @samp{%d}, @samp{%o}, |
7969 @samp{%x}, and @samp{%u} format conversions. The read syntax for ratios | 7969 @samp{%x}, and @samp{%u} format conversions. The read syntax for ratios |
7970 is @samp{3/5}. | 7970 is @samp{3/5}. |
8000 can't be ruled out. ``Arbitrary'' precision means precisely what it | 8000 can't be ruled out. ``Arbitrary'' precision means precisely what it |
8001 says. If you work with extremely large numbers, your machine may | 8001 says. If you work with extremely large numbers, your machine may |
8002 arbitrarily decide to hand you an unpleasant surprise rather than a | 8002 arbitrarily decide to hand you an unpleasant surprise rather than a |
8003 bignum @ref{Q7.2.2, XEmacs segfaults when I use very big numbers!}. | 8003 bignum @ref{Q7.2.2, XEmacs segfaults when I use very big numbers!}. |
8004 | 8004 |
8005 To configure with GNU MP, add @samp{--use-number-lib=gmp} | 8005 To configure with GMP, add @samp{--enable-bignum=gmp} to your invocation |
8006 (@samp{--enable-bignum=gmp} in 21.5 or later) to your invocation of | 8006 of @file{configure}. For MPIR, use @samp{--enable-bignum=mpir}. For |
8007 @file{configure}. For BSD MP, use @samp{--use-number-lib=mp} | 8007 BSD MP, use @samp{--enable-bignum=mp}. |
8008 (@samp{--enable-bignum=mp} for 21.5). | |
8009 | |
8010 If you would like to help with bignum support, especially on BSD MP, | |
8011 please subscribe to the @uref{http://www.xemacs.org/Lists/#xemacs-beta, | |
8012 XEmacs Beta mailing list}, and book up on @file{number-gmp.h} and | |
8013 @file{number-mp.h}. Jerry has promised to write internals documentation | |
8014 eventually, but if your skills run more to analysis and documentation | |
8015 than to writing new code, feel free to fill in the gap! | |
8016 | 8008 |
8017 | 8009 |
8018 @node Q7.2.2, Q7.2.3, Q7.2.1, Advanced | 8010 @node Q7.2.2, Q7.2.3, Q7.2.1, Advanced |
8019 @unnumberedsubsec Q7.2.2: XEmacs segfaults when I use very big numbers! | 8011 @unnumberedsubsec Q7.2.2: XEmacs segfaults when I use very big numbers! |
8020 | 8012 |
8034 | 8026 |
8035 | 8027 |
8036 @node Q7.2.3, Q7.2.4, Q7.2.2, Advanced | 8028 @node Q7.2.3, Q7.2.4, Q7.2.2, Advanced |
8037 @unnumberedsubsec Q7.2.3: Bignums are really slow! | 8029 @unnumberedsubsec Q7.2.3: Bignums are really slow! |
8038 | 8030 |
8039 Many Linux distributions compile all their packages for the i386, and | 8031 Many Unix and Linux distributions compile all packages for a generic |
8040 this is costly. An optimized version can give you two or three orders | 8032 version of the supported CPU, and this is costly. An optimized version |
8041 of magnitude better performance for a Pentium III or IV. (Yes, really. | 8033 can improve responiveness dramatically; see |
8042 See @uref{http://www.swox.com/gmp/gmp-speed.html}.) | 8034 @uref{http://gmplib.org/gmpbench.html}.) |
8043 | 8035 |
8044 | 8036 |
8045 @node Q7.2.4, , Q7.2.3, Advanced | 8037 @node Q7.2.4, , Q7.2.3, Advanced |
8046 @unnumberedsubsec Q7.2.4: Equal bignums don't compare as equal! What gives? | 8038 @unnumberedsubsec Q7.2.4: Equal bignums don't compare as equal! What gives? |
8047 | 8039 |