From: Mark H Weaver <mhw@netris.org>
To: "Göran Weinholt" <goran@weinholt.se>
Cc: 14865-done@debbugs.gnu.org
Subject: bug#14865: flmax and flmin do not handle +nan.0 correctly
Date: Tue, 16 Jul 2013 05:27:30 -0400 [thread overview]
Message-ID: <8738re4zy5.fsf@tines.lan> (raw)
In-Reply-To: <874nbw84cs.fsf@industria.weinholt.se> ("Göran Weinholt"'s message of "Mon, 15 Jul 2013 13:11:47 +0200")
Göran Weinholt <goran@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
prev parent reply other threads:[~2013-07-16 9:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-15 11:11 bug#14865: flmax and flmin do not handle +nan.0 correctly Göran Weinholt
2013-07-16 9:27 ` Mark H Weaver [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8738re4zy5.fsf@tines.lan \
--to=mhw@netris.org \
--cc=14865-done@debbugs.gnu.org \
--cc=goran@weinholt.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).