1
/* Test of sinh() function. ULP control.
2
$Id: sinh-02.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; /* sinh(x) */
19
unsigned int maxulp; /* max possible error in ULP */
22
{ { .fl= 0 }, { .fl= 0 }, 0 },
23
{ { 0x3a800000 }, { 0x3a800001 }, 0 },
24
{ { 0x3e9ffffe }, { 0x3ea29dec }, 4 },
25
{ { 0x3e9fffff }, { 0x3ea29ded }, 4 },
26
{ { 0x3ea00000 }, { 0x3ea29dee }, 1 },
27
{ { 0x3ea00001 }, { 0x3ea29def }, 1 },
28
{ { .fl= 0.125 }, { .fl= .12532576 }, 1 },
29
{ { .fl= 0.25 }, { .fl= .25261232 }, 1 },
30
{ { .fl= 0.5 }, { .fl= .52109531 }, 1 },
31
{ { .fl= 1 }, { .fl= 1.1752012 }, 1 },
32
{ { .fl= 2 }, { .fl= 3.6268604 }, 2 },
33
{ { .fl= 5 }, { .fl= 74.203211 }, 3 },
34
{ { .fl= 10 }, { .fl= 11013.233 }, 7 },
35
{ { .fl= 20 }, { .fl= 2.4258260e+8 }, 20 },
36
{ { .fl= 50 }, { .fl= 2.5923527e+21 }, 20 },
37
{ { .fl= 85 }, { .fl= 4.1115063e+36 }, 40 },
38
{ { .fl= 89.25 }, { .fl= 2.8823884e+38 }, 50 },
41
void x_exit (int index)
44
fprintf (stderr, "t[%d]: %#lx\n", index - 1, v.lo);
46
exit (index ? index : -1);
53
unsigned long v1, z1, r;
56
for (i = 0; i < (int) (sizeof(t) / sizeof(t[0])); i++) {
57
x.lo = pgm_read_dword (& t[i].x);
58
z.lo = pgm_read_dword (& t[i].z);
59
maxulp = pgm_read_word (& t[i].maxulp);
62
v1 = (v.lo < 0) ? (unsigned long)~(v.lo) : v.lo + 0x80000000;
63
z1 = (z.lo < 0) ? (unsigned long)~(z.lo) : z.lo + 0x80000000;
64
r = (v1 >= z1) ? v1 - z1 : z1 - v1;
66
if (r > maxulp) x_exit (i+1);