[R] NaN/NA and sprintf double format

Dirk Eddelbuettel edd at debian.org
Tue May 14 20:14:54 CEST 2002


With a (late prerelease of) 1.5.0 on Windows, using sprintf on NaN 
yields garbage when the number of decimal is specified while it
works fine for NA:

> sprintf("%.2f", NA)
[1] "0.00"
> sprintf("%.2f", NaN)
[1] "-1.#J"

Not specifying the decimal precision lets both print garbage:

> sprintf("%f", NaN)
[1] "-1.#IND00"
> sprintf("%f", NA)
[1] "-1.#QNAN0"

Is this a bug or a feature?  

Dirk

-- 
According to the latest figures, 43% of all signatures are totally worthless.   




-- 
According to the latest figures, 43% of all signatures are totally worthless.   
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list