CVTOI 3CW "28 February 2007" "mathcw-1.00"

Table of contents


NAME

cvtoif, cvtoi, cvtoil, cvtoiw, cvtoiq, cvtoill, cvtoidf, cvtoid, cvtoidl, cvtoidll - convert Infinity to string

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>
#include <cvtocw.h>

extern const char * cvtoif (float x, int flags);

extern const char * cvtoi (double x, int flags);

extern const char * cvtoil (long double x, int flags);

extern const char * cvtoiw (__float80 x, int flags);

extern const char * cvtoiq (__float128 x, int flags);

extern const char * cvtoill (long_long_double x, int flags);

extern const char * cvtoidf (decimal_float x, int flags);

extern const char * cvtoid (decimal_double x, int flags);

extern const char * cvtoidl (decimal_long_double x, int flags);

extern const char * cvtoidll (decimal_long_long_double x, int flags);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Convert an Infinity to a string, "inf" or "INF", optionally signed or with a leading space.

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.

Examples include:

-inf
inf
+INF
 INF

Unlike other members of the output conversion function family in the mathcw library, the Infinity 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.

RETURN VALUES

If the argument is not an Infinity, return a NULL pointer. Otherwise, return a pointer to a constant string.

CAVEATS

Because the result is accumulated in an internal static buffer, the function is not thread safe. Threaded applications should restrict use of this function to a single thread, or else carefully control access to it with exclusion locks.

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.


ERRORS

None.

SEE ALSO

cvtia(3CW), cvtib(3CW), cvtid(3CW), cvtig(3CW), cvtih(3CW), cvtio(3CW), cvtob(3CW), cvtod(3CW), cvtog(3CW), cvtoh(3CW), cvton(3CW), cvtoo(3CW).