1
/* Test of signbit() function.
2
$Id: signbit-01.c,v 1.1.2.1 2008/03/20 21:42:30 joerg_wunsch Exp $
10
# define PRINTFLN(fmt, ...) \
11
printf ("\nLine %d: " fmt "\n", __LINE__, ##__VA_ARGS__)
12
# define EXIT(code) exit ((code) < 255 ? (code) : 100 + (code) % 100)
14
# if defined(__AVR_ATmega128__)
15
/* ATmega128 has enough RAM for sprintf(), print to 0x2000 in XRAM. */
16
# define PRINTFLN(fmt, ...) \
17
sprintf ((char *)0x2000, "\nLine %d: " fmt "\n", __LINE__, ##__VA_ARGS__)
20
# define PRINTFLN(args...)
30
/* Result is placed into SRAM variable, allocated at the start of
31
memory. This is convinient to debug: read a core dump. */
34
PROGMEM const struct { /* Table of test cases. */
35
union lofl_u x; /* argument */
43
/* A few of normal values */
44
{ { 0x00800000 }, 0 },
45
{ { 0x00800001 }, 0 },
46
{ { 0x00ffffff }, 0 },
47
{ { 0x3f800000 }, 0 },
48
{ { 0x7f7fffff }, 0 },
49
{ { 0x80800000 }, 1 },
50
{ { 0x80800001 }, 1 },
51
{ { 0x80ffffff }, 1 },
52
{ { 0xdf800000 }, 1 },
53
{ { 0xff7fffff }, 1 },
56
{ { 0x00000001 }, 0 },
57
{ { 0x00000100 }, 0 },
58
{ { 0x00010000 }, 0 },
59
{ { 0x007fffff }, 0 },
60
{ { 0x80000001 }, 1 },
61
{ { 0x80000100 }, 1 },
62
{ { 0x80010000 }, 1 },
63
{ { 0x807fffff }, 1 },
66
{ { 0x7f800000 }, 0 },
67
{ { 0xff800000 }, 1 },
70
{ { 0x7f800001 }, 0 },
71
{ { 0x7fc00000 }, 0 },
72
{ { 0x7fffffff }, 0 },
73
{ { 0xff800001 }, 1 },
74
{ { 0xffc00000 }, 1 },
75
{ { 0xffffffff }, 1 },
83
int (* volatile vp)(double);
85
/* Default implementation. */
86
for (i = 0; i < (int) (sizeof(t) / sizeof(t[0])); i++) {
87
x.lo = pgm_read_dword (& t[i].x);
88
z = pgm_read_word (& t[i].z);
91
PRINTFLN ("i= %d v= %d", i, v);
97
/* Force to use the library implementation. */
99
for (i = 0; i < (int) (sizeof(t) / sizeof(t[0])); i++) {
100
x.lo = pgm_read_dword (& t[i].x);
101
z = pgm_read_word (& t[i].z);
104
PRINTFLN ("i= %d v= %d", i, v);