Skip to content

Incorrect formatting for sprintf %g and %G #126

@ceresek

Description

@ceresek

Standard R:

> sprintf ('%g', 0)
[1] "0"

FastR (19.2):

> sprintf ('%g', 0)
[1] "0.00000"

The documentation for sprintf states:

 ‘g’, ‘G’ Double precision value, in ‘%e’ or ‘%E’ format if the
      exponent is less than -4 or greater than or equal to the
      precision, and ‘%f’ format otherwise.  (The precision
      (default 6) specifies the number of _significant_ digits
      here, whereas in ‘%f, %e’, it is the number of digits after
      the decimal point.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions