www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/09/15:17:06

X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs
Date: Wed, 9 Jun 1999 21:16:47 +0200 (MET DST)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
X-Sender: broeker AT acp3bf
To: djgpp-workers AT delorie DOT com
Subject: Re: libm sources from cyberoptics
In-Reply-To: <375EB600.979DA70D@cyberoptics.com>
Message-ID: <Pine.LNX.3.93.990609205458.26954U-100000@acp3bf>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 9 Jun 1999, Eric Rudd wrote:

> Eli Zaretskii wrote:
> > I vote for a positive zero as the result of sqrt(-0.).
> 
> My reasoning for sqrt(-0.) = NaN went as follows:
> 
>    sqrt(-0.) = sqrt((-1.)*(+0.))
>              = sqrt(-1.)*sqrt(+0.)
>              = NaN*sqrt(+0.)
>              = NaN*(+0.)
>              = NaN,

Cute argument, that is. Let me add my 0.02 Euro to it...

The question behind this is essentially: do we want to argue in terms of
arithmetics or in terms of calculus? Or put differently, is '-0.0'
supposed to mean something like the 'lim(x-->a-0)' apposed to
'lim(x-->a+0)' for singlesided limits, or just 0.0, written in a different
way? 

Arithmetically, -0.0 = +0.0, implying that for any function f, you
automatically get f(-0.0) = f(+0.0).  Otherwise, your definition of '='
must be really strange... 

In an infinitesimal way of thinking (like in the context of limits, or
calculus in general), -0.0 would be strictly smaller than +0.0, and the
result for any 'sane' function at -0.0 could be defined as: 

	f(-0.0) = 'left-lim'(x-->0, f(x))
                = lim(x--> 0-0, f(x))

Equivalently, -0.0 would be interpreted as 'strictly smaller than zero,
but larger than every other negative number'.

My personal oppinion on this would be that it doesn't make much sense at
all for any operation ever to return -0.0, unless there's already some
infinitisimal calculation (like {finite negative number} divided by
{positive infinity}) going on. In that context, once there *is* -0.0 in
the FPU stack, we might just as well stick to the infinitesimal viewpoint,
the above sqrt(-0.0)=NaN (and an EDOM flagged) looks sensible.

OTOH, a short detour to the complex numbers seems to suggest that
limit(z-->0, sqrt(z)) exists, and is zero (MapleV R4 agrees on this). This
includes that limit(x-->0-0, sqrt(z)) would be zero as well. Actually,
MapleV even gets:

limit(sqrt(x), x=0, left);
                                  0

Probably by going through complex, as well.

Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019