[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ratio implementation

From: Kevin Ryde
Subject: Re: ratio implementation
Date: Sat, 18 Oct 2003 10:45:23 +1000
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Marius Vollmer <address@hidden> writes:
>       mpq_init (frac);
>       mpq_set_d (frac, SCM_REAL_VALUE (z));
>       q = scm_make_ratio (scm_i_mpz2num (mpq_numref (frac)),
>                         scm_i_mpz2num (mpq_denref (frac)));
>       mpq_clear (frac);

Yep, that's about it.

I guess the num and den from the mpq_t could be copied directly into
bignums and used as mpz_t's from then on, rather than initializing new

Just have to think a bit whether that would be compatible going
forward.  We already allow arbitrary mpz calculations on the two
parts, just have to decide if that can include clearing :).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]