VMS Help  —  CRTL  fcvt
    Converts its argument to a null-terminated string of ASCII digits
    and returns the address of the string. The string is stored in a
    thread-specific location created by the C RTL.

    Format

      #include  <stdlib.h>

      char *fcvt  (double value, int ndigits, int *decpt, int *sign);

1  –  Arguments

 value

    An object of type double that is converted to a null-terminated
    string of ASCII digits.

 ndigits

    The number of ASCII digits after the decimal point to be used in
    the converted string.

 decpt

    The position of the decimal point relative to the first character
    in the returned string. The returned string does not contain the
    actual decimal point. A negative int value means that the decimal
    point is decpt number of spaces to the left of the returned
    digits (the spaces are filled with zeros). A 0 value means that
    the decimal point is immediately to the left of the first digit
    in the returned string.

 sign

    An integer value that indicates whether the value argument is
    positive or negative. If value is negative, the fcvt function
    places a nonzero value at the address specified by sign.
    Otherwise, the functions assign 0 to the address specified by
    sign.

2  –  Description

    The fcvt function converts value to a null-terminated string and
    returns a pointer to it. The resulting low-order digit is rounded
    to the correct digit for outputting ndigits digits in C F-format.
    The decpt argument is assigned the position of the decimal point
    relative to the first character in the string.

    In C F-format, ndigits is the number of digits desired after the
    decimal point. Very large numbers produce a very long string of
    digits before the decimal point, and ndigit of digits after the
    decimal point. For large numbers, it is preferable to use the
    gcvt or ecvt function so that E-format is used.

    Repeated calls to the fcvt function overwrite any existing
    string.

    The ecvt, fcvt, and gcvt functions represent the following
    special values specified in the IEEE Standard for floating-point
    arithmetic:

    Value         Representation

    Quiet NaN     NaNQ
    Signalling    NaNS
    NaN
    +Infinity     Infinity
    -Infinity     -Infinity

    The sign associated with each of these values is stored into the
    sign argument. In IEEE floating-point representation, a value
    of 0 (zero) can be positive or negative, as set by the sign
    argument.

    See also gcvt and ecvt.

3  –  Return Value

    x                  A pointer to the converted string.
Close Help