unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* What version of GMP should we require?
@ 2011-02-23  1:33 Mark H Weaver
  2011-02-23 15:40 ` Mark H Weaver
  2011-02-24 19:39 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Mark H Weaver @ 2011-02-23  1:33 UTC (permalink / raw)
  To: guile-devel

Hello all,

I recently noticed that scm_i_big2dbl contains some crufty and
inefficient compatibility code to work around unspecified rounding
behavior of mpz_get_d in GMP prior to version 4.2.  GMP 4.2 was released
in March 2006 and has been in Debian since sarge (now oldstable).

How would you feel about making Guile 2.0.x require GMP 4.2 or later?
I'm hoping to fix several bugs having to do with rounding in 2.0.x, and
it would simplify things quite a bit if I could trust the rounding
behavior of mpz_get_d.

    Best,
     Mark



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What version of GMP should we require?
  2011-02-23  1:33 What version of GMP should we require? Mark H Weaver
@ 2011-02-23 15:40 ` Mark H Weaver
  2011-02-24 19:39 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2011-02-23 15:40 UTC (permalink / raw)
  To: guile-devel

I wrote:
> I recently noticed that scm_i_big2dbl contains some crufty and
> inefficient compatibility code to work around unspecified rounding
> behavior of mpz_get_d in GMP prior to version 4.2.  GMP 4.2 was released
> in March 2006 and has been in Debian since sarge (now oldstable).

Sorry, I meant to write "lenny".  GMP 4.2 is in lenny, but not in sarge.

In any case, I've since found a couple more reasons why requiring GMP
4.2 would be useful.  There's another workaround for mpz_cmp_d, which
did not recognize infinities before 4.2.

More importantly to me is that I have a preliminary patch set to add the
R6RS exact-integer-sqrt, as well as the more general exact-integer-root;
these both return the floor of the root and the remainder.  Based on
these, the patch set also makes sqrt and expt return exact rationals
when possible (as is done in Gambit), which apart from exactness allows
them to work on huge bignums and fractions.  Even in the inexact case,
the patch set makes sqrt and expt work properly when the result can fit
in a double but when the argument is a bignum or fraction too large (or
too small) to fit in a double.

I was hoping to apply these changes to the 2.0 branch, but
exact-integer-root and the enhancements to expt depend on mpz_rootrem,
which was introduced in GMP 4.2.  I could reimplement its functionality
if needed, but the result would surely be somewhat slower.

> How would you feel about making Guile 2.0.x require GMP 4.2 or later?
> I'm hoping to fix several bugs having to do with rounding in 2.0.x, and
> it would simplify things quite a bit if I could trust the rounding
> behavior of mpz_get_d.
>
>     Best,
>      Mark



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What version of GMP should we require?
  2011-02-23  1:33 What version of GMP should we require? Mark H Weaver
  2011-02-23 15:40 ` Mark H Weaver
@ 2011-02-24 19:39 ` Ludovic Courtès
  2011-02-24 20:20   ` Mark H Weaver
  1 sibling, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2011-02-24 19:39 UTC (permalink / raw)
  To: guile-devel

Hi Mark,

Mark H Weaver <mhw@netris.org> writes:

> I recently noticed that scm_i_big2dbl contains some crufty and
> inefficient compatibility code to work around unspecified rounding
> behavior of mpz_get_d in GMP prior to version 4.2.  GMP 4.2 was released
> in March 2006 and has been in Debian since sarge (now oldstable).
>
> How would you feel about making Guile 2.0.x require GMP 4.2 or later?

I like the suggestion, but I’m uncomfortable with making this change in 2.0.

> I was hoping to apply these changes to the 2.0 branch, but
> exact-integer-root and the enhancements to expt depend on mpz_rootrem,
> which was introduced in GMP 4.2.  I could reimplement its functionality
> if needed, but the result would surely be somewhat slower.

For 2.0, what about AC_CHECK_LIB ‘mpz_rootrem’, and provide a
replacement when it’s not available?  It doesn’t really matter if the
replacement is slower since less and less people will need it, but
still, that would allow us to not break people’s expectations regarding
compatibility.

In ‘master’ you can of course require 4.2 and clean things up as you see
fit.  :-)

How would that work for you?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What version of GMP should we require?
  2011-02-24 19:39 ` Ludovic Courtès
@ 2011-02-24 20:20   ` Mark H Weaver
  0 siblings, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2011-02-24 20:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

ludo@gnu.org (Ludovic Courtès) writes:
> For 2.0, what about AC_CHECK_LIB ‘mpz_rootrem’, and provide a
> replacement when it’s not available?  [...]

Sounds reasonable.

> In ‘master’ you can of course require 4.2 and clean things up as you see
> fit.  :-)

Great, thanks! :)

     Mark



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-24 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-23  1:33 What version of GMP should we require? Mark H Weaver
2011-02-23 15:40 ` Mark H Weaver
2011-02-24 19:39 ` Ludovic Courtès
2011-02-24 20:20   ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).