guile-devel
[Top][All Lists]
Advanced

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

Re: Equality predicates, signed zeroes, R5RS and R6RS


From: Mark H Weaver
Subject: Re: Equality predicates, signed zeroes, R5RS and R6RS
Date: Mon, 31 Jan 2011 17:42:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Mike Gran <address@hidden> 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.

I looked at the history, and I don't see any relevant changes to this
behavior in the last several years at least, unless the default reader
formerly used something other than mem2complex, and created the numbers
without scm_c_make_rectangular.

In any case, I will soon submit patches to allow us to create all seven
of these zeroes again, as required by R6RS.

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

I agree that it doesn't sit entirely well with me either.  I would like
for computer languages to be mathematically rigorous in their behavior.
However, having looked closely at the rationale behind the signed
zeroes, I can see why the designers of IEEE 754 mandated them.  They are
important when working with functions involving branch cuts, as the cuts
are approached from either side and underflow may change a small number
into a zero.  Making robust numerical programs is unfortunately a messy
business.

     Best,
      Mark



reply via email to

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