octave-maintainers
[Top][All Lists]
Advanced

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

Re: imag () function detail regarding -0.0000


From: John W. Eaton
Subject: Re: imag () function detail regarding -0.0000
Date: Wed, 12 Sep 2012 03:51:47 -0400

On 11-Sep-2012, Daniel J Sebald wrote:

| Well, not in this case, no, unless one wants to think of rounding to 
| zero from the negative direction.  But I prefer the single additive 
| identity rule of a field in the case of computations.
| 
| I would think the CPU naturally doesn't use -0 for multiplies if it is 
| following some standard, unless there is some configuration (compile 
| option?) saying to maintain sign through multiplication by zero.  I'm 
| guessing Octave is implementing the rule.

I don't think we should change Octave so that the '-' is not
displayed, and I would definitely be against checking for and dropping
the sign of zero every time we do some computation.  If -0 can be
generated, it should be displayed.  Consider things like

  1/(1/-Inf)

if you drop the - from (1/-Inf) == -0, this expression would result in
Inf -- how does that make sense?  If you decide to not display it (as
Matlab does) then things become somewhat confusing if you break the
expression into parts and evaluate them separately: x = 1/-Inf
produces -0 but it is displayed as 0, so you think, OK, I have 0.
Then you use that result in the expression 1/x and you get -Inf.
What?

jwe


reply via email to

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