Infobox math broken in current master

Dirk Hohndel dirk at hohndel.org
Tue Jan 21 09:36:48 UTC 2014


On Tue, 2014-01-21 at 18:27 +0100, Robert C. Helling wrote:
> On 21 Jan 2014, at 18:13, Dirk Hohndel <dirk at hohndel.org> wrote:
> 
> Dirk,
> 
> > I don't like this patch. It's much better to test min == max.
> > 
> 
> the problem is that this compares floats with the usual problems. Is it clear that 
> 
> min === max
> 
> is true if and only if 
> 
> isnan(1.0/(min-max))
> 
> Could be that floating point magic guarantees this but this is not obvious to me. It is true that the first is conceptually clearer but that later is what is what makes the assertion fail.

But given where min and max come from, we know that they are either
identical, or at least 0.1 apart. So a division will ONLY create a NaN
if they are identical.

> > Also, please include a test dive that shows the problem prior to adding
> > the patch (and that works fine after applying the patch).
> 
> Will do that later tonight.

Thanks

/D



More information about the subsurface mailing list