comparison src/number.c @ 4957:db2db229ee82

merge
author Ben Wing <ben@xemacs.org>
date Thu, 28 Jan 2010 02:48:45 -0600
parents 19a72041c5ed 1e9078742fa7
children bd169a24a554
comparison
equal deleted inserted replaced
4956:3461165c79be 4957:db2db229ee82
30 #define USED_IF_BIGFLOAT(decl) UNUSED (decl) 30 #define USED_IF_BIGFLOAT(decl) UNUSED (decl)
31 #endif 31 #endif
32 32
33 Lisp_Object Qrationalp, Qfloatingp, Qrealp; 33 Lisp_Object Qrationalp, Qfloatingp, Qrealp;
34 Lisp_Object Vdefault_float_precision; 34 Lisp_Object Vdefault_float_precision;
35 Fixnum Vmost_negative_fixnum, Vmost_positive_fixnum; 35
36 static Lisp_Object Qunsupported_type; 36 static Lisp_Object Qunsupported_type;
37 static Lisp_Object Vbigfloat_max_prec; 37 static Lisp_Object Vbigfloat_max_prec;
38 static int number_initialized; 38 static int number_initialized;
39 39
40 #ifdef HAVE_BIGNUM 40 #ifdef HAVE_BIGNUM
134 Return t if OBJECT is a bignum, nil otherwise. 134 Return t if OBJECT is a bignum, nil otherwise.
135 */ 135 */
136 (object)) 136 (object))
137 { 137 {
138 return BIGNUMP (object) ? Qt : Qnil; 138 return BIGNUMP (object) ? Qt : Qnil;
139 }
140
141
142 /********************************* Integers *********************************/
143 DEFUN ("integerp", Fintegerp, 1, 1, 0, /*
144 Return t if OBJECT is an integer, nil otherwise.
145 */
146 (object))
147 {
148 return INTEGERP (object) ? Qt : Qnil;
149 }
150
151 DEFUN ("evenp", Fevenp, 1, 1, 0, /*
152 Return t if INTEGER is even, nil otherwise.
153 */
154 (integer))
155 {
156 CONCHECK_INTEGER (integer);
157 return (BIGNUMP (integer)
158 ? bignum_evenp (XBIGNUM_DATA (integer))
159 : XTYPE (integer) == Lisp_Type_Int_Even) ? Qt : Qnil;
160 }
161
162 DEFUN ("oddp", Foddp, 1, 1, 0, /*
163 Return t if INTEGER is odd, nil otherwise.
164 */
165 (integer))
166 {
167 CONCHECK_INTEGER (integer);
168 return (BIGNUMP (integer)
169 ? bignum_oddp (XBIGNUM_DATA (integer))
170 : XTYPE (integer) == Lisp_Type_Int_Odd) ? Qt : Qnil;
171 } 139 }
172 140
173 141
174 /********************************** Ratios **********************************/ 142 /********************************** Ratios **********************************/
175 #ifdef HAVE_RATIO 143 #ifdef HAVE_RATIO
808 DEFSYMBOL (Qratiop); 776 DEFSYMBOL (Qratiop);
809 DEFSYMBOL (Qbigfloatp); 777 DEFSYMBOL (Qbigfloatp);
810 778
811 /* Functions */ 779 /* Functions */
812 DEFSUBR (Fbignump); 780 DEFSUBR (Fbignump);
813 DEFSUBR (Fintegerp);
814 DEFSUBR (Fevenp);
815 DEFSUBR (Foddp);
816 DEFSUBR (Fratiop); 781 DEFSUBR (Fratiop);
817 DEFSUBR (Frationalp); 782 DEFSUBR (Frationalp);
818 DEFSUBR (Fnumerator); 783 DEFSUBR (Fnumerator);
819 DEFSUBR (Fdenominator); 784 DEFSUBR (Fdenominator);
820 DEFSUBR (Fbigfloatp); 785 DEFSUBR (Fbigfloatp);
853 Vbigfloat_max_prec = make_int (EMACS_INT_MAX); 818 Vbigfloat_max_prec = make_int (EMACS_INT_MAX);
854 #else 819 #else
855 Vbigfloat_max_prec = make_int (0); 820 Vbigfloat_max_prec = make_int (0);
856 #endif /* HAVE_BIGFLOAT */ 821 #endif /* HAVE_BIGFLOAT */
857 822
858 DEFVAR_CONST_INT ("most-negative-fixnum", &Vmost_negative_fixnum /*
859 The fixnum closest in value to negative infinity.
860 */);
861 Vmost_negative_fixnum = EMACS_INT_MIN;
862
863 DEFVAR_CONST_INT ("most-positive-fixnum", &Vmost_positive_fixnum /*
864 The fixnum closest in value to positive infinity.
865 */);
866 Vmost_positive_fixnum = EMACS_INT_MAX;
867
868 Fprovide (intern ("number-types")); 823 Fprovide (intern ("number-types"));
869 #ifdef HAVE_BIGNUM 824 #ifdef HAVE_BIGNUM
870 Fprovide (intern ("bignum")); 825 Fprovide (intern ("bignum"));
871 #endif 826 #endif
872 #ifdef HAVE_RATIO 827 #ifdef HAVE_RATIO