From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] First batch of numerics changes
Date: Fri, 28 Jan 2011 13:19:51 +0100 [thread overview]
Message-ID: <m3pqrhdxug.fsf@unquote.localdomain> (raw)
In-Reply-To: <87fwse3stg.fsf@yeeloong.netris.org> (Mark H. Weaver's message of "Thu, 27 Jan 2011 17:06:19 -0500")
Hi Mark,
On Thu 27 Jan 2011 23:06, Mark H Weaver <mhw@netris.org> writes:
> I'm having second thoughts about two of the patches:
>
> * Patch 0010: `inf?' and `nan?' throw exceptions when applied to
> non-numbers
>
> Previously, these predicates would return #f in that case. I tend to
> prefer strictness, but perhaps backward compatibility is more important
> than strictness here. What do you think?
I think that certainly when it comes to numbers, strictness is good. In
particular the r6rs says:
(zero? z) procedure
(positive? x) procedure
(negative? x) procedure
(odd? n) procedure
(even? n) procedure
(finite? x) procedure
(infinite? x) procedure
(nan? x) procedure
The name of the argument indicates the type, as noted earlier in the
report. `z' is a complex number, `x' is a real, and `n' is an integer.
It is an error to pass a non-integer to even?. It is also an error to
pass a non-real to infinite?.
(Note that the domain of first 5 predicates is specified in R5RS as
well.)
Given that the R5RS does not discuss infinities, and they were only
added in Guile 1.8 (I believe), I think we have some room for change.
We should change to the R6RS semantics, I think.
> I am leaning toward the following:
>
> (* 0 +inf.0) ==> +nan.0
> (* 0 +nan.0) ==> +nan.0
> (* 0 1.0) ==> 1.0
==> 0.0, you mean.
> (* 0 0.0) ==> 0.0
>
> What do you think?
I think your suggestion is a good one. But I don't really know what I'm
talking about ;-)
Andy
--
http://wingolog.org/
next prev parent reply other threads:[~2011-01-28 12:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-26 16:32 [PATCH] First batch of numerics changes Mark H Weaver
2011-01-26 18:07 ` Mark H Weaver
2011-01-26 22:46 ` Mark H Weaver
2011-01-27 22:06 ` Mark H Weaver
2011-01-28 12:19 ` Andy Wingo [this message]
2011-01-29 0:05 ` Mark H Weaver
2011-01-29 11:29 ` Andy Wingo
2011-01-27 22:32 ` Mark H Weaver
2011-01-28 13:46 ` Andy Wingo
2011-01-28 14:44 ` Noah Lavine
2011-01-28 15:55 ` Andy Wingo
2011-01-29 8:20 ` Mark H Weaver
2011-01-29 17:42 ` Andy Wingo
2011-01-29 20:20 ` Mark H Weaver
2011-01-30 11:48 ` Andy Wingo
2011-01-29 17:50 ` Andy Wingo
2011-01-29 20:36 ` Mark H Weaver
2011-01-29 22:24 ` Mark H Weaver
2011-01-30 6:02 ` Commentary: R6RS div0-and-mod0 vs Taylor's `round/' Mark H Weaver
2011-01-30 11:50 ` [PATCH] First batch of numerics changes Andy Wingo
2011-01-30 12:12 ` Andy Wingo
2011-01-30 16:33 ` Mark H Weaver
2011-01-28 11:41 ` Andy Wingo
2011-01-28 23:36 ` Mark H Weaver
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=m3pqrhdxug.fsf@unquote.localdomain \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=mhw@netris.org \
/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).