Doubles on most platforms are only represented to 53bits, that is just
under 16 decimal digits. So S cannot store that number exactly.
Your methods are doing particularly badly here. On Linux I get
> print(v, digits=18)
[1] 473482475476472448
and on Windows
> print(v, digits=18)
[1] 473482475476472450
which is consistent with a number about 50x the maximum which can be
represented exactly.
On Wed, 27 Nov 2002, Fowler, Mark wrote:
> I wish to display large numbers without scientific notation. I've tried
> various combinations of print and format without success. As an example,
>
> > v_473482475476472478
> > v
> [1] 4.7348e+017
> > print(format(v,digits=36,scientific=F))
> [1] "473482475476473000"
> > print(format(v,digits=36,scientific=c(-24,24)))
> [1] "473482475476473000"
> > as.character(format(v,digits=18,scientific=F))
> [1] "473482475476473000"
>
> Anyone know how to make the original number display?
>
> [S-Plus 6.1 on Windows 98]
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
>
--
Brian D. Ripley, ripley@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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|