Re: fix for expt bug

2010-11-21 Thread Ludovic Courtès
Hi, Andy Wingo wi...@pobox.com writes: There is also Mike Sperber's paper a few years ago about Scheme's numeric tower being borked. Anyway, just to say that you're in good company :) Heh, good to know, and interesting link! Ludo’.

Re: fix for expt bug

2010-11-20 Thread Andy Wingo
Hi, On Mon 08 Nov 2010 22:08, l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org writes: No, (integer? 3.0) returns #t, as it should, according to R5RS. R5RS's description of integer? gives this precise example, and guile's implementation agrees. Damn, I had never

Re: fix for expt bug

2010-11-08 Thread Ludovic Courtès
Hi Mark! Mark H Weaver m...@netris.org writes: No, (integer? 3.0) returns #t, as it should, according to R5RS. R5RS's description of integer? gives this precise example, and guile's implementation agrees. Damn, I had never realized that, shame on me. Ludo’.

Re: fix for expt bug

2010-11-04 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes: I just realized that there is a better way to fix these bugs. We don't need a new top-level case in expt after all. Instead, we generalize the scm_integer_expt case to support inexact integer exponents. You mean “inexact number”, right? No, I meant

Re: fix for expt bug

2010-11-03 Thread Ramakrishnan Muthukrishnan
Thanks again, Mark and Ludovic. Attached is an updated patch. thanks --   Ramakrishnan From a1dd2da8562ddeb2052f2994ad0302bcc8d5d1a2 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan vu3...@gmail.com Date: Sun, 31 Oct 2010 23:22:52 +0530 Subject: [PATCH] Adding a case for `expt' when

Re: fix for expt bug

2010-11-03 Thread Mark H Weaver
Hi Ramakrishnan, We're almost there, but you neglected one of the comments I made about your previous patch. + /* If base is negative, expt needs to find -x^n = (-1^n) * (x^n). + We find x^n and then if n is odd, we also multiply the result + with -1. These changes apply

Re: fix for expt bug

2010-11-03 Thread Mark H Weaver
Ramakrishnan and others, I just realized that there is a better way to fix these bugs. We don't need a new top-level case in expt after all. Instead, we generalize the scm_integer_expt case to support inexact integer exponents. Within that case, if the exponent is an inexact integer, then we

Re: fix for expt bug

2010-11-03 Thread Ramakrishnan Muthukrishnan
On Wed, Nov 3, 2010 at 9:02 PM, Mark H Weaver m...@netris.org wrote: Hi Ramakrishnan, We're almost there, but you neglected one of the comments I made about your previous patch. Sorry, I should pay more attention. :-( Attaching the modified patch. --   Ramakrishnan From

Re: fix for expt bug

2010-11-03 Thread Ramakrishnan Muthukrishnan
On Wed, Nov 3, 2010 at 9:52 PM, Mark H Weaver m...@netris.org wrote: Ramakrishnan and others, I just realized that there is a better way to fix these bugs.  We don't need a new top-level case in expt after all.  Instead, we generalize the scm_integer_expt case to support inexact integer

Re: fix for expt bug

2010-11-03 Thread Ramakrishnan Muthukrishnan
On Wed, Nov 3, 2010 at 11:23 PM, Ramakrishnan Muthukrishnan vu3...@gmail.com wrote: On Wed, Nov 3, 2010 at 9:52 PM, Mark H Weaver m...@netris.org wrote: Ramakrishnan and others, I just realized that there is a better way to fix these bugs.  We don't need a new top-level case in expt after

Re: fix for expt bug

2010-11-03 Thread Ludovic Courtès
Hi Mark, Mark H Weaver m...@netris.org writes: I just realized that there is a better way to fix these bugs. We don't need a new top-level case in expt after all. Instead, we generalize the scm_integer_expt case to support inexact integer exponents. You mean “inexact number”, right? The

Re: fix for expt bug

2010-11-02 Thread Mark H Weaver
Hi Ramakrishnan, The code in your latest patch looks good to me, though the commit message has some problems, and I'd add more test cases: * libguile/numbers.c: If base is negative, expt needs to find -x^n = (-1^n) * (|x|^n). We find x^n and then if n is odd, we also multiply the result

Re: fix for expt bug

2010-11-02 Thread Mark H Weaver
Hi Ramakrishnan, I noticed one more problem with your commit message. It should mention the other included bug fix, for when the exponent is an inexact integer, e.g. (expt 2 2.0). Thanks, Mark

Re: fix for expt bug

2010-11-01 Thread Ramakrishnan Muthukrishnan
. The patch fixes this too.) Also adds some test cases. Please review. Thanks Ramakrishnan From 025bde78d4c199dee1d2857e913d69ce4d7c2e59 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan vu3...@gmail.com Date: Sun, 31 Oct 2010 23:22:52 +0530 Subject: [PATCH] Fix for bug #31464. expt needs

Re: fix for expt bug

2010-11-01 Thread Mark H Weaver
Hi Ramakrishnan, Thanks for the revised patch. There are still some problems: diff --git a/libguile/numbers.c b/libguile/numbers.c index fbc6cc8..5bbf4b0 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -5445,12 +5445,30 @@ SCM_DEFINE (scm_expt, expt, 2, 0, 0, Return

Re: fix for expt bug

2010-11-01 Thread Ramakrishnan Muthukrishnan
Here is the updated patch. thanks Ramakrishnan From e320d79c8f3cd8b7ddcb9c2d13356e34a3346cfe Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan vu3...@gmail.com Date: Sun, 31 Oct 2010 23:22:52 +0530 Subject: [PATCH] Fix for bug #31464. expt needs to treat negative bases specially

fix for expt bug

2010-10-31 Thread Ramakrishnan Muthukrishnan
2001 From: Ramakrishnan Muthukrishnan vu3...@gmail.com Date: Sun, 31 Oct 2010 23:22:52 +0530 Subject: [PATCH] Fix for bug #31464. expt needs to treat negative bases specially. Also adding test-suite cases for expt. * libguile/numbers.c: if base is negative, find the absolute value of the base

Re: fix for expt bug

2010-10-31 Thread Mark H Weaver
it. thanks --   Ramakrishnan From c23939a1c2b7bfe1b3cf20abb6a7b431699281a1 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan vu3...@gmail.com Date: Sun, 31 Oct 2010 23:22:52 +0530 Subject: [PATCH] Fix for bug #31464. expt needs to treat negative bases specially. Also adding test

Re: fix for expt bug

2010-10-31 Thread Ramakrishnan Muthukrishnan
On Mon, Nov 1, 2010 at 5:33 AM, Mark H Weaver m...@netris.org wrote: Ramakrishnan, Your fix is incorrect.  You have assumed that (-a)^b = -(a^b), Mark, Yes, you are right. Not sure what I was thinking when I made the patch. :-( The reported bug is simply due to roundoff error.  You must