Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / pmax / test / fp8.c
blob6fa7cd3994a5a420b48b8d5b2e0f4d4161b1cdd7
1 #include <stdio.h>
2 #include <ctype.h>
3 #include <math.h>
5 int lineno;
7 union {
8 unsigned w[2];
9 double d;
10 } uda, udb, udc;
13 * Read test vectors from file and test the fp emulation by
14 * comparing it with the hardware.
16 main(argc, argv)
17 int argc;
18 char **argv;
20 register char *cp;
21 register int c;
22 char buf[10];
23 unsigned arg[4];
25 for (lineno = 1; ; lineno++) {
26 c = scanf("%x %x", &arg[1], &arg[0]);
27 if (c < 0)
28 break;
29 if (c != 2) {
30 fprintf(stderr, "line %d: expected 2 args\n",
31 lineno);
32 goto skip;
35 uda.w[0] = arg[0];
36 uda.w[1] = arg[1];
37 udc.d = modf(uda.d, &udb.d);
39 printf("line %d: modf(%x,%x) = %x,%x int %x,%x\n",
40 lineno, uda.w[1], uda.w[0],
41 udc.w[1], udc.w[0], udb.w[1], udb.w[0]);
42 skip:
43 while ((c = getchar()) != EOF && c != '\n')
48 trapsignal(p, sig, code)
49 int p, sig, code;
51 printf("line %d: signal(%d, %x)\n", lineno, sig, code);