Index of Section 3 Manual Pages

Interix / SUAfcvt.3Interix / SUA

fcvt(3)                                                         fcvt(3)

  ecvt()

  NAME

    ecvt(), fcvt(), gcvt() - convert floating-point number into a string

  SYNOPSIS

    #include 

    char *ecvt(double value, int ndigit, int *decpt, int *sign)
    char *fcvt(double value, int ndigit, int *decpt, int *sign)
    char *gcvt(double value, int ndigit, char *buf)

  DESCRIPTION

    These three routines convert floating-point numbers (the argument value)
    into null-terminated strings. In ecvt(3) and gcvt(3), the ndigits argument
    determines the number of significant digits, though it is limited by the
    precision of a double; in fcvt(3), it determines the number of digits
    after the radix point.

    The ecvt(3) function converts the value into a string. Unless value is
    actually zero, the high-order digit is non-zero, and the low-order digit
    is rounded. The radix character is not returned as part of the string, but
    its position is stored in decpt argument, relative to the beginning of the
    string. If the value stored in the decpt argument is negative, the radix
    character is to the left of the returned string. The value stored in sign
    indicates whether the result is negative: if it is non-zero, then the
    result is negative.

    The fcvt(3) is nearly identical, but the meaning of ndigits is slightly
    different. Here it specifies the number of digits desired after the radix
    point.

    The gcvt(3) function converts value into a particular format, generally
    similar to the one specified by %g in printf(3). The returned character
    will contain a radix character and will start with a minus sign if the
    value is negative. If possible, gcvt(3) will convert the number to the
    appropriate number of significant digits (equivalent to %f), but will use
    scientific notation (equivalent to %e) if necessary.

  RETURN VALUES

    The ecvt(3) and fcvt(3) functions return a pointer to a null-terminated
    string.

    The gcvt(3) function returns buf.

  SEE ALSO

    printf()

    setlocale()

  USAGE NOTES

    None of these functions are thread safe.

    None of these functions are async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA