formatC with format="fg" displays number in exponential notation (PR#2299)
Sat, 16 Nov 2002 06:33:05 +0100 (MET)

Full_Name: Frederic Schutz
Version: 1.6.1
OS: Linux
Submission from: (NULL) (

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 `' 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.


r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: