From ripley at stats.ox.ac.uk  Fri Aug 14 13:03:27 2009
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 14 Aug 2009 12:03:27 +0100 (BST)
Subject: [Rd] (PR#13789) possible agrep bug; R 2.9.1, Mac OS X 10.5
In-Reply-To: <20090630160010.01DF6282C761@mail.pubhealth.ku.dk>
References: <20090630160010.01DF6282C761@mail.pubhealth.ku.dk>
Message-ID: <alpine.LFD.2.00.0908141158490.15702@gannet.stats.ox.ac.uk>

It transpires this had nothing to do with 'Mac OS X 10.5' (sic, 'ten 
ten'): it is a 32-bit vs 64-bit issue, and I could not reproduce it 
even on Mac OS 10.5 with a 64-bit build.

The difference is simply the size of 'long' used for internal 
calculations in the apse.c code, and it seems that has a bug in that 
it silently overflows.  I'm not going looking for that bug (patches 
welcome ...) but I will arrange that 64-bit longs are used on 32-bit 
platforms, including in the upcoming 2.9.2.

On Tue, 30 Jun 2009, e.leoni at gmail.com wrote:

> Same behavior was noted on R 2.9.0 OS X and WIndows.
>
>> t(sapply(seq(0.01, .99, length=20), function(x) c(x, length(agrep("Staatssekretar im Bundeskanzleramt","Bundeskanzler",max.distance=x)))))
> [1,] 0.01000000    0
> [2,] 0.06157895    0
> [3,] 0.11315789    0
> [4,] 0.16473684    0
> [5,] 0.21631579    0
> [6,] 0.26789474    0
> [7,] 0.31947368    0
> [8,] 0.37105263    0
> [9,] 0.42263158    0
> [10,] 0.47421053    0
> [11,] 0.52578947    0
> [12,] 0.57736842    0
> [13,] 0.62894737    1
> [14,] 0.68052632    1
> [15,] 0.73210526    1
> [16,] 0.78368421    1
> [17,] 0.83526316    1
> [18,] 0.88684211    0   ## NOTE that there is a match reported with a
> threshold _lower_ than this!
> [19,] 0.93842105    0
> [20,] 0.99000000    1
>
> --please do not edit the information below--
>
> Version:
> platform = i386-apple-darwin8.11.1
> arch = i386
> os = darwin8.11.1
> system = i386, darwin8.11.1
> status =
> major = 2
> minor = 9.1
> year = 2009
> month = 06
> day = 26
> svn rev = 48839
> language = R
> version.string = R version 2.9.1 (2009-06-26)
>
> Locale:
> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> Search Path:
> .GlobalEnv, package:stats, package:graphics, package:grDevices,
> package:utils, package:datasets, package:methods, Autoloads,
> package:base
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] (PR#13789) possible agrep bug; R 2.9.1, Mac OS X 10.5
Prof Brian Ripley