#include <math.h>
#include <ctype.h>
#include <string.h>
-#include <gmp.h>
#include "libguile/_scm.h"
#include "libguile/feature.h"
#endif
+void
+scm_to_mpz (SCM val, mpz_t rop)
+{
+ if (SCM_I_INUMP (val))
+ mpz_set_si (rop, SCM_I_INUM (val));
+ else if (SCM_BIGP (val))
+ mpz_set (rop, SCM_I_BIG_MPZ (val));
+ else
+ scm_wrong_type_arg_msg (NULL, 0, val, "exact integer");
+}
+
+SCM
+scm_from_mpz (mpz_t val)
+{
+ return scm_i_mpz2num (val);
+}
+
int
scm_is_real (SCM val)
{
\f
+#include <gmp.h>
+
#include "libguile/__scm.h"
#include "libguile/print.h"
#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.