#ifndef SCM_NUMBERS_H
#define SCM_NUMBERS_H
-/* Copyright (C) 1995,1996,1998,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
\f
+#include <gmp.h>
+
#include "libguile/__scm.h"
#include "libguile/print.h"
#endif /* def FLT_MAX */
-/* SCM_INTBUFLEN is the maximum number of characters neccessary for the
- * printed or scm_string representation of an exact immediate.
+/* SCM_INTBUFLEN is the maximum number of characters neccessary for
+ * the printed or scm_string representation of an scm_t_intmax in
+ * radix 2. The buffer passed to scm_iint2str and scm_iuint2str must
+ * be of this size, for example.
*/
-#define SCM_INTBUFLEN (5 + SCM_LONG_BIT)
+#define SCM_INTBUFLEN (5 + SCM_CHAR_BIT*sizeof(scm_t_intmax))
\f
SCM_API SCM scm_logcount (SCM n);
SCM_API SCM scm_integer_length (SCM n);
-SCM_API size_t scm_iint2str (long num, int rad, char *p);
+SCM_API size_t scm_iint2str (scm_t_intmax num, int rad, char *p);
+SCM_API size_t scm_iuint2str (scm_t_uintmax num, int rad, char *p);
SCM_API SCM scm_number_to_string (SCM x, SCM radix);
SCM_API int scm_print_real (SCM sexp, SCM port, scm_print_state *pstate);
SCM_API int scm_print_complex (SCM sexp, SCM port, scm_print_state *pstate);
SCM_API double scm_asinh (double x);
SCM_API double scm_acosh (double x);
SCM_API double scm_atanh (double x);
-SCM_API double scm_truncate (double x);
-SCM_API double scm_round (double x);
+SCM_API double scm_c_truncate (double x);
+SCM_API double scm_c_round (double x);
SCM_API SCM scm_truncate_number (SCM x);
SCM_API SCM scm_round_number (SCM x);
SCM_API SCM scm_sys_expt (SCM z1, SCM z2);
SCM_API double scm_i_big2dbl (SCM b);
SCM_API SCM scm_i_long2big (long n);
SCM_API SCM scm_i_ulong2big (unsigned long n);
+SCM_API SCM scm_i_clonebig (SCM src_big, int same_sign_p);
/* ratio functions */
SCM_API SCM scm_rationalize (SCM x, SCM err);
SCM_API SCM scm_i_fraction_equalp (SCM x, SCM y);
SCM_API int scm_i_print_fraction (SCM sexp, SCM port, scm_print_state *pstate);
+/* general internal functions */
+SCM_API void scm_i_print_double (double val, SCM port);
+SCM_API void scm_i_print_complex (double real, double imag, SCM port);
+
/* conversion functions for integers */
SCM_API int scm_is_integer (SCM val);
#endif
+SCM_API void scm_to_mpz (SCM x, mpz_t rop);
+SCM_API SCM scm_from_mpz (mpz_t rop);
+
+
/* The conversion functions for other types are aliased to the
appropriate ones from above. We pick the right one based on the
size of the type.