format01prec {DPQ} | R Documentation |
Format numbers in [0,1] with “precise” result,
notably using "1-.."
if needed.
format01prec(x, digits = getOption("digits"), width = digits + 2, eps = 1e-06, ..., FUN = function(x, ...) formatC(x, flag = "-", ...))
x |
numbers in [0,1]; (still works if not) |
digits |
number of digits to use; is used as
|
width |
desired width (of strings in characters), is used as
|
eps |
small positive number: Use |
... |
optional further arguments passed to |
FUN |
a |
a character
vector of the same length as x
.
Martin Maechler, 14 May 1997
## Show that format01prec() does reveal more precision : cbind(format (1 - 2^-(16:24)), format01prec(1 - 2^-(16:24))) ## a bit more variety e <- c(2^seq(-24,0, by=2), 10^-(7:1)) ee <- sort(unique(c(e, 1-e))) noquote(ff <- format01prec(ee)) data.frame(ee, format01prec = ff)