source: trunk/libs/newlib/src/libgloss/testsuite/libgloss.all/div.c @ 684

Last change on this file since 684 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 674 bytes
Line 
1/* WinBond bug report
2
3   Please don't use "gcc -O3 -S hello.c" command, because it
4   will optimize "i/5" to be "2" in compile time.
5
6 */
7
8#include <stdio.h>
9#define TESTSEED 10
10
11main ()
12{
13  int    a1,b1,c1;
14  long   a2,b2,c2;
15  double a3,b3,c3;
16  float  a4,b4,c4;
17  char   buf[20];
18
19  /* integer tests */
20  for (a1 = 1; a1 < 16; a1++) {
21    b1 = TESTSEED/a1;
22    c1 = TESTSEED%a1;
23    printf ("%d/%d = %d, ^ = %d\n", TESTSEED, a1, b1, c1);
24    if ((c1 + (a1 * b1)) == TESTSEED) {
25      sprintf (buf, "div %d by %d", TESTSEED, a1);
26      pass (buf);     
27    } else {
28      sprintf (buf, "div %d by %d", TESTSEED, a1);
29      fail (buf);
30    }
31    fflush (stdout);
32  }
33}
34
35
Note: See TracBrowser for help on using the repository browser.