[R] gmp::bigq vs. MASS::fractions

Sigbert Klinke @|gbert @end|ng |rom w|w|@hu-ber||n@de
Sat Jan 7 17:29:35 CET 2023


Hi,

has someone experience which routine should be used for creating 
fractional numbers? The two conversion routines deliver different results

 > x <- (0:7)/7

 > MASS::fractions(x)

[1]   0 1/7 2/7 3/7 4/7 5/7 6/7   1

 > gmp::as.bigq(x)

Big Rational ('bigq') object of length 8:

[1] 0 
2573485501354569/18014398509481984 2573485501354569/9007199254740992

[4] 7720456504063707/18014398509481984 2573485501354569/4503599627370496 
  6433713753386423/9007199254740992

[7] 7720456504063707/9007199254740992  1

Following the example I would compute my fractional numbers with 
MASS::fractions and store them for further processing as Big Rational.

Thanks Sigbert



More information about the R-help mailing list