cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ] #include <mathcw.h> #include <cvtocw.h> extern const char * cvtonf (float x, int flags); extern const char * cvton (double x, int flags); extern const char * cvtonl (long double x, int flags); extern const char * cvtonw (__float80 x, int flags); extern const char * cvtonq (__float128 x, int flags); extern const char * cvtonll (long_long_double x, int flags); extern const char * cvtondf (decimal_float x, int flags); extern const char * cvtond (decimal_double x, int flags); extern const char * cvtondl (decimal_long_double x, int flags); extern const char * cvtondll (decimal_long_long_double x, int flags);
NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.
The flags argument may contain flags defined in <cvtocw.h>, but the only ones tested are CVTO_SHOW_PLUS, CVTO_SHOW_PLUS_AS_SPACE, and CVTO_SHOW_UPPERCASE.
If the NaN has a nonzero payload in the significand (excluding the significand bit that distinguishes NaN and Infinity in binary floating-point formats), the payload is displayed as a parenthesized hexadecimal string, with leading zeros suppressed. Although NaNs in all floating-point designs have a sign, the sign has no significance. Examples include:
-nan qnan snan -qnan(0x1234) +snan(0xfeedface)
Unlike other members of the output conversion function family in the mathcw library, the NaN conversion functions do not support field widths or string justification, because they are normally invoked only from other conversion functions which do provide such control.
The flags argument contains the logical OR (or arithmetic sum, as long as there are no repetitions) of a subset of the symbolic flags defined in the header file <cvtocw.h> (some have alternate names shown in the center column):
CVTO_NONE Placeholder for no flags. CVTO_SHOW_PLUS CVTO_FLAG_PLUS Show plus sign. CVTO_SHOW_PLUS_AS_SPACE CVTO_FLAG_SPACE Show plus sign as space. CVTO_SHOW_POINT CVTO_FLAG_SHARP Show point when no fractional digits. CVTO_SHOW_UPPERCASE Show value in uppercase.
All applications should take care to avoid calling this function more than once in the same expression or argument list, because the result buffer can be correct for only one of those calls, unless a copy is made immediately.