rational(x, ...)
x
| Numeric array to be approximated. |
...
| Optional additional parameters to be passed to rat(x, ...) |
x
of rational
approximations.
If x
contains the results of a calculation for which the
correct answers rational with ``small'' denominators, this may remove
roundoff error.
Similar to round(..)
, except that full accuracy is maintained
for many exactly rational quantities.
fractions
and the primitive function rat
.
# solve() accuracy check using a small Hilbert Matrix x <- matrix(0,5,5); x <- 1/(row(x) + col(x) - 1); rat(x) x1 <- solve(solve(x)) #compare: x-x1 #with: x-rational(x1)