2 ent.c -- Numeric types for SXEmacs
3 Copyright (C) 2004 Jerry James
4 Copyright (C) 2004, 2005, 2006 Sebastian Freundt
6 XEmacs Author: Jerry James
7 Author: Sebastian Freundt
8 Backport: Sebastian Freundt
10 This file is part of SXEmacs
12 SXEmacs is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
17 SXEmacs is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>. */
33 Lisp_Object Qrationalp, Qrealp, Qcomparablep;
34 Lisp_Object Qarchimedeanp, Qnonarchimedeanp;
35 Lisp_Object Qcomplexp, Qgaussianp;
38 Lisp_Object Qoperation_error, Qrelation_error, Qvaluation_error;
40 Lisp_Object Vread_real_as;
41 Fixnum default_real_precision;
42 Fixnum max_real_precision;
43 static Lisp_Object Qunsupported_type;
44 static int number_initialized;
45 Lisp_Object Qoptable_index;
47 #define PREC_D2B_CONST ((double)3.321928094887362)
48 #define PREC_B2D_CONST ((double)0.301029995663981)
50 #define PREC_D2B_UP(x) ((unsigned long)(PREC_D2B_CONST*(x))+1)
51 #define PREC_D2B_DOWN(x) ((unsigned long)(PREC_D2B_CONST*(x)))
52 #define PREC_B2D_UP(x) ((unsigned long)(PREC_B2D_CONST*(x))+1)
53 #define PREC_B2D_DOWN(x) ((unsigned long)(PREC_B2D_CONST*(x)))
55 #define PREC_MIN PREC_D2B_UP(1)
59 /************************* Big Rational Integers ****************************/
61 Lisp_Object Qbignump; /* to be compatible to XE 21.5 */
63 DEFUN ("bignump", Fbignump, 1, 1, 0, /*
64 Return t if OBJECT is a bignum, nil otherwise.
68 return BIGZP (object) ? Qt : Qnil;
71 DEFUN ("bigzp", Fbigzp, 1, 1, 0, /*
72 Return t if OBJECT is a bigz, nil otherwise.
76 return BIGZP (object) ? Qt : Qnil;
80 /********************************* Integers *********************************/
81 /* To remember: integers are the union of all integer-like types. */
82 DEFUN ("integerp", Fintegerp, 1, 1, 0, /*
83 Return t if OBJECT is an integer, nil otherwise.
87 return INTEGERP(object) ? Qt : Qnil;
90 DEFUN ("evenp", Fevenp, 1, 1, 0, /*
91 Return t if INTEGER is even, nil otherwise.
98 CONCHECK_INTEGER(integer);
99 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
101 return bigz_evenp(XBIGZ_DATA(integer)) ? Qt : Qnil;
104 return (XTYPE(integer) == Lisp_Type_Int_Even) ? Qt : Qnil;
110 DEFUN ("oddp", Foddp, 1, 1, 0, /*
111 Return t if INTEGER is odd, nil otherwise.
118 CONCHECK_INTEGER (integer);
119 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
121 return bigz_oddp(XBIGZ_DATA(integer)) ? Qt : Qnil;
124 return (XTYPE(integer) == Lisp_Type_Int_Odd) ? Qt : Qnil;
131 /************************** Rational Integer Fractions **********************/
132 /* bigq objects are derived from quotients of bigz objects. */
133 /* In XE 21.5 bigq is called ratio. */
135 Lisp_Object Qratiop; /* to be compatible to XE 21.5 */
137 DEFUN ("ratiop", Fratiop, 1, 1, 0, /*
138 Return t if OBJECT is a ratio, nil otherwise.
142 return BIGQP(object) ? Qt : Qnil;
145 DEFUN ("bigqp", Fbigqp, 1, 1, 0, /*
146 Return t if OBJECT is a bigq, nil otherwise.
150 return BIGQP(object) ? Qt : Qnil;
154 /********************************* Rationals ********************************/
155 DEFUN ("rationalp", Frationalp, 1, 1, 0, /*
156 Return t if OBJECT is a rational (i.e. a rational integer or a rational
157 quotient), nil otherwise.
161 return RATIONALP(object) ? Qt : Qnil;
164 DEFUN ("numerator", Fnumerator, 1, 1, 0, /*
165 Return the numerator of the canonical form of RATIONAL.
166 If RATIONAL is an integer, RATIONAL is returned.
170 CONCHECK_RATIONAL(rational);
171 #if defined HAVE_MPQ && defined WITH_GMP
172 return BIGQP(rational)
173 ? make_bigz_bz(XBIGQ_NUMERATOR(rational))
180 DEFUN ("denominator", Fdenominator, 1, 1, 0, /*
181 Return the denominator of the canonical form of RATIONAL.
182 If RATIONAL is an integer, 1 is returned.
186 CONCHECK_RATIONAL(rational);
187 #if defined HAVE_MPQ && defined WITH_GMP
188 return BIGQP(rational)
189 ? make_bigz_bz(XBIGQ_DENOMINATOR(rational))
197 /********************************** Bigfs ***********************************/
199 Lisp_Object Qbigfloatp; /* to be compatible to XE 21.5 */
201 DEFUN ("bigfloatp", Fbigfloatp, 1, 1, 0, /*
202 Return t if OBJECT is a bigfloat, nil otherwise.
206 return BIGFP(object) ? Qt : Qnil;
209 DEFUN ("bigfp", Fbigfp, 1, 1, 0, /*
210 Return t if OBJECT is a bigf, nil otherwise.
214 return BIGFP(object) ? Qt : Qnil;
218 /********************************* Floats ***********************************/
220 /* I wanted to define the lrecord implementation here, but that breaks at
221 * Steve's site, so ... :(
226 /********************************** Bigfrs **********************************/
228 #ifndef MPFR_PREC_MIN
229 #define MPFR_PREC_MIN 2UL
231 #ifndef MPFR_PREC_MAX
232 #define MPFR_PREC_MAX 1024UL
237 DEFUN ("bigfrp", Fbigfrp, 1, 1, 0, /*
238 Return t if OBJECT is a bigfr, nil otherwise.
242 return BIGFRP(object) ? Qt : Qnil;
246 /********************************** Reals ***********************************/
247 DEFUN ("realp", Frealp, 1, 1, 0, /*
248 Return t if OBJECT is a real, nil otherwise.
252 return REALP(object) ? Qt : Qnil;
256 default_real_precision_changed (Lisp_Object sym, Lisp_Object *val,
257 Lisp_Object in_object,
262 CONCHECK_INTEGER(*val);
263 prec = internal_get_precision(*val);
264 #if defined HAVE_MPF && defined WITH_GMP
266 bigf_set_default_prec(prec);
268 #if defined HAVE_MPFR && defined WITH_MPFR
270 bigfr_set_default_prec(prec);
276 if (in_object == Qnil);
280 DEFUN("real", Freal, 1, 2, 0, /*
281 Return the real number numerically equal to NUMBER with
282 respect to the variable `read-real-as'.
283 If optional argument PRECISION is non-nil, its value
284 \(an integer\) is used as precision.
288 if (Vread_real_as == Qbigfr) {
289 #if defined HAVE_MPFR && defined WITH_MPFR
290 return Fcoerce_number(number, Qbigfr, precision);
291 #else /* !HAVE_MPFR */
293 #endif /* HAVE_MPFR */
296 if (Vread_real_as == Qbigf) {
297 #if defined HAVE_MPF && defined WITH_GMP
298 return Fcoerce_number(number, Qbigf, precision);
299 #else /* !HAVE_MPF */
301 #endif /* HAVE_MPF */
304 /* fallback to 'float */
305 return Fcoerce_number(number, Qfloat, precision);
309 /******************************** Comparables *******************************/
310 DEFUN ("comparablep", Fcomparablep, 1, 1, 0, /*
311 Return t if OBJECT is a comparable number, nil otherwise.
313 We call a number comparable if there exists a total (archimedean)
314 order on the underlying structure.
318 return COMPARABLEP(object) ? Qt : Qnil;
323 /********************************** Biggs ***********************************/
326 DEFUN ("biggp", Fbiggp, 1, 1, 0, /*
327 Return t if OBJECT is a bigg (a gaussian number), nil otherwise.
331 return BIGGP(object) ? Qt : Qnil;
335 /********************************** Bigcs ***********************************/
338 DEFUN ("bigcp", Fbigcp, 1, 1, 0, /*
339 Return t if OBJECT is a bigc, nil otherwise.
343 return BIGCP(object) ? Qt : Qnil;
347 /******************************* Complex nums *******************************/
348 DEFUN ("complexp", Fcomplexp, 1, 1, 0, /*
349 Return t if OBJECT is a complex number (i.e. either a bigc
350 or a bigg), nil otherwise.
354 return COMPLEXP(object) ? Qt : Qnil;
359 /********************************** Quaterns ********************************/
360 Lisp_Object Qquaternp;
362 DEFUN ("quaternp", Fquaternp, 1, 1, 0, /*
363 Return t if OBJECT is a quaternion, nil otherwise.
367 return QUATERNP(object) ? Qt : Qnil;
372 /******************************* Archimedeans *******************************/
373 DEFUN ("archimedeanp", Farchimedeanp, 1, 1, 0, /*
374 Return t if OBJECT is a number with an archimedean valuation, nil otherwise.
378 return ARCHIMEDEANP(object) ? Qt : Qnil;
382 /***************************** Non-Archimedeans *****************************/
383 DEFUN ("nonarchimedeanp", Fnonarchimedeanp, 1, 1, 0, /*
384 Return t if OBJECT is a number with a non-archimedean valuation, nil
389 return NONARCHIMEDEANP(object) ? Qt : Qnil;
393 /******************************** Indefinite Symbols ************************/
394 Lisp_Object Qinfinityp, Qindefinitep;
396 DEFUN("indefinitep", Findefinitep, 1, 1, 0, /*
397 Return t if OBJECT is an indefinite symbol, nil otherwise.
401 return INDEFP(object) ? Qt : Qnil;
404 DEFUN ("infinityp", Finfinityp, 1, 1, 0, /*
405 Return t if OBJECT is a form of infinity, nil otherwise.
409 return INFINITYP(object) ? Qt : Qnil;
413 /********************************* Numbers **********************************/
414 DEFUN ("canonicalize-number", Fcanonicalize_number, 1, 1, 0, /*
415 Return the canonical form of NUMBER. DEPRECATED FUNCTION.
419 /* The tests should go in order from larger, more expressive, or more
420 complex types to smaller, less expressive, or simpler types so that a
421 number can cascade all the way down to the simplest type if
423 #if defined HAVE_MPQ && defined WITH_GMP
425 return ent_mpq_downgrade_maybe(XBIGQ_DATA(number));
427 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
429 return ent_mpz_downgrade_maybe(XBIGZ_DATA(number));
431 #if defined HAVE_MPFR && defined WITH_MPFR
433 return ent_mpfr_wipe_indef(XBIGFR_DATA(number));
438 /* new ase optable magic */
439 static dllist_t ase_optable_freelist;
442 ase_optable_freelist_init(void)
445 ase_optable_freelist = make_noseeum_dllist();
446 for (i = 0; i < lrecord_first_ent_type; i++) {
447 dllist_append(ase_optable_freelist, (void*)i);
451 int ase_optable_add(Lisp_Object typesym)
453 /* TYPESYM should be a symbol as used in dynacats */
454 long int *foo = dllist_pop_car(ase_optable_freelist);
455 long int idx = (long int)foo;
456 Fput(typesym, Qoptable_index, make_int(idx));
460 void ase_optable_del(Lisp_Object typesym)
462 /* TYPESYM should be a symbol as used in dynacats */
463 long int idx = (long int)ase_optable_index_typesym(typesym);
464 dllist_append(ase_optable_freelist, (void*)idx);
468 int ase_optable_index(Lisp_Object arg)
470 switch ((unsigned int)XTYPE(arg)) {
471 case Lisp_Type_Record: {
472 enum lrecord_type type =
473 XRECORD_LHEADER_IMPLEMENTATION(arg)->lrecord_type_index;
475 switch ((unsigned int)type) {
476 case lrecord_type_marker:
478 case lrecord_type_dynacat:
479 assert(SYMBOLP(XDYNACAT_TYPE(arg)));
480 /* must be an dynacat */
481 /* now we've got two options, either compute a
482 * hash-value from the symbol's address
483 * or store a cookie in the plist of the symbol
484 * for the moment, we prefer the latter option
486 return ase_optable_index_typesym(XDYNACAT_TYPE(arg));
494 return -1; /* Should not reach here */
498 ase_optable_index_typesym(Lisp_Object typesym)
500 Lisp_Object idx = Fget(typesym, Qoptable_index, Qnil);
501 assert(INTEGERP(idx));
505 /* categorial subtleties */
506 dllist_t ase_empty_sets = 0;
507 Lisp_Object Qase_empty_sets;
512 ent_normalise_number(Lisp_Object number)
515 return make_int(XCHAR(number));
516 else if (MARKERP(number))
517 return make_int(marker_position(number));
523 unsigned long ent_normalise_precision(unsigned long precision)
525 /* MPFR will slaughter us when we pass a precision < MPFR_PREC_MIN */
526 if (precision < MPFR_PREC_MIN)
527 return default_real_precision;
528 if (precision > MPFR_PREC_MAX)
529 return max_real_precision;
534 /* Convert NUMBER to type TYPE. If TYPE is BIGF_T then use the indicated
535 PRECISION; otherwise, PRECISION is ignored. */
537 internal_coerce_number (Lisp_Object o,
538 ase_object_type_t type,
539 unsigned long precision)
541 struct ent_lift_args_s la;
543 la.precision = ent_normalise_precision(precision);
545 return ent_lift(o, type, &la);
550 internal_get_precision(Lisp_Object precision)
552 unsigned long susp_prec = 0;
554 if (NILP(precision) && default_real_precision > 0) {
555 susp_prec = default_real_precision;
556 } else if (INTP(precision)) {
557 susp_prec = XUINT(precision);
558 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
559 } else if (BIGZP(precision)) {
560 if (!bigz_fits_ulong_p(XBIGZ_DATA(precision)))
561 susp_prec = max_real_precision;
563 susp_prec = bigz_to_ulong(XBIGZ_DATA(precision));
566 susp_prec = default_real_precision;
569 /* final comparison */
570 if (susp_prec < MPFR_PREC_MIN)
571 return MPFR_PREC_MIN;
572 else if (susp_prec > MPFR_PREC_MAX)
573 return MPFR_PREC_MAX;
578 DEFUN("coerce-number", Fcoerce_number, 2, 3, 0, /*
579 Convert NUMBER to the indicated type, possibly losing information.
582 TYPE is one of the symbols:
583 - 'fixnum or 'int to convert to built-in integers
584 - 'bigz or 'bignum to convert to bigz integers
585 - 'integer to convert to the most suitable type out of
588 - 'bigq or 'ratio to convert to bigq fractions
589 - 'rational to convert to the most suitable type out of
592 - 'float to convert to built-in floats
593 - 'bigf or 'bigfloat to convert to bigf floats
594 - 'bigfr to convert to bigfr floats
595 - 'real to convert to the type indicated by
596 `read-real-as' with a fallback to 'float
598 - 'bigg to convert to a Gaussian
599 - 'bigc to convert to a bigc complex number
601 - 'quatern to convert to a Quaternion
603 NOTE: Not all of these types may be supported.
605 PRECISION is the number of bits of precision to use when converting to
606 reals; it is ignored otherwise. If nil, the default precision is used.
608 Note that some conversions lose information. No error is signaled in such
609 cases; the information is silently lost.
611 (number, type, precision))
613 struct ent_lift_args_s la;
617 if (EQ(type, Qint) || EQ(type, Qfixnum))
618 return internal_coerce_number(number, INT_T, 0UL);
619 else if (EQ(type, Qinteger)) {
620 /* If bignums are available, we always convert to one first,
621 then downgrade to a int if possible. */
622 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
623 return Fcanonicalize_number(
624 ent_lift(number, BIGZ_T, NULL));
626 return ent_lift(number, INT_T, NULL);
627 #endif /* HAVE_MPZ */
629 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
630 else if (EQ(type, Qbigz) || EQ(type, Qbignum)) {
631 /* always convert to bigz */
632 return ent_lift(number, BIGZ_T, NULL);
635 #if defined HAVE_MPQ && defined WITH_GMP
636 else if (EQ(type, Qrational)) {
637 /* convert to bigq and canonicalise */
638 return Fcanonicalize_number(
639 ent_lift(number, BIGQ_T, NULL));
641 } else if (EQ(type, Qbigq) || EQ(type, Qratio)) {
642 /* always convert to bigq */
643 return ent_lift(number, BIGQ_T, NULL);
645 #endif /* HAVE_MPQ */
647 else if (EQ(type, Qfloat))
648 return ent_lift(number, FLOAT_T, NULL);
650 #if defined HAVE_MPF && defined WITH_GMP
651 else if (EQ(type, Qbigf) || EQ(type, Qbigfloat)) {
652 la.precision = internal_get_precision(precision);
653 return ent_lift(number, BIGF_T, &la);
655 #endif /* HAVE_MPF */
656 #if defined HAVE_MPFR && defined WITH_MPFR
657 else if (EQ(type, Qbigfr)) {
658 la.precision = internal_get_precision(precision);
659 return ent_lift(number, BIGFR_T, &la);
661 #endif /* HAVE_MPFR */
662 else if (EQ(type, Qreal)) {
663 /* respect `read-real-as' */
664 la.precision = internal_get_precision(precision);
666 #if defined HAVE_MPF && defined WITH_GMP
667 else if(Vread_real_as == Qbigf)
668 return ent_lift(number, BIGF_T, &la);
670 #if defined HAVE_MPFR && defined WITH_MPFR
671 else if (Vread_real_as == Qbigfr)
672 return ent_lift(number, BIGFR_T, &la);
675 return ent_lift(number, FLOAT_T, &la);
677 #if defined(HAVE_PSEUG) && defined WITH_PSEUG
678 else if (EQ(type, Qbigg)) { /* || EQ(type, Qcomplex)) { */
679 return ent_lift(number, BIGG_T, NULL);
681 #endif /* HAVE_PSEUG */
682 #if defined HAVE_MPC && defined WITH_MPC || \
683 defined HAVE_PSEUC && defined WITH_PSEUC
684 else if (EQ(type, Qbigc)) { /* || EQ(type, Qcomplex)) { */
685 la.precision = internal_get_precision(precision);
686 return ent_lift(number, BIGC_T, &la);
688 #endif /* HAVE_MPC */
689 #if defined HAVE_QUATERN && defined WITH_QUATERN
690 else if (EQ(type, Qquatern)) {
691 la.precision = internal_get_precision(precision);
692 return ent_lift(number, QUATERN_T, &la);
694 #endif /* HAVE_QUATERN */
696 Fsignal(Qunsupported_type, Qnil);
702 /************************ Auxiliary Stuff **************************/
704 DEFUN("dump-ase-types", Fdump_ase_types, 0, 0, 0, /*
708 ENT_CRITICAL("int:64\n");
709 ENT_CRITICAL("bigz:%d\n", lrecord_type_bigz);
710 ENT_CRITICAL("bigq:%d\n", lrecord_type_bigq);
711 ENT_CRITICAL("bigf:%d\n", lrecord_type_bigf);
712 ENT_CRITICAL("bigfr:%d\n", lrecord_type_bigfr);
713 ENT_CRITICAL("float:%d\n", lrecord_type_float);
714 ENT_CRITICAL("bigg:%d\n", lrecord_type_bigg);
715 ENT_CRITICAL("bigc:%d\n", lrecord_type_bigc);
716 ENT_CRITICAL("quatern:%d\n", lrecord_type_quatern);
717 ENT_CRITICAL("indef:%d\n", lrecord_type_indef);
719 ENT_CRITICAL("last:%d\n", lrecord_type_last_built_in_type);
725 /******************************* op tables ****************************/
728 initialise_operation_tables(void)
730 /* new optable magic */
731 ase_optable_freelist_init();
732 ase_nullary_optable_init();
733 ase_unary_optable_init();
734 ase_binary_optable_init();
735 ase_unary_reltable_init();
736 ase_binary_reltable_init();
737 ase_lifttable_init();
740 void init_ent_optables(void)
742 initialise_operation_tables();
744 init_optables_INDEF_T();
745 init_optables_INT_T();
747 init_optables_FLOAT_T();
749 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
750 init_optables_BIGZ_T();
752 #if defined HAVE_MPQ && defined WITH_GMP
753 init_optables_BIGQ_T();
755 #if defined HAVE_MPF && defined WITH_GMP
756 init_optables_BIGF_T();
758 #if defined HAVE_MPFR && defined WITH_MPFR
759 init_optables_BIGFR_T();
761 #if defined HAVE_MPC && defined WITH_MPC || \
762 defined HAVE_PSEUC && defined WITH_PSEUC
763 init_optables_BIGC_T();
765 #if defined HAVE_PSEUG && defined WITH_PSEUG
766 init_optables_BIGG_T();
768 #if defined HAVE_QUATERN && defined WITH_QUATERN
769 init_optables_QUATERN_T();
774 void syms_of_ent(void)
779 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
782 #if defined HAVE_MPQ && defined WITH_GMP
785 #if defined HAVE_MPF && defined WITH_GMP
791 #if defined HAVE_MPFR && defined WITH_MPFR
794 #if defined HAVE_MPC && defined WITH_MPC || \
795 defined HAVE_PSEUC && defined WITH_PSEUC
798 #if defined HAVE_PSEUG && defined WITH_PSEUG
799 syms_of_ent_gaussian();
801 #if defined HAVE_QUATERN && defined WITH_QUATERN
802 syms_of_ent_quatern();
805 /* Type predicates */
811 DEFSYMBOL(Qrationalp);
813 DEFSYMBOL(Qbigfloatp);
817 DEFSYMBOL(Qcomparablep);
821 DEFSYMBOL(Qquaternp);
823 DEFSYMBOL(Qinfinityp);
824 DEFSYMBOL(Qindefinitep);
826 DEFSYMBOL(Qarchimedeanp);
827 DEFSYMBOL(Qnonarchimedeanp);
829 /* some error categories */
830 DEFERROR(Qoperation_error,
831 "Operation undefined over domain", Qarith_error);
832 DEFERROR(Qrelation_error,
833 "Relation undefined over domain", Qarith_error);
834 DEFERROR(Qvaluation_error,
835 "Valuation undefined over domain", Qarith_error);
847 DEFSUBR(Fdenominator);
858 DEFSUBR(Fcomparablep);
867 DEFSUBR(Farchimedeanp);
868 DEFSUBR(Fnonarchimedeanp);
871 DEFSUBR(Findefinitep);
873 DEFSUBR(Fcanonicalize_number);
874 DEFSUBR(Fcoerce_number);
876 DEFSUBR(Fdump_ase_types);
878 DEFSYMBOL(Qoptable_index);
881 DEFERROR_STANDARD(Qunsupported_type, Qwrong_type_argument);
883 /* Operation Tables */
885 syms_of_ent_nullary_op();
886 syms_of_ent_unary_op();
887 syms_of_ent_binary_op();
888 syms_of_ent_unary_rel();
889 syms_of_ent_binary_rel();
893 void vars_of_ent(void)
895 Fprovide(intern("number-types"));
896 Fprovide(intern("ent"));
901 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
904 #if defined HAVE_MPQ && defined WITH_GMP
907 #if defined HAVE_MPF && defined WITH_GMP
913 #if defined HAVE_MPFR && defined WITH_MPFR
916 #if defined HAVE_MPC && defined WITH_MPC || \
917 defined(HAVE_PSEUC) && defined WITH_PSEUC
920 #if defined HAVE_PSEUG && defined WITH_PSEUG
921 vars_of_ent_gaussian();
923 #if defined HAVE_QUATERN && defined WITH_QUATERN
924 vars_of_ent_quatern();
927 max_real_precision = EMACS_INT_MAX;
929 DEFVAR_CONST_INT("max-real-precision", &max_real_precision /*
930 The maximum number of bits of precision a bigf or bigfr can have.
931 This is determined by the underlying library used to implement
932 arbitrary-precision floats.
935 DEFVAR_LISP("read-real-as", &Vread_real_as /*
936 *Indicate how real numbers should be read.
937 If set to `nil' or 'float, reals are always converted to floats.
938 If set to 'bigf or 'bigfr, reals are read as MPF floats or MPFR
941 Vread_real_as = Qfloat;
943 default_real_precision = 128;
944 DEFVAR_INT_MAGIC("default-real-precision",
945 &default_real_precision, /*
946 *The default floating-point precision for newly created
947 floating point values.
948 This should be an unsigned integer no greater than
949 `maximum-real-precision' to create external floats
950 with the indicated precision.
952 This variable is effective only when `read-real-as'
953 is set to a float type which supports setting a
956 default_real_precision_changed);
958 vars_of_ent_nullary_op();
959 vars_of_ent_unary_op();
960 vars_of_ent_binary_op();
961 vars_of_ent_unary_rel();
962 vars_of_ent_binary_rel();
970 if (!number_initialized) {
971 number_initialized = 1;
978 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
981 #if defined HAVE_MPQ && defined WITH_GMP
984 #if defined HAVE_MPF && defined WITH_GMP
987 #if defined HAVE_MPFR && defined WITH_MPFR
990 #if defined HAVE_MPC && defined WITH_MPC || \
991 defined HAVE_PSEUC && defined WITH_PSEUC
994 #if defined HAVE_PSEUG && defined WITH_PSEUG
997 #if defined HAVE_QUATERN && defined WITH_QUATERN
1002 /* promote our empty sets */
1003 ase_empty_sets = make_noseeum_dllist();
1006 /* ent.c ends here */