On 17-May-09 22:03:19, Daniel Nordlund wrote:> When I type the following, I get results different from what I
> expected.
>
>> sprintf('%a',3)
> [1] "0x1.8"
>
> Shouldn't the result be
>
> [1] "0x1.8p+2"
Well, not "p+2" but "p+1"
(0x1.8 = 1.1000[2] ; *2 = 11.000[2] = 3[10]) ;
however, I get:
sprintf('%a',3)
# [1] "0x1.8p+1"
which is indeed correct.
R version 2.9.0 (2009-04-17) ## Same as yours
platform i486-pc-linux-gnu ## Different from yours ...
which perhaps suggests that there may be a mis-compilation in the
Windows version.
Ted.
> I read through the help ?sprintf and didn't find anything that changed
> my expectation. What am I misunderstanding? I am using R-2.9.0 binary
> from CRAN on Windows XP Pro, and my session info is
>
>
>> sessionInfo()
> R version 2.9.0 (2009-04-17)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>>
>
> Thanks for any enlightenment.
>
> Dan
>
> Daniel Nordlund
> Bothell, WA USA
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 17-May-09 Time: 23:32:19
------------------------------ XFMail ------------------------------