1
/* Test of tanh() function.
2
$Id: tanh-01.c,v 1.1 2007/02/05 21:35:58 dmix Exp $
14
volatile union lofl_u v = { .lo = 1 };
16
PROGMEM const struct { /* Table of test cases. */
17
union lofl_u x; /* argument */
18
union lofl_u z; /* tanh(x) */
22
{ { .fl= 0.0 }, { .fl= 0.0 } },
23
{ { .fl= -0.0 }, { .fl= -0.0 } },
26
{ { 0x7f800000 }, { .fl= 1 } },
27
{ { 0xff800000 }, { .fl= -1 } },
30
{ { 0x00000001 }, { 0x00000001 } },
31
{ { 0x00000100 }, { 0x00000100 } },
32
{ { 0x00010000 }, { 0x00010000 } },
33
{ { 0x007fffff }, { 0x007fffff } },
34
{ { 0x80000001 }, { 0x80000001 } },
35
{ { 0x80000100 }, { 0x80000100 } },
36
{ { 0x80010000 }, { 0x80010000 } },
37
{ { 0x807fffff }, { 0x807fffff } },
40
{ { .fl= 9.0109134 }, { .fl= 1 } },
41
{ { .fl= 10 }, { .fl= 1 } },
42
{ { .fl= 12345 }, { .fl= 1 } },
43
{ { 0x70000000 }, { .fl= 1 } },
44
{ { 0x7f7fffff }, { .fl= 1 } },
46
/* Arg too negative */
47
{ { .fl= -9.0109134 }, { .fl= -1 } },
48
{ { .fl= -10 }, { .fl= -1 } },
49
{ { .fl= -12345 }, { .fl= -1 } },
50
{ { 0xf0000000 }, { .fl= -1 } },
51
{ { 0xff7fffff }, { .fl= -1 } },
54
{ { 0x00800000 }, { 0x00800000 } },
55
{ { 0x01000000 }, { 0x01000000 } },
57
{ { 0x80800000 }, { 0x80800000 } },
58
{ { 0x81000000 }, { 0x81000000 } },
61
void x_exit (int index)
64
fprintf (stderr, "t[%d]: %#lx\n", index - 1, v.lo);
66
exit (index ? index : -1);
74
for (i = 0; i < (int) (sizeof(t) / sizeof(t[0])); i++) {
75
x.lo = pgm_read_dword (& t[i].x);
76
z.lo = pgm_read_dword (& t[i].z);
78
/* Comparison is integer to verify the zero sign. */