1
/* Test of division. Subnormals.
2
$Id: div-02.c,v 1.1 2007/02/05 21:35:58 dmix Exp $
13
volatile union lofl_u v = { .lo = 1 };
15
PROGMEM const struct { /* Table of test cases: x / y = z */
19
{ { 0x00000001 }, { 0x00000001 }, { .fl = 1 } },
20
{ { 0x00000002 }, { 0x00000001 }, { .fl = 2 } },
21
{ { 0x00000003 }, { 0x00000001 }, { .fl = 3 } },
22
{ { 0x00000004 }, { 0x00000001 }, { .fl = 4 } },
23
{ { 0x007fffff }, { 0x00000001 }, { .fl = 0x0.7fffffp+24 } },
24
{ { 0x00800000 }, { 0x00000001 }, { .fl = 0x0.800000p+24 } },
25
{ { 0x00800001 }, { 0x00000001 }, { .fl = 0x0.800001p+24 } },
26
{ { 0x00800002 }, { 0x00000001 }, { .fl = 0x0.800002p+24 } },
27
{ { 0x00ffffff }, { 0x00000001 }, { .fl = 0x0.ffffffp+24 } },
28
{ { 0x01000000 }, { 0x00000001 }, { .fl = 0x0.800000p+25 } },
29
{ { 0x34fffffe }, { 0x00000001 }, { 0x7f7ffffe } },
30
{ { 0x34ffffff }, { 0x00000001 }, { 0x7f7fffff } },
31
{ { 0x35000000 }, { 0x00000001 }, { 0x7f800000 } },
32
{ { 0x35000001 }, { 0x00000001 }, { 0x7f800000 } },
33
{ { 0x7f7fffff }, { 0x00000001 }, { 0x7f800000 } },
35
{ { 0x00000001 }, { 0x00000001 }, { .fl = 1 } },
36
{ { 0x00000001 }, { 0x00000002 }, { .fl = 0.5 } },
37
{ { 0x00000001 }, { 0x00000003 }, { .fl = 0.33333333 } },
38
{ { 0x00000001 }, { 0x00000004 }, { .fl = 0.25 } },
39
{ { 0x00000001 }, { 0x00100000 }, { .fl = 0x1p-20 } },
40
{ { 0x00000001 }, { 0x00800000 }, { .fl = 0x1p-23 } },
41
{ { 0x00000001 }, { .fl = 1.0 }, { .fl = 0x1p-149 } },
42
{ { 0x00000001 }, { .fl = 2.0 }, { .fl = 0 } },
45
void x_exit (int index)
48
fprintf (stderr, "t[%d]: %#lx\n", index - 1, v.lo);
50
exit (index ? index : -1);
58
for (i = 0; i < (int) (sizeof(t) / sizeof(t[0])); i++) {
59
x.lo = pgm_read_dword (& t[i].x);
60
y.lo = pgm_read_dword (& t[i].y);
61
z.lo = pgm_read_dword (& t[i].z);
63
/* Comparison is integer to verify the zero sign. */