Hi Mark! Mark H Weaver <m...@netris.org> skribis:
> ni...@lysator.liu.se (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’.