texk/web2c/lib/fprintreal.c
raw| 1 | /* fprintreal.c: print the real number R in the Pascal format N:M on the |
| 2 | file F. Public domain. */ |
| 3 | |
| 4 | #include <w2c/config.h> |
| 5 | #include "lib.h" |
| 6 | |
| 7 | void |
| 8 | fprintreal (FILE *f, double r, int n, int m) |
| 9 | { |
| 10 | char fmt[50]; /* Surely enough, since N and M won't be more than 25 |
| 11 | digits each! */ |
| 12 | |
| 13 | sprintf (fmt, "%%%d.%dlf", n, m); |
| 14 | fprintf (f, fmt, r); |
| 15 | } |