class AdLint::Cc1::PrintfFormat::Conversion_f

Public Class Methods

suitable_conversion_specifier_character() click to toggle source
# File lib/adlint/cc1/format.rb, line 1066
def self.suitable_conversion_specifier_character
  "f"
end

Private Instance Methods

argument_types() click to toggle source
# File lib/adlint/cc1/format.rb, line 1128
def argument_types
  # NOTE: The ISO C99 standard says;
  #
  # 7.19.6.1 The fprintf function
  #
  # 7 The length modifiers and their meanings are:
  #
  #   L    Specifies that a following a, A, e, E, f, F, g, or G
  #        conversion specifier applies to a long double argument.
  case length_modifier
  when "L"
    [long_double_t]
  else
    # NOTE: The argument will be argument promoted, so float type should
    #       be acceptable, too.
    [float_t, double_t]
  end
end
conversion_type() click to toggle source
# File lib/adlint/cc1/format.rb, line 1151
def conversion_type
  case length_modifier
  when "L"
    long_double_t
  else
    double_t
  end
end
default_precision_value() click to toggle source
# File lib/adlint/cc1/format.rb, line 1071
def default_precision_value
  # NOTE: The ISO C99 standard says;
  #
  # 7.19.6.1 The fprintf function
  #
  # 8 The conversion specifiers and their meanings are:
  #
  #   f,F     A double argument representing a floating-point number is
  #           converted to decimal notation in the style [-]ddd.ddd,
  #           where the number of digits after the decimal-point
  #           character is equal to the precision specification.  If the
  #           precision is missing, it is taken as 6; if the precision is
  #           zero and the # flag is not specified, no decimal-point
  #           character appears.  If a decimal-point character appears,
  #           at least one digit appears before it.  The value is rounded
  #           to the appropriate number of digits.
  #           A double argument representing an infinity is converted in
  #           one of the styles [-]inf or [-]infinity -- which style is
  #           implementation-defined.  A double argument representing a
  #           NaN is converted in one of the styles [-]nan or
  #           [-]nan(n-char-sequence) -- which style, and the meaning of
  #           any n-char-sequence, is implementation-defined.  The F
  #           conversion specifier produces INF, INFINITY, or NAN instead
  #           of inf, infinity, or nan, respectively.
  #   e,E     A double argument representing a floating-point number is
  #           converted in the style [-]d.ddde[+-]dd, where there is one
  #           digit (which is nonzero if the argument is nonzero) before
  #           the decimal-point character and the number of digits after
  #           it is equal to the precision; if the precision is missing,
  #           it is taken as 6; if the precision is zero and the # flag
  #           is not specified, no decimal-point character appears.  The
  #           value is rounded to the appropriate number of digits.  The
  #           E conversion specifier produces a number with E instead of
  #           e introducing the exponent.  The exponent always contains
  #           at least two digits, and only as many more digits as
  #           necessary to represent the exponent.  If the value is zero,
  #           the exponent is zero.
  #   g,G     A double argument representing a floating-point number is
  #           converted in style f or e (or in style F or E in the case
  #           of a G conversion specifier), depending on the value
  #           converted and the precision.  Let P equal the precision if
  #           nonzero, 6 if the precision is omitted, or 1 if the
  #           precision is zero.  Then, if a conversion with style E
  #           would have an exponent of X:
  #             -- if P > X >= -4, the conversion is which style f (or F)
  #                and precision P - (X + 1).
  #             -- otherwise, the conversion is with style e (or E) and
  #                precision P - 1.
  #           Finally, unless the # flag is used, any trailing zeros are
  #           removed from the fractional portion of the result and the
  #           decimal-point character is removed if there is no
  #           fractional portion remaining.
  #           A double argument representing an infinity or NaN is
  #           converted in the style of an f or F conversion specifier.
  6
end
suitable_length_modifiers() click to toggle source
# File lib/adlint/cc1/format.rb, line 1147
def suitable_length_modifiers
  ["L"]
end