Remove building with NOCRYPTO option
[minix3.git] / lib / libc / gdtoa / test / dItest.c
blob1724c7153b2052b2d77810be4c17ca6616525b8b
1 /****************************************************************
3 The author of this software is David M. Gay.
5 Copyright (C) 1998, 2001 by Lucent Technologies
6 All Rights Reserved
8 Permission to use, copy, modify, and distribute this software and
9 its documentation for any purpose and without fee is hereby
10 granted, provided that the above copyright notice appear in all
11 copies and that both that the copyright notice and this
12 permission notice and warranty disclaimer appear in supporting
13 documentation, and that the name of Lucent or any of its entities
14 not be used in advertising or publicity pertaining to
15 distribution of the software without specific, written prior
16 permission.
18 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
20 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
21 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
23 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
25 THIS SOFTWARE.
27 ****************************************************************/
29 /* Please send bug reports to David M. Gay (dmg at acm dot org,
30 * with " at " changed at "@" and " dot " changed to "."). */
32 #include "gdtoaimp.h"
33 #include <stdio.h>
34 #include <stdlib.h>
36 static char ibuf[2048];
38 #define U (unsigned long)
40 static void
41 #ifdef KR_headers
42 dshow(what, d) char *what; double d;
43 #else
44 dshow(char *what, double d)
45 #endif
47 char buf[32];
48 g_dfmt(buf, &d, 0, sizeof(buf));
49 printf("%s = #%lx %lx = %s\n", what,
50 U ((ULong*)&d)[_0], U ((ULong*)&d)[_1], buf);
53 int
54 main(Void)
56 /* Input: one number per line */
58 char *s, *se, *se1;
59 int i, j;
60 double dd[2], dd1, dd2;
61 static char cfmt[] = "%s consumes %d bytes and returns %d\n";
63 while( (s = fgets(ibuf, sizeof(ibuf), stdin)) !=0) {
64 while(*s <= ' ')
65 if (!*s++)
66 continue;
67 printf("\nInput: %s", ibuf);
68 i = strtodI(ibuf, &se, dd);
69 printf(cfmt, "strtodI", (int)(se-ibuf), i);
70 dshow("dd[0]", dd[0]);
71 dshow("dd[1]", dd[1]);
72 printf("\n");
73 j = strtoId(ibuf, &se1, &dd1, &dd2);
74 if (j != i || se != se1
75 || dd[0] != dd1 || dd[1] != dd2) {
76 printf(cfmt, "**** strtoId", (int)(se-ibuf), j);
77 dshow("dd1", dd1);
78 dshow("dd2", dd2);
81 return 0;