|
|
1.1 root 1: //
2: // XM6i
1.1.1.2 ! root 3: // Copyright (C) 2013-2016 Tetsuya Isaki
1.1 root 4: //
5: // for debugging
6: //
7:
8: #include <float.h>
9: #include <stdio.h>
10: #include <string.h>
11:
12: #define PRINTF printf
13: #define DUMPFP dumpfp
14: #define DUMPFPN dumpfpn
15:
16: static inline void dumpfp_main(const char *msg, const struct fpn *f)
17: {
18: printf("%s ", msg);
19: switch (f->fp_class) {
20: case FPC_SNAN: printf("FPC_SNAN"); break;
21: case FPC_QNAN: printf("FPC_QNAN"); break;
22: case FPC_ZERO: printf("FPC_ZERO"); break;
23: case FPC_NUM: printf("FPC_NUM "); break;
24: case FPC_INF: printf("FPC_INF "); break;
25: default: printf("unknown%d", f->fp_class); break;
26: }
27: printf(" %2d %c%08x:%08x:%08x:%d",
28: f->fp_exp, f->fp_sign?'-':'+',
29: f->fp_mant[0],f->fp_mant[1], f->fp_mant[2],
30: f->fp_sticky?1:0);
31: }
32:
33: static inline void dumpfp(const char *msg, const struct fpn *f)
34: {
35: dumpfp_main(msg, f);
36: printf("\n");
37: }
38:
39: static inline void dumpfpn(const char *msg, const struct fpn *f)
40: {
41: dumpfp_main(msg, f);
42: printf(" = %.*Lg\n", LDBL_DIG, fp2ldbl(f));
43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.