econvert(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

econvert(3c)

econvert(3C)             Standard C Library Functions             econvert(3C)

NAME
       econvert,  fconvert,  gconvert, seconvert, sfconvert, sgconvert, qecon‐
       vert, qfconvert, qgconvert - output conversion

SYNOPSIS
       #include <floatingpoint.h>

       char *econvert(double value, int ndigit, int *decpt, int *sign,
            char *buf);


       char *fconvert(double value, int ndigit, int *decpt, int *sign,
            char *buf);


       char *gconvert(double value, int ndigit, int trailing, char *buf);


       char *seconvert(single *value, int ndigit, int *decpt, int *sign,
            char *buf);


       char *sfconvert(single *value, int ndigit, int *decpt, int *sign,
            char *buf);


       char *sgconvert(single *value, int ndigit, int trailing, char *buf);


       char *qeconvert(quadruple *value, int ndigit, int *decpt, int *sign,
            char *buf);


       char *qfconvert(quadruple *value, int ndigit, int *decpt, int *sign
            char *buf);


       char *qgconvert(quadruple *value, int ndigit, int trailing, char *buf);

DESCRIPTION
       The econvert() function converts the value to a null-terminated  string
       of ndigit  ASCII digits in buf and returns a pointer to buf. buf should
       contain at least ndigit+1 characters. The position of the decimal point
       relative  to  the  beginning of the string is stored indirectly through
       decpt. Thus buf == "314" and *decpt == 1 corresponds to  the  numerical
       value  3.14, while buf == "314" and *decpt == −1 corresponds to the nu‐
       merical value .0314. If the sign of the result is  negative,  the  word
       pointed to by sign is nonzero; otherwise it is zero. The least signifi‐
       cant digit is rounded.


       The  fconvert()  function  works  much like econvert(), except that the
       correct digit has been rounded as if  for  sprintf(%w.nf)  output  with
       n=ndigit  digits to the right of the decimal point. ndigit can be nega‐
       tive to indicate rounding to the left of the decimal point. The  return
       value   is   a   pointer   to   buf.   buf   should  contain  at  least
       310+max(0,ndigit) characters to accommodate any double-precision value.


       The gconvert() function converts the value to a  null-terminated  ASCII
       string in buf and returns a pointer to buf. It produces ndigit signifi‐
       cant  digits in fixed-decimal format, like sprintf(%w.nf), if possible,
       and otherwise in floating-decimal format, like sprintf(%w.ne);  in  ei‐
       ther case buf is ready for printing, with sign and exponent. The result
       corresponds to that obtained by

         (void) sprintf(buf, "%w.ng", value);



       If trailing = 0, trailing zeros and a trailing point are suppressed, as
       in  sprintf(%g).  If trailing != 0, trailing zeros and a trailing point
       are retained, as in sprintf(%#g).


       The seconvert(), sfconvert(), and sgconvert() functions are single-pre‐
       cision versions of these functions, and are  more  efficient  than  the
       corresponding  double-precision  versions.  A  pointer  rather than the
       value itself is passed to avoid C's usual conversion  of  single-preci‐
       sion arguments to double.


       The  qeconvert(), qfconvert(), and qgconvert() functions are quadruple-
       precision versions of these functions.  The  qfconvert()  function  can
       overflow  the  decimal_record  field  ds if value is too large. In that
       case, buf[0] is set to zero.


       The ecvt(), fcvt() and gcvt() functions  are  versions  of  econvert(),
       fconvert(),  and  gconvert(),  respectively, that are documented on the
       ecvt(3C) manual page. They constitute  the  default  implementation  of
       these functions and conform to the X/Open CAE Specification, System In‐
       terfaces and Headers, Issue 4, Version 2.

USAGE
       IEEE  Infinities  and  NaNs  are  treated similarly by these functions.
       "NaN" is returned for NaN, and "Inf" or "Infinity"  for  Infinity.  The
       longer form is produced when ndigit >= 8.

ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ MT-LevelMT-Safe


SEE ALSO
       ecvt(3C), sprintf(3C), attributes(7)

Oracle Solaris 11.4               14 May 2018                     econvert(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3