(scm_string_concatenate, scm_string_concatenate_shared):
[bpt/guile.git] / libguile / numbers.h
index dc1f4c2..746dd00 100644 (file)
@@ -3,7 +3,7 @@
 #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
@@ -22,6 +22,8 @@
 
 \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
 
@@ -206,7 +210,8 @@ SCM_API SCM scm_bit_extract (SCM n, SCM start, SCM end);
 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);
@@ -241,8 +246,8 @@ SCM_API SCM scm_ceiling (SCM x);
 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);
@@ -266,6 +271,7 @@ SCM_API SCM scm_i_dbl2num (double d);
 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);
@@ -277,6 +283,10 @@ SCM_API double scm_i_fraction2double (SCM z);
 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);
@@ -323,6 +333,10 @@ SCM_API SCM          scm_from_uint64 (scm_t_uint64 x);
 
 #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.