| |
| | [No title] (Site not responding. Last check: 2007-10-17) |
 | | >= typedef struct engineer { short E; float x; char *m; /* G, M, K, empty, m, u, or n */ } Engineer; extern Engineer engineer(float x); extern char *sigfmt(float x, int ndigits); /* returns static */ @ |
 | | > Engineer engineer(float x) { Engineer result; static int exponents[] = { -9, -6, -3, 0, 3, 6, 9, }; static float threshholds[] = {1e-9, 1e-6, 1e-3, 1e0, 1e3, 1e6, 1e9, }; static char *multipliers[] = { "n", "u", "m", "", "K", "M", "G", }; float absx = x |
 | | >= char *sigfmt(float x, int ndigits) { typedef char Buffer[20]; static Buffer buffers[5]; static int nextbuf = 0; char *buffer; static float powers10[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}; float absx; int log, round, i; if (ndigits > 4) ndigits = 4; if (ndigits |
| www.eecs.harvard.edu /~nr/toolkit/working/tst/engineer.nw (296 words) |
|