Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

Guardian Native C Library Calls (f) fcvt(3)
NAME
fcvt - Converts a oating-point number to a string
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <stdlib.h>
char *fcvt(
double value,
int ndigit,
int *decpt,
int *sign
);
PARAMETERS
value Species the oating-point number to be converted.
ndigit Species the number of characters that follow the position of the radix character
(decimal point) in the returned string.
decpt Species a pointer to an integer that indicates the position of the radix character
(decimal point) relative to the beginning of the returned string.
sign Species a pointer to an integer that indicates the sign of value.
DESCRIPTION
The fcvt() function converts a oating-point number to a null-terminated string and returns a
pointer to that string.
The fcvt() function converts the oating-point number value to a string with ndigit characters
following the radix character (decimal point) and returns a pointer to that string. The resulting
string does not actually contain the radix character. Finally, fcvt() also returns an integer indi-
cating the sign of value in the location pointed to by the sign parameter. If value is negative, the
integer is nonzero; otherwise it is 0 (zero). The precision of the type double limits the total
number of characters in the string.
NOTES
The fcvt() function can be called only by native processes.
This function supports both IEEE Std 754-1985 oating-point and Tandem oating-point values.
IEEE values can include NaN and innity, and the sign of 0.0 (zero) can be either positive or
negative. Refer to the fp_class(3) reference page for a description of IEEE value classes.
Guardian functions are available to convert between oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-point conversions.
CAUTIONS
The return value of the fcvt() function points to static data, which will be overwritten by future
calls to this function.
527192-007 Hewlett-Packard Company 25