gcvt.c 248 B

1234567891011
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #ifdef __UCLIBC_HAS_FLOATS__
  4. #define MAX_NDIGIT 17
  5. char *gcvt (double number, int ndigit, char *buf)
  6. {
  7. __sprintf(buf, "%.*g", (ndigit > MAX_NDIGIT)? MAX_NDIGIT : ndigit, number);
  8. return buf;
  9. }
  10. #endif