gcvt.c 274 B

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