On Mon, 25 Jun 2007, Henrique Dallazuanna wrote:

> require(MASS)
> ?as.fractions
> as.fractions(1/2+1/8)

I think Federico wanted

1/as.fractions(2) + 1/as.fractions(8)

that is avoiding computing 1/8 in float (although it is exact).

You might be better off with package gmp:

> 1/as.bigq(2) + 1/as.bigq(8)
[1] "5/8"

allows you to handle arbitrarily large fractions.


-- 
Brian D. Ripley,                  [EMAIL PROTECTED]
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

______________________________________________
[email protected] 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.

Reply via email to