From Thomas.Petzoldt at tu-dresden.de  Fri Sep 13 16:53:31 2013
From: Thomas.Petzoldt at tu-dresden.de (Thomas Petzoldt)
Date: Fri, 13 Sep 2013 16:53:31 +0200
Subject: [Rd] numerical issue in contour.default?
In-Reply-To: <523324B3.5010603@stats.ox.ac.uk>
References: <52331AC8.3060601@tu-dresden.de> <52331DD4.5020807@gmail.com>
	<523324B3.5010603@stats.ox.ac.uk>
Message-ID: <523326EB.3020309@tu-dresden.de>

On 13.09.2013 16:44, Prof Brian Ripley wrote:
> On 13/09/2013 15:14, Duncan Murdoch wrote:
>> On 13/09/2013 10:01 AM, Thomas Petzoldt wrote:
>>> Dear R developers,
>>>
>>> I found a small issue while plotting contours of data containing both
>>> "usual" and "very small" numbers. It appeared with both R 3.0.1 and
>>> R-Devel on Windows, and I could reproduce it on Linux. Would it be
>>> possible to solve this before the upcoming release?
>>
>> I don't see the error in 32 bits, but I do see it in 64 bits.  I think
>> it's really unlikely this will be fixed before 3.0.2, unless you send a
>> well tested patch in the next few days.  Code freeze is on Wednesday.

You are right, I can reproduce it only on 64 bit.

> And not even then: we would not have time to do sufficiently extensive
> checking.

Agreed, so I'll put a workaround in my package for now.

> Reporting to bugs.r-project.org with a patch would get the process rolling.

O.K., I will report it. After a look in the sources I would guess that 
it may be in:

src/main/contour-common.h

static int ctr_intersect(double z0, double z1, double zc, double *f)
{
     if ((z0 - zc) * (z1 - zc) < 0.0) {
	*f = (zc - z0) / (z1 -	z0);
	return 1;
     }
     return 0;
}


... but you are right, too many things depend on it.

Many thanks for the immediate feedback!

Thomas



[Rd] numerical issue in contour.default?
Thomas Petzoldt