OAR

RTEMS GNU Tools On-Line Library


gvcvt

PREV UP NEXT Bookshelf

1.11: gvcvt, gcvtf---format double or float as string

Synopsis

#include <stdlib.h>

char *gcvt(double val, int precision, char *buf);
char *gcvtf(float val, int precision, char *buf);

Description
gcvt writes a fully formatted number as a null-terminated string in the buffer *buf. gdvtf produces corresponding character representations of float numbers.

gcvt uses the same rules as the printf format `%.precisiong'---only negative values are signed (with `-'), and either exponential or ordinary decimal-fraction format is chosen depending on the number of significant digits (specified by precision).


Returns
The result is a pointer to the formatted representation of val (the same as the argument buf).


Portability
Neither function is ANSI C.

Supporting OS subroutines required: close, fstat, isatty, lseek, read, sbrk, write.



PREV UP NEXT Bookshelf

Packaging copyright © 1988-2000 OAR Corporation
Context copyright by each document's author. See Free Software Foundation for information.