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

gcvt(3) Guardian Native C Library Calls Reference Manual
NAME
gcvt - Converts a oating-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 native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/sysnn/zcrtldll
SYNOPSIS
#include <stdlib.h>
char *gcvt(
double value,
int ndigit,
char *buf
);
PARAMETERS
value Species the oating-point number to be converted.
ndigit Species the number of signicant digits in the returned string.
buf Species a pointer to an array where the string resulting from the conversion is
stored.
DESCRIPTION
The gcvt() function converts a oating-point number to a null-terminated string and returns a
pointer to that string.
The gcvt() function converts the oating-point number value to a null-terminated string that has
a format similar to the printf() functions %g format, stores this string in the array pointed to by
the buf parameter, and returns buf. This string has ndigit signicant digits in %f format if possi-
ble; otherwise it is in %e format (scientic 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 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.
RETURN VALUES
The gcvt() function returns buf.
ERRORS
No errors are returned. This function does not set errno.
34 Hewlett-Packard Company 527192-007