help-octave
[Top][All Lists]
Advanced

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

Re: a-b+b != a


From: Mike Miller
Subject: Re: a-b+b != a
Date: Mon, 4 Sep 2017 10:52:54 -0700
User-agent: NeoMutt/20170609 (1.8.3)

On Mon, Sep 04, 2017 at 19:18:10 +0200, stn021 wrote:
> not sure about this. The important property is that the weights are
> applied correctly. So weights==1/2 should lead to half the value just
> as weights==1 should lead to an unchanged value.
> 
> Just to be sure: weights is a vector, not a scalar. So some elements
> can be 1 and others can be something else at the same time. These are
> supposed to be statistical weights assigning more or less importance
> to observed data.

Sure.

My point was that if you want to be absolutely sure that the value
doesn't change, the only solution is to avoid doing any arithmetic on
it.

It's up to you to decide how much you care about the value being exactly
the same or close enough to the same when this operation is done with a
weight of 1.

If I had to guess, res + 1e-16 is close enough to res to be considered
equal for your application.

It's not clear to me if you are asking why this limitation in precision
occurs in your expression, or if you know about floating point
arithmetic and are asking for a workaround to ensure that the value
doesn't change, or something else.

-- 
mike

Attachment: signature.asc
Description: PGP signature


reply via email to

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