summaryrefslogtreecommitdiff
path: root/src/floatfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/floatfns.c')
-rw-r--r--src/floatfns.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/floatfns.c b/src/floatfns.c
index e7d404a84e0..766044ba35c 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -67,7 +67,7 @@ CHECK_FLOAT (Lisp_Object x)
double
extract_float (Lisp_Object num)
{
- CHECK_NUMBER_OR_FLOAT (num);
+ CHECK_FIXNUM_OR_FLOAT (num);
return XFLOATINT (num);
}
@@ -185,7 +185,7 @@ If X is zero, both parts (SGNFCAND and EXP) are zero. */)
double f = extract_float (x);
int exponent;
double sgnfcand = frexp (f, &exponent);
- return Fcons (make_float (sgnfcand), make_number (exponent));
+ return Fcons (make_float (sgnfcand), make_fixnum (exponent));
}
DEFUN ("ldexp", Fldexp, Sldexp, 2, 2, 0,
@@ -193,7 +193,7 @@ DEFUN ("ldexp", Fldexp, Sldexp, 2, 2, 0,
EXPONENT must be an integer. */)
(Lisp_Object sgnfcand, Lisp_Object exponent)
{
- CHECK_NUMBER (exponent);
+ CHECK_FIXNUM (exponent);
int e = min (max (INT_MIN, XINT (exponent)), INT_MAX);
return make_float (ldexp (extract_float (sgnfcand), e));
}
@@ -211,10 +211,10 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
doc: /* Return the exponential ARG1 ** ARG2. */)
(Lisp_Object arg1, Lisp_Object arg2)
{
- CHECK_NUMBER_OR_FLOAT (arg1);
- CHECK_NUMBER_OR_FLOAT (arg2);
- if (INTEGERP (arg1) /* common lisp spec */
- && INTEGERP (arg2) /* don't promote, if both are ints, and */
+ CHECK_FIXNUM_OR_FLOAT (arg1);
+ CHECK_FIXNUM_OR_FLOAT (arg2);
+ if (FIXNUMP (arg1) /* common lisp spec */
+ && FIXNUMP (arg2) /* don't promote, if both are ints, and */
&& XINT (arg2) >= 0) /* we are sure the result is not fractional */
{ /* this can be improved by pre-calculating */
EMACS_INT y; /* some binary powers of x then accumulating */
@@ -275,7 +275,7 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
doc: /* Return the absolute value of ARG. */)
(register Lisp_Object arg)
{
- CHECK_NUMBER_OR_FLOAT (arg);
+ CHECK_FIXNUM_OR_FLOAT (arg);
if (FLOATP (arg))
arg = make_float (fabs (XFLOAT_DATA (arg)));
@@ -289,9 +289,9 @@ DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
doc: /* Return the floating point number equal to ARG. */)
(register Lisp_Object arg)
{
- CHECK_NUMBER_OR_FLOAT (arg);
+ CHECK_FIXNUM_OR_FLOAT (arg);
- if (INTEGERP (arg))
+ if (FIXNUMP (arg))
return make_float ((double) XINT (arg));
else /* give 'em the same float back */
return arg;
@@ -311,7 +311,7 @@ This is the same as the exponent of a float. */)
(Lisp_Object arg)
{
EMACS_INT value;
- CHECK_NUMBER_OR_FLOAT (arg);
+ CHECK_FIXNUM_OR_FLOAT (arg);
if (FLOATP (arg))
{
@@ -336,7 +336,7 @@ This is the same as the exponent of a float. */)
: EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (i));
}
- return make_number (value);
+ return make_fixnum (value);
}
@@ -348,7 +348,7 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT),
const char *name)
{
- CHECK_NUMBER_OR_FLOAT (arg);
+ CHECK_FIXNUM_OR_FLOAT (arg);
double d;
if (NILP (divisor))
@@ -359,12 +359,12 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
}
else
{
- CHECK_NUMBER_OR_FLOAT (divisor);
+ CHECK_FIXNUM_OR_FLOAT (divisor);
if (!FLOATP (arg) && !FLOATP (divisor))
{
if (XINT (divisor) == 0)
xsignal0 (Qarith_error);
- return make_number (int_round2 (XINT (arg), XINT (divisor)));
+ return make_fixnum (int_round2 (XINT (arg), XINT (divisor)));
}
double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XINT (arg);
@@ -383,7 +383,7 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
{
EMACS_INT ir = dr;
if (! FIXNUM_OVERFLOW_P (ir))
- return make_number (ir);
+ return make_fixnum (ir);
}
xsignal2 (Qrange_error, build_string (name), arg);
}