-/* Copyright (C) 1995,1996,1997,1998, 1999, 2000 Free Software Foundation, Inc.
-
+/* Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
#include <stdio.h>
#include <math.h>
-#include "_scm.h"
-#include "unif.h"
-#include "feature.h"
-#include "smob.h"
-#include "vectors.h"
-
-#include "validate.h"
-#include "numbers.h"
+#include "libguile/_scm.h"
+#include "libguile/unif.h"
+#include "libguile/feature.h"
+#include "libguile/ports.h"
+#include "libguile/root.h"
+#include "libguile/smob.h"
+#include "libguile/strings.h"
+#include "libguile/vectors.h"
+
+#include "libguile/validate.h"
+#include "libguile/numbers.h"
\f
#define DIGITS '0':case '1':case '2':case '3':case '4':\
case '5':case '6':case '7':case '8':case '9'
SCM_DEFINE (scm_exact_p, "exact?", 1, 0, 0,
(SCM x),
- "")
+ "Return #t if X is an exact number, #f otherwise.")
#define FUNC_NAME s_scm_exact_p
{
- if (SCM_INUMP (x))
+ if (SCM_INUMP (x)) {
return SCM_BOOL_T;
#ifdef SCM_BIGDIG
- if (SCM_BIGP (x))
+ } else if (SCM_BIGP (x)) {
return SCM_BOOL_T;
#endif
- return SCM_BOOL_F;
+ } else {
+ return SCM_BOOL_F;
+ }
}
#undef FUNC_NAME
+
SCM_DEFINE (scm_odd_p, "odd?", 1, 0, 0,
(SCM n),
- "")
+ "Return #t if N is an odd number, #f otherwise.")
#define FUNC_NAME s_scm_odd_p
{
+ if (SCM_INUMP (n)) {
+ return SCM_BOOL ((4 & SCM_UNPACK (n)) != 0);
#ifdef SCM_BIGDIG
- if (SCM_NINUMP (n))
- {
- SCM_VALIDATE_BIGINT (1,n);
- return SCM_BOOL(1 & SCM_BDIGITS (n)[0]);
- }
-#else
- SCM_VALIDATE_INUM (1,n);
+ } else if (SCM_BIGP (n)) {
+ return SCM_BOOL ((1 & SCM_BDIGITS (n) [0]) != 0);
#endif
- return SCM_BOOL(4 & (int) n);
+ } else {
+ SCM_WRONG_TYPE_ARG (1, n);
+ }
}
#undef FUNC_NAME
+
SCM_DEFINE (scm_even_p, "even?", 1, 0, 0,
(SCM n),
- "")
+ "Return #t if N is an even number, #f otherwise.")
#define FUNC_NAME s_scm_even_p
{
+ if (SCM_INUMP (n)) {
+ return SCM_BOOL ((4 & SCM_UNPACK (n)) == 0);
#ifdef SCM_BIGDIG
- if (SCM_NINUMP (n))
- {
- SCM_VALIDATE_BIGINT (1,n);
- return SCM_NEGATE_BOOL(1 & SCM_BDIGITS (n)[0]);
- }
-#else
- SCM_VALIDATE_INUM (1,n);
+ } else if (SCM_BIGP (n)) {
+ return SCM_BOOL ((1 & SCM_BDIGITS (n) [0]) == 0);
#endif
- return SCM_NEGATE_BOOL(4 & (int) n);
+ } else {
+ SCM_WRONG_TYPE_ARG (1, n);
+ }
}
#undef FUNC_NAME
+
SCM_GPROC (s_abs, "abs", 1, 0, 0, scm_abs, g_abs);
SCM
scm_abs (SCM x)
{
- long int cx;
+ if (SCM_INUMP (x)) {
+ long int xx = SCM_INUM (x);
+ if (xx >= 0) {
+ return x;
+ } else if (SCM_POSFIXABLE (-xx)) {
+ return SCM_MAKINUM (-xx);
+ } else {
#ifdef SCM_BIGDIG
- if (SCM_NINUMP (x))
- {
- SCM_GASSERT1 (SCM_BIGP (x), g_abs, x, SCM_ARG1, s_abs);
- if (!SCM_BIGSIGN (x))
- return x;
- return scm_copybig (x, 0);
- }
+ return scm_long2big (-xx);
#else
- SCM_GASSERT1 (SCM_INUMP (x), g_abs, x, SCM_ARG1, s_abs);
+ scm_num_overflow (s_abs);
#endif
- if (SCM_INUM (x) >= 0)
- return x;
- cx = - SCM_INUM (x);
- if (!SCM_POSFIXABLE (cx))
+ }
#ifdef SCM_BIGDIG
- return scm_long2big (cx);
-#else
- scm_num_overflow (s_abs);
+ } else if (SCM_BIGP (x)) {
+ if (!SCM_BIGSIGN (x)) {
+ return x;
+ } else {
+ return scm_copybig (x, 0);
+ }
#endif
- return SCM_MAKINUM (cx);
+ } else {
+ SCM_WTA_DISPATCH_1 (g_abs, x, 1, s_abs);
+ }
}
+
SCM_GPROC (s_quotient, "quotient", 2, 0, 0, scm_quotient, g_quotient);
SCM
scm_quotient (SCM x, SCM y)
{
- register long z;
-#ifdef SCM_BIGDIG
- if (SCM_NINUMP (x))
- {
- SCM_GASSERT2 (SCM_BIGP (x),
- g_quotient, x, y, SCM_ARG1, s_quotient);
- if (SCM_NINUMP (y))
- {
- SCM_ASRTGO (SCM_BIGP (y), bady);
- return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
- SCM_BDIGITS (y), SCM_NUMDIGS (y),
- SCM_BIGSIGN (x) ^ SCM_BIGSIGN (y), 2);
- }
- z = SCM_INUM (y);
- SCM_ASRTGO (z, ov);
- if (1 == z)
- return x;
- if (z < 0)
- z = -z;
- if (z < SCM_BIGRAD)
+ if (SCM_INUMP (x)) {
+ long xx = SCM_INUM (x);
+ if (SCM_INUMP (y)) {
+ long yy = SCM_INUM (y);
+ if (yy == 0) {
+ scm_num_overflow (s_quotient);
+ } else {
+ long z = xx / yy;
+#ifdef BADIVSGNS
{
- SCM sw = scm_copybig (x,
- SCM_BIGSIGN (x)
- ? (SCM_UNPACK (y) > 0)
- : (SCM_UNPACK (y) < 0));
- scm_divbigdig (SCM_BDIGITS (sw), SCM_NUMDIGS (sw), (SCM_BIGDIG) z);
- return scm_normbig (sw);
+#if (__TURBOC__ == 1)
+ long t = ((yy < 0) ? -xx : xx) % yy;
+#else
+ long t = xx % yy;
+#endif
+ if ((t < 0) && (xx > 0))
+ z--;
+ else if ((t > 0) && (xx < 0))
+ z++;
}
- { /* scope */
-#ifndef SCM_DIGSTOOBIG
- long w = scm_pseudolong (z);
- return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
- (SCM_BIGDIG *) & w, SCM_DIGSPERLONG,
- SCM_BIGSIGN (x) ? (y > 0) : (y < 0), 2);
+#endif
+ if (SCM_FIXABLE (z)) {
+ return SCM_MAKINUM (z);
+ } else {
+#ifdef SCM_BIGDIG
+ return scm_long2big (z);
#else
- SCM_BIGDIG zdigs[SCM_DIGSPERLONG];
- scm_longdigs (z, zdigs);
- return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
- zdigs, SCM_DIGSPERLONG,
- SCM_BIGSIGN (x) ? (y > 0) : (y < 0), 2);
+ scm_num_overflow (s_quotient);
#endif
- } /* end scope */
- }
- if (SCM_NINUMP (y))
- {
- if (!SCM_BIGP (y))
- {
- bady:
- SCM_WTA_DISPATCH_2 (g_quotient, x, y, SCM_ARG2, s_quotient);
}
+ }
+#ifdef SCM_BIGDIG
+ } else if (SCM_BIGP (y)) {
return SCM_INUM0;
+#endif
+ } else {
+ SCM_WTA_DISPATCH_2 (g_quotient, x, y, SCM_ARG2, s_quotient);
}
+#ifdef SCM_BIGDIG
+ } else if (SCM_BIGP (x)) {
+ if (SCM_INUMP (y)) {
+ long yy = SCM_INUM (y);
+ if (yy == 0) {
+ scm_num_overflow (s_quotient);
+ } else if (yy == 1) {
+ return x;
+ } else {
+ long z = yy < 0 ? -yy : yy;
+
+ if (z < SCM_BIGRAD) {
+ SCM sw = scm_copybig (x, SCM_BIGSIGN (x) ? (yy > 0) : (yy < 0));
+ scm_divbigdig (SCM_BDIGITS (sw), SCM_NUMDIGS (sw), (SCM_BIGDIG) z);
+ return scm_normbig (sw);
+ } else {
+#ifndef SCM_DIGSTOOBIG
+ long w = scm_pseudolong (z);
+ return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
+ (SCM_BIGDIG *) & w, SCM_DIGSPERLONG,
+ SCM_BIGSIGN (x) ? (yy > 0) : (yy < 0), 2);
#else
- SCM_GASSERT2 (SCM_INUMP (x), g_quotient, x, y, SCM_ARG1, s_quotient);
- SCM_GASSERT2 (SCM_INUMP (y), g_quotient, x, y, SCM_ARG2, s_quotient);
+ SCM_BIGDIG zdigs[SCM_DIGSPERLONG];
+ scm_longdigs (z, zdigs);
+ return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
+ zdigs, SCM_DIGSPERLONG,
+ SCM_BIGSIGN (x) ? (yy > 0) : (yy < 0), 2);
#endif
- if ((z = SCM_INUM (y)) == 0)
- {
- ov:
- scm_num_overflow (s_quotient);
+ }
+ }
+ } else if (SCM_BIGP (y)) {
+ return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
+ SCM_BDIGITS (y), SCM_NUMDIGS (y),
+ SCM_BIGSIGN (x) ^ SCM_BIGSIGN (y), 2);
+ } else {
+ SCM_WTA_DISPATCH_2 (g_quotient, x, y, SCM_ARG2, s_quotient);
}
- z = SCM_INUM (x) / z;
-#ifdef BADIVSGNS
- {
-#if (__TURBOC__ == 1)
- long t = ((y < 0) ? -SCM_INUM (x) : SCM_INUM (x)) % SCM_INUM (y);
-#else
- long t = SCM_INUM (x) % SCM_INUM (y);
#endif
- if (t == 0);
- else if (t < 0)
- if (x < 0);
- else
- z--;
- else if (x < 0)
- z++;
+ } else {
+ SCM_WTA_DISPATCH_2 (g_quotient, x, y, SCM_ARG2, s_quotient);
}
-#endif
- if (!SCM_FIXABLE (z))
-#ifdef SCM_BIGDIG
- return scm_long2big (z);
-#else
- scm_num_overflow (s_quotient);
-#endif
- return SCM_MAKINUM (z);
}
+
SCM_GPROC (s_remainder, "remainder", 2, 0, 0, scm_remainder, g_remainder);
SCM
SCM
scm_modulo (SCM x, SCM y)
{
- register long yy, z;
+ if (SCM_INUMP (x)) {
+ long xx = SCM_INUM (x);
+ if (SCM_INUMP (y)) {
+ long yy = SCM_INUM (y);
+ if (yy == 0) {
+ scm_num_overflow (s_modulo);
+ } else {
+#if (__TURBOC__ == 1)
+ long z = ((yy < 0) ? -xx : xx) % yy;
+#else
+ long z = xx % yy;
+#endif
+ return SCM_MAKINUM (((yy < 0) ? (z > 0) : (z < 0)) ? z + yy : z);
+ }
+ } else {
#ifdef SCM_BIGDIG
- if (SCM_NINUMP (x))
- {
- SCM_GASSERT2 (SCM_BIGP (x),
- g_modulo, x, y, SCM_ARG1, s_modulo);
- if (SCM_NINUMP (y))
- {
- SCM_ASRTGO (SCM_BIGP (y), bady);
- return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
- SCM_BDIGITS (y), SCM_NUMDIGS (y),
- SCM_BIGSIGN (y),
- (SCM_BIGSIGN (x) ^ SCM_BIGSIGN (y)) ? 1 : 0);
- }
- if (!(z = SCM_INUM (y)))
- goto ov;
- return scm_divbigint (x, z, y < 0,
- (SCM_BIGSIGN (x) ? (y > 0) : (y < 0)) ? 1 : 0);
- }
- if (SCM_NINUMP (y))
- {
- if (!SCM_BIGP (y))
- {
- bady:
- SCM_WTA_DISPATCH_2 (g_modulo, x, y, SCM_ARG2, s_modulo);
- }
- return (SCM_BIGSIGN (y) ? (x > 0) : (x < 0)) ? scm_sum (x, y) : x;
- }
+ if (!SCM_BIGP (y)) {
+ SCM_WTA_DISPATCH_2 (g_modulo, x, y, SCM_ARG2, s_modulo);
+ } else {
+ return (SCM_BIGSIGN (y) ? (xx > 0) : (xx < 0)) ? scm_sum (x, y) : x;
+ }
#else
- SCM_GASSERT1 (SCM_INUMP (x), g_modulo, x, y, SCM_ARG1, s_modulo);
- SCM_GASSERT2 (SCM_INUMP (y), g_modulo, x, y, SCM_ARG2, s_modulo);
+ SCM_WTA_DISPATCH_2 (g_modulo, x, y, SCM_ARG2, s_modulo);
#endif
- if (!(yy = SCM_INUM (y)))
- {
- ov:
- scm_num_overflow (s_modulo);
}
-#if (__TURBOC__==1)
- z = SCM_INUM (x);
- z = ((yy < 0) ? -z : z) % yy;
+ } else {
+#ifdef SCM_BIGDIG
+ SCM_GASSERT2 (SCM_BIGP (x), g_modulo, x, y, SCM_ARG1, s_modulo);
+ if (SCM_NINUMP (y)) {
+ if (!SCM_BIGP (y)) {
+ SCM_WTA_DISPATCH_2 (g_modulo, x, y, SCM_ARG2, s_modulo);
+ } else {
+ return scm_divbigbig (SCM_BDIGITS (x), SCM_NUMDIGS (x),
+ SCM_BDIGITS (y), SCM_NUMDIGS (y),
+ SCM_BIGSIGN (y),
+ (SCM_BIGSIGN (x) ^ SCM_BIGSIGN (y)) ? 1 : 0);
+ }
+ } else {
+ long yy = SCM_INUM (y);
+ if (yy == 0) {
+ scm_num_overflow (s_modulo);
+ } else {
+ return scm_divbigint (x, yy, yy < 0,
+ (SCM_BIGSIGN (x) ? (yy > 0) : (yy < 0)) ? 1 : 0);
+ }
+ }
#else
- z = SCM_INUM (x) % yy;
+ SCM_WTA_DISPATCH_2 (g_modulo, x, y, SCM_ARG2, s_modulo);
#endif
- return SCM_MAKINUM (((yy < 0) ? (z > 0) : (z < 0)) ? z + yy : z);
+ }
}
SCM_GPROC1 (s_gcd, "gcd", scm_tc7_asubr, scm_gcd, g_gcd);
/* instead of the switch, we could just
return scm_gcd (y, scm_modulo (x, y)); */
}
- if (SCM_INUM0 == y)
+ if (SCM_EQ_P (y, SCM_INUM0))
return x;
goto swaprec;
}
}
d = scm_gcd (n1, n2);
- if (SCM_INUM0 == d)
+ if (SCM_EQ_P (d, SCM_INUM0))
return d;
return scm_abs (scm_product (n1, scm_quotient (n2, d)));
}
SCM acc = SCM_MAKINUM (1L);
int i2;
#ifdef SCM_BIGDIG
- if (SCM_INUM0 == n || acc == n)
+ if (SCM_EQ_P (n, SCM_INUM0) || SCM_EQ_P (n, acc))
return n;
- else if (SCM_MAKINUM (-1L) == n)
- return SCM_BOOL_F == scm_even_p (k) ? n : acc;
+ else if (SCM_EQ_P (n, SCM_MAKINUM (-1L)))
+ return SCM_FALSEP (scm_even_p (k)) ? n : acc;
#endif
SCM_VALIDATE_ULONG_COPY (2,k,i2);
if (i2 < 0)
SCM_DEFINE (scm_ash, "ash", 2, 0, 0,
(SCM n, SCM cnt),
- "Returns an integer equivalent to\n"
- "@code{(inexact->exact (floor (* @var{int} (expt 2 @var{count}))))}.@refill\n\n"
+ "The function ash performs an arithmetic shift left by CNT bits\n"
+ "(or shift right, if CNT is negative). 'Arithmetic' means, that\n"
+ "the function does not guarantee to keep the bit structure of N,\n"
+ "but rather guarantees that the result will always be rounded\n"
+ "towards minus infinity. Therefore, the results of ash and a\n"
+ "corresponding bitwise shift will differ if N is negative.\n\n"
+ "Formally, the function returns an integer equivalent to\n"
+ "@code{(inexact->exact (floor (* N (expt 2 CNT))))}.@refill\n\n"
"Example:\n"
"@lisp\n"
"(number->string (ash #b1 3) 2)\n"
"@end lisp")
#define FUNC_NAME s_scm_ash
{
- /* GJB:FIXME:: what is going on here? */
- SCM res = SCM_PACK (SCM_INUM (n));
- SCM_VALIDATE_INUM (2,cnt);
+ long bits_to_shift;
+
+#ifndef SCM_BIGDIG
+ SCM_VALIDATE_INUM (1, n)
+#endif
+ SCM_VALIDATE_INUM (2, cnt);
+
+ bits_to_shift = SCM_INUM (cnt);
#ifdef SCM_BIGDIG
- if (cnt < 0)
- {
- res = scm_integer_expt (SCM_MAKINUM (2), SCM_MAKINUM (-SCM_INUM (cnt)));
- if (SCM_NFALSEP (scm_negative_p (n)))
- return scm_sum (SCM_MAKINUM (-1L),
- scm_quotient (scm_sum (SCM_MAKINUM (1L), n), res));
- else
- return scm_quotient (n, res);
- }
- else
+ if (bits_to_shift < 0) {
+ /* Shift right by abs(cnt) bits. This is realized as a division by
+ div:=2^abs(cnt). However, to guarantee the floor rounding, negative
+ values require some special treatment.
+ */
+ SCM div = scm_integer_expt (SCM_MAKINUM (2), SCM_MAKINUM (-bits_to_shift));
+ if (SCM_FALSEP (scm_negative_p (n)))
+ return scm_quotient (n, div);
+ else
+ return scm_sum (SCM_MAKINUM (-1L),
+ scm_quotient (scm_sum (SCM_MAKINUM (1L), n), div));
+ } else
+ /* Shift left is done by multiplication with 2^CNT */
return scm_product (n, scm_integer_expt (SCM_MAKINUM (2), cnt));
#else
- SCM_VALIDATE_INUM (1,n)
- cnt = SCM_INUM (cnt);
- if (cnt < 0)
- return SCM_MAKINUM (SCM_SRS (res, -cnt));
- res = SCM_MAKINUM (res << cnt);
- if (SCM_INUM (res) >> cnt != SCM_INUM (n))
- scm_num_overflow (FUNC_NAME);
- return res;
+ if (bits_to_shift < 0)
+ /* Signed right shift (SCM_SRS does it right) by abs(cnt) bits. */
+ return SCM_MAKINUM (SCM_SRS (SCM_INUM (n), -bits_to_shift));
+ else {
+ /* Shift left, but make sure not to leave the range of inums */
+ SCM res = SCM_MAKINUM (SCM_INUM (n) << cnt);
+ if (SCM_INUM (res) >> cnt != SCM_INUM (n))
+ scm_num_overflow (FUNC_NAME);
+ return res;
+ }
#endif
}
#undef FUNC_NAME
= ((SCM_BIGDIG *)
scm_must_realloc ((char *) SCM_CHARS (b),
(long) (SCM_NUMDIGS (b) * sizeof (SCM_BIGDIG)),
- (long) (nsiz * sizeof (SCM_BIGDIG)), s_adjbig));
+ (long) (nsiz * sizeof (SCM_BIGDIG)), s_bignum));
SCM_SETCHARS (b, digits);
SCM_SETNUMDIGS (b, nsiz, SCM_BIGSIGN (b));
{
num = 1;
i = 0;
- SCM_SETCAR (z, SCM_UNPACK_CAR (z) ^ SCM_BIGSIGNFLAG);
+ SCM_SET_CELL_WORD_0 (z, SCM_CELL_WORD_0 (z) ^ SCM_BIGSIGNFLAG);
do
{
num += (SCM_BIGRAD - 1) - zds[i];
for (i = j; j < SCM_LENGTH (ss); j++)
s[ch + j - i] = s[j]; /* jeh */
scm_vector_set_length_x (ss, /* jeh */
- (SCM) SCM_MAKINUM (ch + SCM_LENGTH (ss) - i));
+ SCM_MAKINUM (ch + SCM_LENGTH (ss) - i));
}
return scm_return_first (ss, t);
return SCM_BOOL (SCM_COMPLEX_REAL (z) == 0.0
&& SCM_COMPLEX_IMAG (z) == 0.0);
}
- return SCM_BOOL(z == SCM_INUM0);
+ return SCM_BOOL (SCM_EQ_P (z, SCM_INUM0));
}
{
intbig:
{
+ long i = SCM_INUM (x);
# ifndef SCM_DIGSTOOBIG
- long z = scm_pseudolong (SCM_INUM (x));
+ long z = scm_pseudolong (i);
return scm_addbig ((SCM_BIGDIG *) & z,
SCM_DIGSPERLONG,
- (x < 0) ? SCM_BIGSIGNFLAG : 0,
+ (i < 0) ? SCM_BIGSIGNFLAG : 0,
y, 0);
# else /* SCM_DIGSTOOBIG */
SCM_BIGDIG zdigs[SCM_DIGSPERLONG];
- scm_longdigs (SCM_INUM (x), zdigs);
- return scm_addbig (zdigs, SCM_DIGSPERLONG, (x < 0) ? SCM_BIGSIGNFLAG : 0,
+ scm_longdigs (i, zdigs);
+ return scm_addbig (zdigs, SCM_DIGSPERLONG, (i < 0) ? SCM_BIGSIGNFLAG : 0,
y, 0);
# endif /* SCM_DIGSTOOBIG */
}
SCM_ASRTGO (SCM_NIMP (y), bady);
if (SCM_BIGP (y))
{
+ long i = SCM_INUM (x);
#ifndef SCM_DIGSTOOBIG
- long z = scm_pseudolong (SCM_INUM (x));
+ long z = scm_pseudolong (i);
return scm_addbig ((SCM_BIGDIG *) & z, SCM_DIGSPERLONG,
- (x < 0) ? SCM_BIGSIGNFLAG : 0,
+ (i < 0) ? SCM_BIGSIGNFLAG : 0,
y, SCM_BIGSIGNFLAG);
#else
SCM_BIGDIG zdigs[SCM_DIGSPERLONG];
- scm_longdigs (SCM_INUM (x), zdigs);
- return scm_addbig (zdigs, SCM_DIGSPERLONG, (x < 0) ? SCM_BIGSIGNFLAG : 0,
+ scm_longdigs (i, zdigs);
+ return scm_addbig (zdigs, SCM_DIGSPERLONG, (i < 0) ? SCM_BIGSIGNFLAG : 0,
y, SCM_BIGSIGNFLAG);
#endif
}
if (SCM_BIGP (y))
{
intbig:
- if (SCM_INUM0 == x)
+ if (SCM_EQ_P (x, SCM_INUM0))
return x;
- if (SCM_MAKINUM (1L) == x)
+ if (SCM_EQ_P (x, SCM_MAKINUM (1L)))
return y;
{
#ifndef SCM_DIGSTOOBIG
}
if (SCM_UNBNDP (y))
{
- if ((SCM_MAKINUM (1L) == x) || (SCM_MAKINUM (-1L) == x))
+ if (SCM_EQ_P (x, SCM_MAKINUM (1L)) || SCM_EQ_P (x, SCM_MAKINUM (-1L)))
return x;
return scm_makdbl (1.0 / ((double) SCM_INUM (x)), 0.0);
}
return scm_makdbl ((double) sl, 0.0);
#endif
}
- return SCM_MAKINUM (sl);
+ else
+ {
+ /* we know that sl fits into an inum */
+ return SCM_MAKINUM ((scm_bits_t) sl);
+ }
}
#endif
scm_dblprec = scm_dblprec - 1;
}
#endif /* DBL_DIG */
-#include "numbers.x"
+#include "libguile/numbers.x"
}
+
+/*
+ Local Variables:
+ c-file-style: "gnu"
+ End:
+*/