[Rd] (PR#9648) integer constants given by hexadecimal notation

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 1 15:40:35 CEST 2007


On Tue, 1 May 2007, Hin-Tak Leung wrote:

> ripley at stats.ox.ac.uk wrote:
>> This works correctly on Linux.  The problem is that the author assumed that 
>> atof handles hexadecimal, which it does for a C99 compiler but not 
>> apparently on MinGW.
>> 
>> We have a workaround for this in mkFloat, and need to use that for the 'L' 
>> suffix case too.
>
> Kind of irrelevant, but this also works in R-win32 under wine on linux.
> I suppose the problem isn't mingw per se but msvcrt (or is the Locale
> relevant?)...

MinGW calls MSVCRT for this, and calling MSVCRT is part of the (modern) 
definition of MinGW (it once called crtdll.dll).  Now, the MSVCRT docs do 
not claim that atof supports hexadecimal, so I suspect your point is that 
wine is an inaccurate emulation of MSVCRT (which is indeed pretty 
irrelevant).

>
> ----------------------
>> 0x10L
> [1] 16
>> sessionInfo()
> R version 2.5.0 (2007-04-23)
> i386-pc-mingw32
>
> locale:
> C
>
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
> [7] "base"
> ----------------------
>
>
>> 
>> On Tue, 1 May 2007, murdoch at stats.uwo.ca wrote:
>> 
>>> On 01/05/2007 7:21 AM, Stephan wrote:
>>>> Hi,
>>>> 
>>>>> 0x10L
>>>> returns: int 0
>>>> 
>>>> I would expect: int 16?
>>>> This happens with all integer constants given by hexadecimal notation.
>>>> It's a bug?
>>> Certainly looks like one; I've cc'd this to the bug list (but won't be
>>> able to look into fixing it).
>>> 
>>> Duncan Murdoch
>>> 
>>>> 
>>>>> sessionInfo()
>>>> R version 2.5.0 (2007-04-23)
>>>> i386-pc-mingw32
>>>> 
>>>> locale:
>>>> LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252
>>>> 
>>>> attached base packages:
>>>> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
>>>> [7] "base"
>>>> 
>>>> 
>>>> Stephan
>>>> 
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>> ______________________________________________
>>> 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



More information about the R-devel mailing list