Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
gcvt(3) Guardian Native C Library Calls Reference Manual
NAME
gcvt - Converts a floating-point number to a string
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdlib.h>
char *gcvt(
double value,
int ndigit,
char *buf
);
PARAMETERS
value Specifies the floating-point number to be converted.
ndigit Specifies the number of significant digits in the returned string.
buf Specifies a pointer to an array where the string resulting from the conversion is
stored.
DESCRIPTION
The gcvt() function converts a floating-point number to a null-terminated string and returns a
pointer to that string.
The gcvt() function converts the floating-point number value to a null-terminated string that has
a format similar to the printf() function’s %g format, stores this string in the array pointed to by
the buf parameter, and returns buf. This string has ndigit significant digits in %f format if possi-
ble; otherwise it is in %e format (scientific notation). The precision of the type double might
result in ndigit being reduced to an appropriate value.
If value is less than 0 (zero), the string includes a minus sign. If value is not a whole number, the
string includes a radix character (decimal point) determined by the LC_NUMERIC category of
the current locale and trailing zeroes are omitted.
NOTES
The gcvt() function can be called only by native processes.
This function supports both IEEE Std 754-1985 floating-point and Tandem floating-point values.
IEEE values can include NaN and infinity, 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 floating-point formats. Refer to the Guar-
dian Programmer’s Guide for a discussion of floating-point conversions.
RETURN VALUES
The gcvt() function returns buf.
ERRORS
No errors are returned. This function does not set errno.
3−6 Hewlett-Packard Company 527192-018