[Top][All Lists]

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

Re: [PATCH] Fix bugs in expt and integer-expt

From: Ludovic Courtès
Subject: Re: [PATCH] Fix bugs in expt and integer-expt
Date: Wed, 10 Nov 2010 23:01:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)


Looks good to me, now that I know about inexact integers.  ;-)

Just a couple of details:

Mark H Weaver <address@hidden> writes:

> From 19a24107af814e34fe63d02478bfb9441354625e Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <address@hidden>
> Date: Thu, 4 Nov 2010 22:10:02 -0400
> Subject: [PATCH] Fix bugs in expt and integer-expt
> * libguile/numbers.c (expt): Fix bug that caused expt to throw an
>   exception whenever the base was exact and the exponent was an
>   inexact integer, e.g. (expt 5 6.0).
>   (expt): Fix bug that caused expt to introduce spurious imaginary
>   parts in the result when the base was an inexact negative real and
>   the exponent was an integer, e.g. (expt -1.0 2)
>   (integer-expt, expt): Change behavior of (integer-expt 0 -1), and
>   therefore also (expt 0 -1), to return NaN, per R6RS (actually, R6RS
>   says we should throw an exception or return an "unspecified number
>   object", but for now we use NaN).  Formerly we returned 0, per R5RS.
>   R5RS claims that 0^x=0 for all non-zero x, but that's mathematically
>   incorrect, and probably an oversight.
>   (integer-expt): Consistently throw a wrong-argument-type exception
>   when the exponent is inexact.  Formerly, it didn't always check this
>   if the base was 0, 1, or -1.
> * test-suite/tests/numbers.test ("integer-expt", "expt"): Add tests.

Please use the C function names for C code, in the log.

Also, can you add a reference to bug #31464 in the log and next to the
corresponding test cases?

Finally, can you document the change for 0^x with x != 0 in NEWS and
explain the departure from R5RS in doc/ref/api-data.texi?



reply via email to

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