# formatC with format="fg" displays number in exponential notation (PR#2299)

**schutz@wehi.edu.au
**
schutz@wehi.edu.au

*Sat, 16 Nov 2002 06:33:05 +0100 (MET)*

Full_Name: Frederic Schutz
Version: 1.6.1
OS: Linux
Submission from: (NULL) (128.250.252.193)
The result of the following commands:
>* formatC(9.9, 1, format="fg")
*[1] "1e+01"
>* formatC(99.9, 1, format="fg")
*[1] "1e+02"
does not seem to be coherent with what the help page says:
>* format: equal to `"d"' (for integers), `"f"', `"e"', `"E"', `"g"',
*>* `"G"', `"fg"' (for reals), or `"s"' (for strings). Default is
*>* `"d"' for integers, `"g"' for reals.
*>*
*>* `"f"' gives numbers in the usual `xxx.xxx' format; `"e"' and
*>* `"E"' give `n.ddde+nn' or `n.dddE+nn' (scientific format);
*>* `"g"' and `"G"' put `x[i]' into scientific format only if it
*>* saves space to do so.
*>*
*>* `"fg"' uses fixed format as `"f"', but `digits' as number of
*>* significant digits. Note that this can lead to quite long
*>* result strings, see examples below.
*
I would expect "fg" to produce only fixed format numbers, which does not
seem to be the case here.
Frederic
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._