if (u < (double) (SCM_MOST_POSITIVE_FIXNUM+1)
&& u >= (double) SCM_MOST_NEGATIVE_FIXNUM)
- return SCM_MAKINUM ((long) u);
+ return SCM_I_MAKINUM ((long) u);
else
return scm_i_dbl2big (u);
}
{
long val = mpz_get_si (SCM_I_BIG_MPZ (b));
if (SCM_FIXABLE (val))
- b = SCM_MAKINUM (val);
+ b = SCM_I_MAKINUM (val);
}
return b;
}
{
long val = mpz_get_si (b);
if (SCM_FIXABLE (val))
- return SCM_MAKINUM (val);
+ return SCM_I_MAKINUM (val);
}
{
{
if (SCM_EQ_P (denominator, SCM_INUM0))
scm_num_overflow ("make-ratio");
- if (SCM_EQ_P (denominator, SCM_MAKINUM(1)))
+ if (SCM_EQ_P (denominator, SCM_I_MAKINUM(1)))
return numerator;
}
else
long y;
y = SCM_INUM (denominator);
if (x == y)
- return SCM_MAKINUM(1);
+ return SCM_I_MAKINUM(1);
if ((x % y) == 0)
- return SCM_MAKINUM (x / y);
+ return SCM_I_MAKINUM (x / y);
}
else
{
if (x == SCM_MOST_NEGATIVE_FIXNUM
&& mpz_cmp_ui (SCM_I_BIG_MPZ (denominator),
- SCM_MOST_NEGATIVE_FIXNUM) == 0)
- return SCM_MAKINUM(-1);
+ return SCM_I_MAKINUM(-1);
}
}
else if (SCM_BIGP (numerator))
else
{
if (SCM_EQ_P (numerator, denominator))
- return SCM_MAKINUM(1);
+ return SCM_I_MAKINUM(1);
if (mpz_divisible_p (SCM_I_BIG_MPZ (numerator),
SCM_I_BIG_MPZ (denominator)))
return scm_divide(numerator, denominator);
{
SCM divisor;
divisor = scm_gcd (SCM_FRACTION_NUMERATOR (z), SCM_FRACTION_DENOMINATOR (z));
- if (!(SCM_EQ_P (divisor, SCM_MAKINUM(1))))
+ if (!(SCM_EQ_P (divisor, SCM_I_MAKINUM(1))))
{
/* is this safe? */
SCM_FRACTION_SET_NUMERATOR (z, scm_divide (SCM_FRACTION_NUMERATOR (z), divisor));
if (xx >= 0)
return x;
else if (SCM_POSFIXABLE (-xx))
- return SCM_MAKINUM (-xx);
+ return SCM_I_MAKINUM (-xx);
else
return scm_i_long2big (-xx);
}
{
long z = xx / yy;
if (SCM_FIXABLE (z))
- return SCM_MAKINUM (z);
+ return SCM_I_MAKINUM (z);
else
return scm_i_long2big (z);
}
{
/* Special case: x == fixnum-min && y == abs (fixnum-min) */
scm_remember_upto_here_1 (y);
- return SCM_MAKINUM (-1);
+ return SCM_I_MAKINUM (-1);
}
else
- return SCM_MAKINUM (0);
+ return SCM_I_MAKINUM (0);
}
else
SCM_WTA_DISPATCH_2 (g_quotient, x, y, SCM_ARG2, s_quotient);
else
{
long z = SCM_INUM (x) % yy;
- return SCM_MAKINUM (z);
+ return SCM_I_MAKINUM (z);
}
}
else if (SCM_BIGP (y))
{
/* Special case: x == fixnum-min && y == abs (fixnum-min) */
scm_remember_upto_here_1 (y);
- return SCM_MAKINUM (0);
+ return SCM_I_MAKINUM (0);
}
else
return x;
else
result = z;
}
- return SCM_MAKINUM (result);
+ return SCM_I_MAKINUM (result);
}
}
else if (SCM_BIGP (y))
result = u * k;
}
return (SCM_POSFIXABLE (result)
- ? SCM_MAKINUM (result)
+ ? SCM_I_MAKINUM (result)
: scm_i_long2big (result));
}
else if (SCM_BIGP (y))
result = mpz_gcd_ui (NULL, SCM_I_BIG_MPZ (x), yy);
scm_remember_upto_here_1 (x);
return (SCM_POSFIXABLE (result)
- ? SCM_MAKINUM (result)
+ ? SCM_I_MAKINUM (result)
: scm_ulong2num (result));
}
else if (SCM_BIGP (y))
if (SCM_UNBNDP (n2))
{
if (SCM_UNBNDP (n1))
- return SCM_MAKINUM (1L);
- n2 = SCM_MAKINUM (1L);
+ return SCM_I_MAKINUM (1L);
+ n2 = SCM_I_MAKINUM (1L);
}
SCM_GASSERT2 (SCM_INUMP (n1) || SCM_BIGP (n1),
#ifndef scm_long2num
#define SCM_LOGOP_RETURN(x) scm_ulong2num(x)
#else
-#define SCM_LOGOP_RETURN(x) SCM_MAKINUM(x)
+#define SCM_LOGOP_RETURN(x) SCM_I_MAKINUM(x)
#endif
/* Emulating 2's complement bignums with sign magnitude arithmetic:
if (SCM_UNBNDP (n2))
{
if (SCM_UNBNDP (n1))
- return SCM_MAKINUM (-1);
+ return SCM_I_MAKINUM (-1);
else if (!SCM_NUMBERP (n1))
SCM_WRONG_TYPE_ARG (SCM_ARG1, n1);
else if (SCM_NUMBERP (n1))
if (SCM_INUMP (n2))
{
long nn2 = SCM_INUM (n2);
- return SCM_MAKINUM (nn1 & nn2);
+ return SCM_I_MAKINUM (nn1 & nn2);
}
else if SCM_BIGP (n2)
{
if (SCM_INUMP (n2))
{
long nn2 = SCM_INUM (n2);
- return SCM_MAKINUM (nn1 | nn2);
+ return SCM_I_MAKINUM (nn1 | nn2);
}
else if (SCM_BIGP (n2))
{
if (SCM_INUMP (n2))
{
long nn2 = SCM_INUM (n2);
- return SCM_MAKINUM (nn1 ^ nn2);
+ return SCM_I_MAKINUM (nn1 ^ nn2);
}
else if (SCM_BIGP (n2))
{
Enhancement: No need to strip the tag and add it back, could just xor
a block of 1 bits, if that worked with the various debug versions of
the SCM typedef. */
- return SCM_MAKINUM (~ SCM_INUM (n));
+ return SCM_I_MAKINUM (~ SCM_INUM (n));
} else if (SCM_BIGP (n)) {
SCM result = scm_i_mkbig ();
long i2 = 0;
SCM z_i2 = SCM_BOOL_F;
int i2_is_big = 0;
- SCM acc = SCM_MAKINUM (1L);
+ SCM acc = SCM_I_MAKINUM (1L);
/* 0^0 == 1 according to R5RS */
if (SCM_EQ_P (n, SCM_INUM0) || SCM_EQ_P (n, acc))
return scm_is_false (scm_zero_p(k)) ? n : acc;
- else if (SCM_EQ_P (n, SCM_MAKINUM (-1L)))
+ else if (SCM_EQ_P (n, SCM_I_MAKINUM (-1L)))
return scm_is_false (scm_even_p (k)) ? n : acc;
if (SCM_INUMP (k))
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));
+ SCM div = scm_integer_expt (SCM_I_MAKINUM (2),
+ SCM_I_MAKINUM (-bits_to_shift));
/* scm_quotient assumes its arguments are integers, but it's legal to (ash 1/2 -1) */
if (scm_is_false (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));
+ return scm_sum (SCM_I_MAKINUM (-1L),
+ scm_quotient (scm_sum (SCM_I_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));
+ return scm_product (n, scm_integer_expt (SCM_I_MAKINUM (2), cnt));
}
#undef FUNC_NAME
/* mask down to requisite bits */
bits = min (bits, SCM_I_FIXNUM_BIT);
- return SCM_MAKINUM (in & ((1L << bits) - 1));
+ return SCM_I_MAKINUM (in & ((1L << bits) - 1));
}
else if (SCM_BIGP (n))
{
SCM result;
if (bits == 1)
{
- result = SCM_MAKINUM (mpz_tstbit (SCM_I_BIG_MPZ (n), istart));
+ result = SCM_I_MAKINUM (mpz_tstbit (SCM_I_BIG_MPZ (n), istart));
}
else
{
c += scm_logtab[15 & nn];
nn >>= 4;
}
- return SCM_MAKINUM (c);
+ return SCM_I_MAKINUM (c);
}
else if (SCM_BIGP (n))
{
else
count = mpz_hamdist (SCM_I_BIG_MPZ (n), z_negative_one);
scm_remember_upto_here_1 (n);
- return SCM_MAKINUM (count);
+ return SCM_I_MAKINUM (count);
}
else
SCM_WRONG_TYPE_ARG (SCM_ARG1, n);
l = scm_ilentab [15 & nn];
nn >>= 4;
}
- return SCM_MAKINUM (c - 4 + l);
+ return SCM_I_MAKINUM (c - 4 + l);
}
else if (SCM_BIGP (n))
{
mpz_scan1 (SCM_I_BIG_MPZ (n), 0)) == ULONG_MAX)
size--;
scm_remember_upto_here_1 (n);
- return SCM_MAKINUM (size);
+ return SCM_I_MAKINUM (size);
}
else
SCM_WRONG_TYPE_ARG (SCM_ARG1, n);
return SCM_BOOL_F;
idx++;
- result = SCM_MAKINUM (digit_value);
+ result = SCM_I_MAKINUM (digit_value);
while (idx != len)
{
char c = mem[idx];
idx++;
if (SCM_MOST_POSITIVE_FIXNUM / radix < shift)
{
- result = scm_product (result, SCM_MAKINUM (shift));
+ result = scm_product (result, SCM_I_MAKINUM (shift));
if (add > 0)
- result = scm_sum (result, SCM_MAKINUM (add));
+ result = scm_sum (result, SCM_I_MAKINUM (add));
shift = radix;
add = digit_value;
};
if (shift > 1)
- result = scm_product (result, SCM_MAKINUM (shift));
+ result = scm_product (result, SCM_I_MAKINUM (shift));
if (add > 0)
- result = scm_sum (result, SCM_MAKINUM (add));
+ result = scm_sum (result, SCM_I_MAKINUM (add));
*p_idx = idx;
if (hash_seen)
scm_t_bits shift = 1;
scm_t_bits add = 0;
unsigned int digit_value;
- SCM big_shift = SCM_MAKINUM (1);
+ SCM big_shift = SCM_I_MAKINUM (1);
idx++;
while (idx != len)
idx++;
if (SCM_MOST_POSITIVE_FIXNUM / 10 < shift)
{
- big_shift = scm_product (big_shift, SCM_MAKINUM (shift));
- result = scm_product (result, SCM_MAKINUM (shift));
+ big_shift = scm_product (big_shift, SCM_I_MAKINUM (shift));
+ result = scm_product (result, SCM_I_MAKINUM (shift));
if (add > 0)
- result = scm_sum (result, SCM_MAKINUM (add));
+ result = scm_sum (result, SCM_I_MAKINUM (add));
shift = 10;
add = digit_value;
if (add > 0)
{
- big_shift = scm_product (big_shift, SCM_MAKINUM (shift));
- result = scm_product (result, SCM_MAKINUM (shift));
- result = scm_sum (result, SCM_MAKINUM (add));
+ big_shift = scm_product (big_shift, SCM_I_MAKINUM (shift));
+ result = scm_product (result, SCM_I_MAKINUM (shift));
+ result = scm_sum (result, SCM_I_MAKINUM (add));
}
result = scm_divide (result, big_shift);
scm_out_of_range ("string->number", exp_num);
}
- e = scm_integer_expt (SCM_MAKINUM (10), SCM_MAKINUM (exponent));
+ e = scm_integer_expt (SCM_I_MAKINUM (10), SCM_I_MAKINUM (exponent));
if (sign == 1)
result = scm_product (result, e);
else
else if (!isdigit ((int) (unsigned char) mem[idx + 1]))
return SCM_BOOL_F;
else
- result = mem2decimal_from_point (SCM_MAKINUM (0), mem, len,
+ result = mem2decimal_from_point (SCM_I_MAKINUM (0), mem, len,
p_idx, p_exactness);
}
else
/* When returning an inexact zero, make sure it is represented as a
floating point value so that we can change its sign.
*/
- if (SCM_EQ_P (result, SCM_MAKINUM(0)) && *p_exactness == INEXACT)
+ if (SCM_EQ_P (result, SCM_I_MAKINUM(0)) && *p_exactness == INEXACT)
result = scm_make_real (0.0);
return result;
if (idx != len)
return SCM_BOOL_F;
- return scm_make_rectangular (SCM_MAKINUM (0), SCM_MAKINUM (sign));
+ return scm_make_rectangular (SCM_I_MAKINUM (0), SCM_I_MAKINUM (sign));
}
else
return SCM_BOOL_F;
return SCM_BOOL_F;
if (idx != len)
return SCM_BOOL_F;
- return scm_make_rectangular (SCM_MAKINUM (0), ureal);
+ return scm_make_rectangular (SCM_I_MAKINUM (0), ureal);
case '@':
/* polar input: <real>@<real>. */
SCM imag = mem2ureal (mem, len, &idx, radix, p_exactness);
if (scm_is_false (imag))
- imag = SCM_MAKINUM (sign);
+ imag = SCM_I_MAKINUM (sign);
else if (sign == -1 && scm_is_false (scm_nan_p (ureal)))
imag = scm_difference (imag, SCM_UNDEFINED);
long xx = SCM_INUM (x);
long yy = SCM_INUM (y);
long int z = xx + yy;
- return SCM_FIXABLE (z) ? SCM_MAKINUM (z) : scm_i_long2big (z);
+ return SCM_FIXABLE (z) ? SCM_I_MAKINUM (z) : scm_i_long2big (z);
}
else if (SCM_BIGP (y))
{
{
long xx = -SCM_INUM (x);
if (SCM_FIXABLE (xx))
- return SCM_MAKINUM (xx);
+ return SCM_I_MAKINUM (xx);
else
return scm_i_long2big (xx);
}
long int yy = SCM_INUM (y);
long int z = xx - yy;
if (SCM_FIXABLE (z))
- return SCM_MAKINUM (z);
+ return SCM_I_MAKINUM (z);
else
return scm_i_long2big (z);
}
scm_remember_upto_here_1 (x);
if (sgn_x == 0)
- return SCM_FIXABLE (-yy) ? SCM_MAKINUM (-yy) : scm_long2num (-yy);
+ return SCM_FIXABLE (-yy) ? SCM_I_MAKINUM (-yy) : scm_long2num (-yy);
else
{
SCM result = scm_i_mkbig ();
if (SCM_UNBNDP (y))
{
if (SCM_UNBNDP (x))
- return SCM_MAKINUM (1L);
+ return SCM_I_MAKINUM (1L);
else if (SCM_NUMBERP (x))
return x;
else
{
long yy = SCM_INUM (y);
long kk = xx * yy;
- SCM k = SCM_MAKINUM (kk);
+ SCM k = SCM_I_MAKINUM (kk);
if ((kk == SCM_INUM (k)) && (kk / xx == yy))
return k;
else
{
if (inexact)
return scm_make_real (1.0 / (double) xx);
- else return scm_make_ratio (SCM_MAKINUM(1), x);
+ else return scm_make_ratio (SCM_I_MAKINUM(1), x);
}
}
else if (SCM_BIGP (x))
{
if (inexact)
return scm_make_real (1.0 / scm_i_big2dbl (x));
- else return scm_make_ratio (SCM_MAKINUM(1), x);
+ else return scm_make_ratio (SCM_I_MAKINUM(1), x);
}
else if (SCM_REALP (x))
{
{
long z = xx / yy;
if (SCM_FIXABLE (z))
- return SCM_MAKINUM (z);
+ return SCM_I_MAKINUM (z);
else
return scm_i_long2big (z);
}
/* Adjust so that the scm_round is towards even. */
if (scm_is_true (scm_num_eq_p (plus_half, result))
&& scm_is_true (scm_odd_p (result)))
- return scm_difference (result, SCM_MAKINUM (1));
+ return scm_difference (result, SCM_I_MAKINUM (1));
else
return result;
}
/* For negative x, we need to return q-1 unless x is an
integer. But fractions are never integer, per our
assumptions. */
- return scm_difference (q, SCM_MAKINUM (1));
+ return scm_difference (q, SCM_I_MAKINUM (1));
}
}
else
/* For positive x, we need to return q+1 unless x is an
integer. But fractions are never integer, per our
assumptions. */
- return scm_sum (q, SCM_MAKINUM (1));
+ return scm_sum (q, SCM_I_MAKINUM (1));
}
}
else
scm_denominator (SCM z)
{
if (SCM_INUMP (z))
- return SCM_MAKINUM (1);
+ return SCM_I_MAKINUM (1);
else if (SCM_BIGP (z))
- return SCM_MAKINUM (1);
+ return SCM_I_MAKINUM (1);
else if (SCM_FRACTIONP (z))
{
scm_i_fraction_reduce (z);
if (zz >= 0)
return z;
else if (SCM_POSFIXABLE (-zz))
- return SCM_MAKINUM (-zz);
+ return SCM_I_MAKINUM (-zz);
else
return scm_i_long2big (-zz);
}
SCM ex = scm_inexact_to_exact (x);
SCM int_part = scm_floor (ex);
- SCM tt = SCM_MAKINUM (1);
- SCM a1 = SCM_MAKINUM (0), a2 = SCM_MAKINUM (1), a = SCM_MAKINUM (0);
- SCM b1 = SCM_MAKINUM (1), b2 = SCM_MAKINUM (0), b = SCM_MAKINUM (0);
+ SCM tt = SCM_I_MAKINUM (1);
+ SCM a1 = SCM_I_MAKINUM (0), a2 = SCM_I_MAKINUM (1), a = SCM_I_MAKINUM (0);
+ SCM b1 = SCM_I_MAKINUM (1), b2 = SCM_I_MAKINUM (0), b = SCM_I_MAKINUM (0);
SCM rx;
int i = 0;
}
#undef FUNC_NAME
-/* if you need to change this, change test-num2integral.c as well */
-#if SCM_SIZEOF_LONG_LONG != 0
-# ifndef LLONG_MAX
-# define ULLONG_MAX ((unsigned long long) (-1))
-# define LLONG_MAX ((long long) (ULLONG_MAX >> 1))
-# define LLONG_MIN (~LLONG_MAX)
-# endif
-#endif
-
/* Parameters for creating integer conversion routines.
Define the following preprocessor macros before including
#if SCM_SIZEOF_LONG_LONG != 0
-#ifndef ULONG_LONG_MAX
-#define ULONG_LONG_MAX (~0ULL)
-#endif
-
#define NUM2INTEGRAL scm_num2long_long
#define INTEGRAL2NUM scm_long_long2num
#define INTEGRAL2BIG scm_i_long_long2big
if (min >= SCM_MOST_NEGATIVE_FIXNUM && max <= SCM_MOST_POSITIVE_FIXNUM)
return 0;
else if (min >= LONG_MIN && max <= LONG_MAX)
- return (mpz_cmp_si (SCM_I_BIG_MPZ (val), min) >= 0
- && mpz_cmp_si (SCM_I_BIG_MPZ (val), max) <= 0);
+ {
+ if (mpz_fits_slong_p (SCM_I_BIG_MPZ (val)))
+ {
+ long n = mpz_get_si (SCM_I_BIG_MPZ (val));
+ return n >= min && n <= max;
+ }
+ else
+ return 0;
+ }
else
{
- /* Get the big hammer. */
+ scm_t_intmax n;
+ size_t count;
- mpz_t bigmin, bigmax;
- int res;
+ if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
+ > CHAR_BIT*sizeof (scm_t_uintmax))
+ return 0;
+
+ mpz_export (&n, &count, 1, sizeof (scm_t_uintmax), 0, 0,
+ SCM_I_BIG_MPZ (val));
- mpz_init (bigmin);
- if (min >= 0)
- mpz_import (bigmin, 1, 1, sizeof (scm_t_intmax), 0, 0, &min);
- else
+ if (mpz_sgn (SCM_I_BIG_MPZ (val)) >= 0)
{
- /* Magically works for min == INTMAX_MIN as well. */
- min = -min;
- mpz_import (bigmin, 1, 1, sizeof (scm_t_intmax), 0, 0, &min);
- mpz_neg (bigmin, bigmin);
+ if (n < 0)
+ return 0;
}
- res = mpz_cmp (SCM_I_BIG_MPZ (val), bigmin);
- mpz_clear (bigmin);
- if (res < 0)
- return 0;
-
- mpz_init (bigmax);
- if (max >= 0)
- mpz_import (bigmax, 1, 1, sizeof (scm_t_intmax), 0, 0, &max);
else
{
- /* Magically works for max == INTMAX_MIN as well. */
- max = -max;
- mpz_import (bigmax, 1, 1, sizeof (scm_t_intmax), 0, 0, &max);
- mpz_neg (bigmax, bigmax);
+ n = -n;
+ if (n >= 0)
+ return 0;
}
- res = mpz_cmp (SCM_I_BIG_MPZ (val), bigmax);
- mpz_clear (bigmax);
- return res <= 0;
+
+ return n >= min && n <= max;
}
}
else if (SCM_REALP (val))
if (max <= SCM_MOST_POSITIVE_FIXNUM)
return 0;
else if (max <= ULONG_MAX)
- return (mpz_cmp_ui (SCM_I_BIG_MPZ (val), min) >= 0
- && mpz_cmp_ui (SCM_I_BIG_MPZ (val), max) <= 0);
+ {
+ if (mpz_fits_ulong_p (SCM_I_BIG_MPZ (val)))
+ {
+ unsigned long n = mpz_get_ui (SCM_I_BIG_MPZ (val));
+ return n >= min && n <= max;
+ }
+ else
+ return 0;
+ }
else
{
- /* Get the big hammer. */
+ scm_t_uintmax n;
+ size_t count;
- mpz_t bigmin, bigmax;
- int res;
+ if (mpz_sgn (SCM_I_BIG_MPZ (val)) < 0)
+ return 0;
- mpz_init (bigmin);
- mpz_import (bigmin, 1, 1, sizeof (scm_t_uintmax), 0, 0, &min);
- res = mpz_cmp (SCM_I_BIG_MPZ (val), bigmin);
- mpz_clear (bigmin);
- if (res < 0)
+ if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
+ > CHAR_BIT*sizeof (scm_t_uintmax))
return 0;
+
+ mpz_export (&n, &count, 1, sizeof (scm_t_uintmax), 0, 0,
+ SCM_I_BIG_MPZ (val));
- mpz_init (bigmax);
- mpz_import (bigmax, 1, 1, sizeof (scm_t_intmax), 0, 0, &max);
- res = mpz_cmp (SCM_I_BIG_MPZ (val), bigmax);
- mpz_clear (bigmax);
- return res <= 0;
+ return n >= min && n <= max;
}
}
else if (SCM_REALP (val))
{
double n = SCM_REAL_VALUE (val);
- return n == floor(n) && n >= min && n <= max;
+ return n == floor (n) && n >= min && n <= max;
}
else
return 0;
size_t count;
if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
- > 8*sizeof (scm_t_uintmax))
+ > CHAR_BIT*sizeof (scm_t_uintmax))
goto out_of_range;
mpz_export (&n, &count, 1, sizeof (scm_t_uintmax), 0, 0,
return n;
else
goto out_of_range;
- }
+ }
else
goto out_of_range;
}
goto out_of_range;
if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
- > 8*sizeof (scm_t_uintmax))
+ > CHAR_BIT*sizeof (scm_t_uintmax))
goto out_of_range;
mpz_export (&n, &count, 1, sizeof (scm_t_uintmax), 0, 0,
scm_from_signed_integer (scm_t_intmax val)
{
if (SCM_FIXABLE (val))
- return SCM_MAKINUM (val);
+ return SCM_I_MAKINUM (val);
else if (val >= LONG_MIN && val <= LONG_MAX)
{
SCM z = scm_double_cell (scm_tc16_big, 0, 0, 0);
scm_from_unsigned_integer (scm_t_uintmax val)
{
if (SCM_POSFIXABLE (val))
- return SCM_MAKINUM (val);
+ return SCM_I_MAKINUM (val);
else if (val <= ULONG_MAX)
{
SCM z = scm_double_cell (scm_tc16_big, 0, 0, 0);
CHECK (long_long, 0LL);
CHECK (ulong_long, 0ULL);
CHECK (long_long, -1LL);
- CHECK (long_long, LLONG_MAX);
- CHECK (long_long, LLONG_MIN);
- CHECK (ulong_long, ULLONG_MAX);
+ CHECK (long_long, SCM_I_LLONG_MAX);
+ CHECK (long_long, SCM_I_LLONG_MIN);
+ CHECK (ulong_long, SCM_I_ULLONG_MAX);
#endif
}
"Number conversion sanity checking.")
#define FUNC_NAME s_scm_sys_check_number_conversions
{
- SCM data = SCM_MAKINUM (-1);
+ SCM data = SCM_I_MAKINUM (-1);
CHECK;
data = scm_int2num (INT_MIN);
CHECK;
data = scm_difference (SCM_INUM0, data);
CHECK;
data = scm_ulong2num (ULONG_MAX);
- data = scm_sum (SCM_MAKINUM (1), data); data = scm_difference (SCM_INUM0, data);
+ data = scm_sum (SCM_I_MAKINUM (1), data); data = scm_difference (SCM_INUM0, data);
CHECK;
data = scm_int2num (-10000); data = scm_product (data, data); data = scm_product (data, data);
CHECK;
* using these values, remember the two rules of program optimization:
* 1st Rule: Don't do it. 2nd Rule (experts only): Don't do it yet. */
scm_c_define ("most-positive-fixnum",
- SCM_MAKINUM (SCM_MOST_POSITIVE_FIXNUM));
+ SCM_I_MAKINUM (SCM_MOST_POSITIVE_FIXNUM));
scm_c_define ("most-negative-fixnum",
- SCM_MAKINUM (SCM_MOST_NEGATIVE_FIXNUM));
+ SCM_I_MAKINUM (SCM_MOST_NEGATIVE_FIXNUM));
scm_add_feature ("complex");
scm_add_feature ("inexact");
check_sanity ();
#endif
- exactly_one_half = scm_permanent_object (scm_divide (SCM_MAKINUM (1),
- SCM_MAKINUM (2)));
+ exactly_one_half = scm_permanent_object (scm_divide (SCM_I_MAKINUM (1),
+ SCM_I_MAKINUM (2)));
#include "libguile/numbers.x"
}