gcvt.c 231 B

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