noinst_LIBRARIES=libent.a
-#
+#
# Help the SXEmacs developers get nice post-processed source files
## Create preprocessor output (debugging purposes only)
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
numerically greater than the first, and the third, must be numerically
greater than the second, and so on. At least one argument is required.
-The arguments may be numbers, characters or markers.
+The arguments may be numbers, characters or markers.
*/
(int nargs, Lisp_Object *args))
{
The value is always a number; markers and characters are converted
to numbers.
*/
- (int nargs, Lisp_Object *args))
+ (int nargs, Lisp_Object *args))
{
REGISTER int i, maxindex;
Lisp_Object compmax, compi;
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
void vars_of_ent_float(void)
{
fpfloat f = 0.0, fp = 0.0;
-
+
f = 1.0;
while ( (f > fp) &&
(f = 2.0 * (fp = f)) &&
Bufbyte *intg_str;
Bufbyte *imag_str;
int intg_len, imag_len;
- int sign, neg;
+ int sign, neg;
intg_str = (Bufbyte*)bigz_to_string(bigg_re(g), base);
imag_str = (Bufbyte*)bigz_to_string(bigg_im(g), base);
/* void bigc_set_bigg(bigc c, bigg g)
* {
- * bigc_set_bigfr_bigfr(bigg_re(g), z1);
+ * bigc_set_bigfr_bigfr(bigg_re(g), z1);
* }
*/
/* jump over a leading minus */
cp++;
}
-
+
while ((*cp >= '0' && *cp <= '9'))
cp++;
}
static const struct lrecord_description bigz_description[] = {
- { XD_OPAQUE_DATA_PTR, offsetof(Lisp_Bigz, data) },
+ { XD_OPAQUE_DATA_PTR, offsetof(Lisp_Bigz, data) },
{ XD_END }
};
static const struct lrecord_description bigq_description[] = {
{ XD_OPAQUE_DATA_PTR, offsetof (Lisp_Bigq, data) },
- { XD_END }
+ { XD_END }
};
DEFINE_BASIC_LRECORD_IMPLEMENTATION("bigq", bigq,
bigz bz;
bigz_init(bz);
-
+
/* MPZ bigz_set_string has no effect
* with initial + sign */
if (*cp == '+') {
- If p has a '+' sign after the '/' (e.g., 300/+400), it sets the
numerator from the string, but *leaves the denominator unchanged*.
- If p has trailing nonnumeric characters, it sets the numerator from
- the string, but leaves the denominator unchanged.
+ the string, but leaves the denominator unchanged.
- If p has more than one '/', (e.g., 1/2/3), then it sets the
- numerator from the string, but leaves the denominator unchanged.
+ numerator from the string, but leaves the denominator unchanged.
Therefore, move p past any leading '+' signs, temporarily drop a null
after the numeric characters we are trying to convert, and then put
return make_indef(NOT_A_NUMBER);
}
}
-static Lisp_Object
+static Lisp_Object
indef_div(Lisp_Object l, Lisp_Object r)
{
if (INDEFP(l) && INDEFP(r))
} else if (COMPARABLEP(l) && INDEFP(r)) {
if (!COMPARABLE_INDEF_P(r))
return r;
- else
+ else
return Qzero;
} else if (INFINITYP(l) || INFINITYP(r)) {
return make_indef(COMPLEX_INFINITY);
#define indef_data(f) ((f)->data)
#define XINDEF_DATA(x) indef_data(XINDEF(x))
-#define INFINITYP(x) \
+#define INFINITYP(x) \
(INDEFP(x) && (XINDEF_DATA(x) < END_OF_INFINITIES))
-#define COMPARABLE_INDEF_P(x) \
+#define COMPARABLE_INDEF_P(x) \
(INFINITYP(x) && (XINDEF_DATA(x) < END_OF_COMPARABLE_INFINITIES))
-#define INFINITE_POINT_P(x) \
+#define INFINITE_POINT_P(x) \
(INFINITYP(x) && (XINDEF_DATA(x) > END_OF_COMPARABLE_INFINITIES))
#define NOT_A_NUMBER_P(x) \
(INDEFP(x) && (XINDEF_DATA(x) > END_OF_INFINITIES))
Copyright (C) 2006 Nelson Ferreira
Author: Sebastian Freundt
- Nelson Ferreira
+ Nelson Ferreira
This file is part of SXEmacs
#if defined HAVE_MATHS_SIGNBIT || defined HAVE_SIGNBIT
# define sxe_signbit signbit
#elif defined HAVE_MATHS_FPCLASS || defined HAVE_FPCLASS
-# define sxe_signbit(x) (fpclass(x) == FP_NINF || fpclass(x) == FP_NDENORM || fpclass(x) == FP_NZERO || fpclass(x) == FP_NNORM)
+# define sxe_signbit(x) (fpclass(x) == FP_NINF || fpclass(x) == FP_NDENORM || fpclass(x) == FP_NZERO || fpclass(x) == FP_NNORM)
#else /* !HAVE_SIGNBIT */
# define sxe_signbit(x) ((x) < 0)
# warning Your signbit() computation is vile. Consider scrapping your machine.
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
#if defined(MPC_SET_X_Y)
int mpc_set_ui_fr (mpc_t rop, unsigned long int re, mpfr_t im, mpc_rnd_t rnd);
int mpc_set_ui_fr (mpc_t rop, unsigned long int re, mpfr_t im, mpc_rnd_t rnd)
- MPC_SET_X_Y (ui, fr, rop, re, im, rnd);
+ MPC_SET_X_Y (ui, fr, rop, re, im, rnd);
#else
#error Cannot derived mpc_set_ui_fr without MPC_SET_X_Y!
#endif
{
mp_exp_t expt;
Bufbyte *str;
- int len;
+ int len;
const int sign = mpfr_sgn(f);
const int neg = (sign < 0) ? 1 : 0;
/* jump over a leading minus */
cp++;
}
-
+
while ((*cp >= '0' && *cp <= '9') ||
(*cp == '.'))
cp++;
Fprovide(intern("bigfr"));
}
-
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
/* void bigc_set_bigc(bigc c, bigc c)
* {
- * bigc_set_bigfr_bigfr(bigc_re(c), z1);
+ * bigc_set_bigfr_bigfr(bigc_re(c), z1);
* }
*/
bigc_abs(tmpnorm, c);
bigfr_add(bigc_re(res), tmpnorm, bigc_re(c));
bigfr_sub(bigc_im(res), tmpnorm, bigc_re(c));
-
+
/* compute 1/2 and divide the above by it */
bigfr_set_long(tmphalf, 2);
bigfr_div(bigc_re(res), bigc_re(res), tmphalf);
#define bigc_get_prec(f) max(bigfr_get_prec(bigc_re(f)), \
bigfr_get_prec(bigc_im(f)))
extern void bigc_set_prec(bigc, unsigned long);
-#define bigc_set_default_prec(prec)
+#define bigc_set_default_prec(prec)
#define bigc_get_default_prec() bigfr_get_default_prec()
/***** Bigc: conversions *****/
{
Bufbyte *z_str, *i_str, *j_str, *k_str;
int z_len, i_len, j_len, k_len;
- int sign_i, sign_j, sign_k, neg_i, neg_j, neg_k;
+ int sign_i, sign_j, sign_k, neg_i, neg_j, neg_k;
z_str = (Bufbyte*)bigz_to_string(quatern_z(g), base);
i_str = (Bufbyte*)bigz_to_string(quatern_i(g), base);
/* void bigc_set_quatern(bigc c, quatern g)
* {
- * bigc_set_bigfr_bigfr(quatern_z(g), z1);
+ * bigc_set_bigfr_bigfr(quatern_z(g), z1);
* }
*/
/* jump over a leading minus */
cp++;
}
-
+
while ((*cp >= '0' && *cp <= '9'))
cp++;
/*
- ent-strflt.h -- String to float defines
+ ent-strflt.h -- String to float defines
Copyright (C) 2005, 2006 Sebastian Freundt
Copyright (C) 2006 Nelson Ferreira
Author: Sebastian Freundt
- Nelson Ferreira
+ Nelson Ferreira
This file is part of SXEmacs
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
#endif /* HAVE_MPF */
}
- /* fallback to 'float */
+ /* fallback to 'float */
return Fcoerce_number(number, Qfloat, precision);
}
case Lisp_Type_Record: {
enum lrecord_type type =
XRECORD_LHEADER_IMPLEMENTATION(arg)->lrecord_type_index;
-
+
switch ((unsigned int)type) {
case lrecord_type_marker:
return INT_T;
- 'fixnum or 'int to convert to built-in integers
- 'bigz or 'bignum to convert to bigz integers
- 'integer to convert to the most suitable type out of
- 'bigz or 'int
+ 'bigz or 'int
- 'bigq or 'ratio to convert to bigq fractions
- 'rational to convert to the most suitable type out of
- 'bigq, 'bigz or 'int
+ 'bigq, 'bigz or 'int
- 'float to convert to built-in floats
- 'bigf or 'bigfloat to convert to bigf floats
- 'bigfr to convert to bigfr floats
-- 'real to convert to the type indicated by
- `read-real-as' with a fallback to 'float
+- 'real to convert to the type indicated by
+ `read-real-as' with a fallback to 'float
- 'bigg to convert to a Gaussian
- 'bigc to convert to a bigc complex number
}
#endif /* HAVE_MPF */
#if defined HAVE_MPFR && defined WITH_MPFR
- else if (EQ(type, Qbigfr)) {
+ else if (EQ(type, Qbigfr)) {
la.precision = internal_get_precision(precision);
return ent_lift(number, BIGFR_T, &la);
}
else if (Vread_real_as == Qbigfr)
return ent_lift(number, BIGFR_T, &la);
#endif
- else
+ else
return ent_lift(number, FLOAT_T, &la);
}
#if defined(HAVE_PSEUG) && defined WITH_PSEUG
DEFVAR_LISP("read-real-as", &Vread_real_as /*
*Indicate how real numbers should be read.
If set to `nil' or 'float, reals are always converted to floats.
-If set to 'bigf or 'bigfr, reals are read as MPF floats or MPFR
+If set to 'bigf or 'bigfr, reals are read as MPF floats or MPFR
floats respectively.
*/);
Vread_real_as = Qfloat;
octon = octonion number (which library does that? lidia?) - NOT YET
- Category unions:
+ Category unions:
================
rational = integer + bigq
real = float + bigf + bigr
- (and everything else simulating real numbers)
+ (and everything else simulating real numbers)
comparable = rational + real
- (and everything else that has a total order)
+ (and everything else that has a total order)
complex = bigc + gaussian
algebraic = rational + ffelm + padic + gaussian
archimedean = rational + real + complex
- (and everything else with an archimedean valuation)
+ (and everything else with an archimedean valuation)
non-archimidean = padic + ffelm
number = archimedean + non-archimedean + quatern + octon
The top-level configure script should define the symbols
- HAVE_MPZ, HAVE_MPQ, HAVE_MPF, HAVE_MPFR and HAVE_MPC to indicate which
+ HAVE_MPZ, HAVE_MPQ, HAVE_MPF, HAVE_MPFR and HAVE_MPC to indicate which
it provides.
If some type is not defined by the library, this is what happens:
#endif
#if defined HAVE_MPC && defined WITH_MPC
# include "ent/ent-mpc.h"
-#elif defined HAVE_PSEUC && defined WITH_PSEUC
+#elif defined HAVE_PSEUC && defined WITH_PSEUC
# include "ent/ent-pseumpc.h"
#endif
#if defined HAVE_ECM && defined WITH_ECM
bigc_sqrt(ent_scratch_bigc, XBIGC_DATA(bcnumber));
return make_bigc_bc(ent_scratch_bigc);
#endif /* HAVE_MPC */
- }
+ }
if (NILP(precision));
return wrong_type_argument(Qnumberp, number);
#if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
if (INTEGERP(number))
#else /* !HAVE_MPZ */
- if (INTP(number))
+ if (INTP(number))
#endif /* HAVE_MPZ */
return number;
if (NILP(divisor)) {
return Ffloor(number, make_int(1L));
- }
+ }
/* !NILP(divisor) */
quatern_norm(ent_scratch_bigz, XQUATERN_DATA(number));
return make_bigz_bz(ent_scratch_bigz);
#endif
- }
+ }
/* what should the rest do? */
return Fcanonical_norm(wrong_type_argument(Qnumberp, number));
#if defined HAVE_MPFR && defined WITH_MPFR
if (BIGFRP(number)) {
bigfr_set_prec(ent_scratch_bigfr, XBIGFR_GET_PREC(number));
-
+
bigfr_ceil(ent_scratch_bigfr, XBIGFR_DATA(number));
return make_bigfr_bfr(ent_scratch_bigfr);
}
#if defined HAVE_MPFR && defined WITH_MPFR
if (BIGFRP(number)) {
bigfr_set_prec(ent_scratch_bigfr, XBIGFR_GET_PREC(number));
-
+
bigfr_floor(ent_scratch_bigfr, XBIGFR_DATA(number));
return make_bigfr_bfr(ent_scratch_bigfr);
}
#if defined HAVE_MPFR && defined WITH_MPFR
if (BIGFRP(number)) {
bigfr_set_prec(ent_scratch_bigfr, XBIGFR_GET_PREC(number));
-
+
bigfr_rint(ent_scratch_bigfr, XBIGFR_DATA(number));
return make_bigfr_bfr(ent_scratch_bigfr);
}
*/
(number))
{
- fpfloat d;
+ fpfloat d;
#if defined HAVE_MPF && defined WITH_GMP
if (BIGFP(number)) {
bigf_set_prec(ent_scratch_bigf, XBIGF_GET_PREC(number));
#if defined HAVE_MPFR && defined WITH_MPFR
if (BIGFRP(number)) {
bigfr_set_prec(ent_scratch_bigfr, XBIGFR_GET_PREC(number));
-
+
bigfr_trunc(ent_scratch_bigfr, XBIGFR_DATA(number));
return make_bigfr_bfr(ent_scratch_bigfr);
}