librep r2948 - in trunk: . src
- From: chrisb svn gnome org
- To: svn-commits-list gnome org
- Subject: librep r2948 - in trunk: . src
- Date: Sat, 18 Oct 2008 12:09:14 +0000 (UTC)
Author: chrisb
Date: Sat Oct 18 12:09:14 2008
New Revision: 2948
URL: http://svn.gnome.org/viewvc/librep?rev=2948&view=rev
Log:
src/numbers.c: fixed an issue with FreeBSD and improved a function [FreeBSD patches]
Modified:
trunk/ChangeLog
trunk/src/numbers.c
Modified: trunk/src/numbers.c
==============================================================================
--- trunk/src/numbers.c (original)
+++ trunk/src/numbers.c Sat Oct 18 12:09:14 2008
@@ -111,6 +111,11 @@
# endif
#endif
+#ifdef __FreeBSD__
+# define LONG_LONG_MIN LONG_MIN
+# define LONG_LONG_MAX LONG_MAX
+#endif
+
typedef struct {
repv car;
#ifdef HAVE_GMP
@@ -2693,13 +2698,14 @@
#ifdef HAVE_GMP
else
{
- rep_number_q *q;
+ double x, y;
+ rep_number_z *z;
- q = make_number (rep_NUMBER_RATIONAL);
- mpq_init (q->q);
- mpq_set_d (q->q, rep_get_float (arg));
+ rationalize (arg, &x, &y);
+ z = make_number (rep_NUMBER_BIGNUM);
+ mpz_init_set_d (z->z, (x / y));
- return maybe_demote (rep_VAL (q));
+ return maybe_demote (rep_VAL (z));
}
#else
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]