GNU bug report logs - #14865
flmax and flmin do not handle +nan.0 correctly

Previous Next

Package: guile;

Reported by: Göran Weinholt <goran <at> weinholt.se>

Date: Mon, 15 Jul 2013 11:15:03 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14865 in the body.
You can then email your comments to 14865 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#14865; Package guile. (Mon, 15 Jul 2013 11:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Göran Weinholt <goran <at> weinholt.se>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 15 Jul 2013 11:15:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Göran Weinholt <goran <at> weinholt.se>
To: bug-guile <at> gnu.org
Subject: flmax and flmin do not handle +nan.0 correctly
Date: Mon, 15 Jul 2013 13:11:47 +0200
[Message part 1 (text/plain, inline)]
Hello schemers,

the flmax and flmin procedures from (rnrs) do not handle +nan.0
correctly:

scheme@(guile-user)> (import (rnrs))
scheme@(guile-user)> (flmax +inf.0 +nan.0)
$1 = +inf.0
scheme@(guile-user)> (flmin -inf.0 +nan.0)
$2 = -inf.0

The result should be +nan.0. From r6rs-lib: "They always return a NaN
when one or more of the arguments is a NaN." Tested with
2.0.9.22-7e816-dirty.

Regards,

-- 
Göran Weinholt <goran <at> weinholt.se>
It's a beautiful day.
Don't let it get away.
[Message part 2 (application/pgp-signature, inline)]

Reply sent to Mark H Weaver <mhw <at> netris.org>:
You have taken responsibility. (Tue, 16 Jul 2013 09:28:02 GMT) Full text and rfc822 format available.

Notification sent to Göran Weinholt <goran <at> weinholt.se>:
bug acknowledged by developer. (Tue, 16 Jul 2013 09:28:02 GMT) Full text and rfc822 format available.

Message #10 received at 14865-done <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Göran Weinholt <goran <at> weinholt.se>
Cc: 14865-done <at> debbugs.gnu.org
Subject: Re: bug#14865: flmax and flmin do not handle +nan.0 correctly
Date: Tue, 16 Jul 2013 05:27:30 -0400
Göran Weinholt <goran <at> weinholt.se> writes:

> the flmax and flmin procedures from (rnrs) do not handle +nan.0
> correctly:
>
> scheme@(guile-user)> (import (rnrs))
> scheme@(guile-user)> (flmax +inf.0 +nan.0)
> $1 = +inf.0
> scheme@(guile-user)> (flmin -inf.0 +nan.0)
> $2 = -inf.0
>
> The result should be +nan.0. From r6rs-lib: "They always return a NaN
> when one or more of the arguments is a NaN."

Indeed.  I had actually carefully implemented 'min' and 'max' according
to R6RS section 11.7.4 (Numerical operations), which states:

   For any real number object x:
     (max +inf.0 x) => +inf.0
     (min -inf.0 x) => -inf.0

and section 3.5 states that NaNs are real number objects.

At first I was baffled by the inconsistency between min/max and
flmin/flmax, but now I see that the R6RS errata corrected this:

   The examples for min and max involving infinities should be prefixed by:
   "For any real number object x /that is not a NaN/:"

Fixed in b4c55c9ccedd47c16007b590f064ef3bd67565aa.

    Thanks!
      Mark




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 Aug 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 230 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.