unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Re: Equality predicates, signed zeroes, R5RS and R6RS
@ 2011-01-31 21:36 Mike Gran
  2011-01-31 22:42 ` Mark H Weaver
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Gran @ 2011-01-31 21:36 UTC (permalink / raw)
  To: Mark H Weaver, guile-devel@gnu.org; +Cc: Andy Wingo, Taylor R Campbell


> From:Mark H Weaver <mhw@netris.org>
> To:guile-devel@gnu.org
> Cc:Andy Wingo <wingo@pobox.com>; Taylor R Campbell <campbell@mumble.net>
> Sent:Monday, January 31, 2011 11:53 AM
> Subject:Equality predicates, signed zeroes, R5RS and R6RS
> 
> An issue has come to my attention that deserves wider discussion.
> 
> Since at least Guile 1.8, (= 0.0 -0.0) has returned #t
> but (eqv? 0.0 -0.0) has returned #f, and this is still the case.
> 
> PLT Scheme agrees with us that (eqv? 0.0 -0.0) is #f, but MIT/GNU Scheme,
> SCM, Chicken, and Gauche all return #t in this case.

As an aside, as of a couple of months ago, it was possible to create
the following seven versions of zero in Guile using the default reader.

0, ±0.0, ±0.0±0.0i 

Note that there is no way to make negative zero integer (-0).  And
there are no zero rationals:  ±0/2, for example.

Each scheme has its quirks.

MzScheme 4.1 would let you create complex numbers with integer representation
real and float representation imaginary parts: 0+0.0i, for example. The integer
parts can only be positive zero and the float parts can be ±0.0.

But as a physicist, I declare that this is all madness. 

-Mike



^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Equality predicates, signed zeroes, R5RS and R6RS
@ 2011-01-31 23:13 Mike Gran
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Gran @ 2011-01-31 23:13 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guile-devel

> From:Mark H Weaver <mhw@netris.org>
> To:Mike Gran <spk121@yahoo.com>
> Cc:"guile-devel@gnu.org" <guile-devel@gnu.org>
> Sent:Monday, January 31, 2011 2:42 PM
> Subject:Re: Equality predicates, signed zeroes, R5RS and R6RS
> 
> Mike Gran <spk121@yahoo.com> writes:
> > As an aside, as of a couple of months ago, it was possible to create
> > the following seven versions of zero in Guile using the default reader.
> >
> > 0, ±0.0, ±0.0±0.0i 
> 
> Really?  I don't understand how this could have happened.  mem2complex
> uses scm_make_rectangular to create complex numbers, and
> scm_make_rectangular calls scm_c_make_rectangular, which creates a real
> if the imaginary part is zero.

Sorry, I was completely wrong with that.  I was looking at the output for
few different Schemes, and I got confused.

As you say, Guile 2.0 only gets you, 0 and ±0.0. 

Sorry for the noise.
-Mike




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-02 20:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20110131185050.9C10F98298@pluto.mumble.net>
2011-01-31 19:53 ` Equality predicates, signed zeroes, R5RS and R6RS Mark H Weaver
2011-02-02 20:09   ` Andy Wingo
2011-01-31 21:36 Mike Gran
2011-01-31 22:42 ` Mark H Weaver
  -- strict thread matches above, loose matches on Subject: below --
2011-01-31 23:13 Mike Gran

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).