gcvt.c 247 B

123456789101112
  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