[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10519: guile and (mini-)gmp
From: |
Ludovic Courtès |
Subject: |
bug#10519: guile and (mini-)gmp |
Date: |
Sun, 22 Jul 2012 11:04:25 +0200 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux) |
Hi Mark!
Mark H Weaver <address@hidden> skribis:
> address@hidden (Niels Möller) writes:
>> 2. The next problem is maybe more a nuisance than a real problem. I'm
>> looking at scm_i_big2dbl, in numbers.c.
>>
>> I notice this code doesn't currently use mpz_get_d (comment says
>> that's because gmp-4.2 and earlier didn't do well-defined rounding).
[...]
> Don't worry about this. I have a patch set that (among other things)
> reimplements scm_i_big2dbl in a much more robust way, with proper
> rounding, and without using such low-level GMP accessors. I posted this
> patch set to guile-devel on 7 Oct, "[PATCH] Improvements to exact
> rationals et al". I will resubmit it soon.
Apparently this didn’t make it into the tree yet, right? Could you
resubmit it?
>> 3. Occcasional use of mpq functions (do_divide, scm_inexact_to_exact),
>> for conversion of fradctions to and from doubles. mini-gmp has no
>> mpq-functions (and it shouldn't have), so these calls have to either
>> be eliminated altogether, or be made conditional on HAVE_LIBGMP.
>>
>> For conversion double->fraction, mpq seems overkill: Just multiply by
>> a power of two to make the number an integer, to construct a fraction
>> p / 2^k, and then eliminate any common factors of two (if fractions
>> are required to be in some canonical form).
>
> Agreed. I can easily reimplement this to avoid the mpq functions, and
> will do so.
Nice. Could you look into it? :-)
Thanks!
Ludo’.