annotate test/simp1.c @ 491:a379da780856

cond signed/unsigned
author kono
date Wed, 21 Dec 2005 11:33:53 +0900
parents 32737bad7489
children a4445cb1aa91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
467
32737bad7489 fix list/tag interference
kono
parents: 427
diff changeset
1 int printf(const char *format, ...);
32737bad7489 fix list/tag interference
kono
parents: 427
diff changeset
2
32737bad7489 fix list/tag interference
kono
parents: 427
diff changeset
3
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
4 int
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
5 i(int a,int b,int c,int d,int f)
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
6 {
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
7 printf("#0006:i(%d,%d,%d,%d,%d)\n",a,b,c,d,f);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
8 return a+b+c+d+f;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
9 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
10
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
11 short
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
12 s(short a,short b,short c,short d,short f)
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
13 {
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
14 printf("#0013:s(%d,%d,%d,%d,%d)\n",a,b,c,d,f);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
15 return a+b+c+d+f;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
16 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
17
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
18 char
252
1452eb0eab20 *** empty log message ***
kono
parents: 249
diff changeset
19 ch(char a,char b,char c,char d,char f)
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
20 {
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
21 printf("#0020:ch(%d,%d,%d,%d,%d)\n",a,b,c,d,f);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
22 return a+b+c+d+f;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
23 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
24
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
25
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
26 float
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
27 f(float a,float b,float c,float d,float f)
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
28 {
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
29 printf("#0028:f(%g,%g,%g,%g,%g)\n",a,b,c,d,f);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
30 return a+b+c+d+f;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
31 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
32
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
33 double
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
34 d(double a,double b,double c,double d,double f)
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
35 {
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
36 printf("#0035:d(%g,%g,%g,%g,%g)\n",a,b,c,d,f);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
37 return a+b+c+d+f;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
38 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
39
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
40 long long
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
41 l(long long a,long long b,long long c,long long d,long long f)
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
42 {
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
43 printf("#0042:l(%lld,%lld,%lld,%lld,%lld)\n",a,b,c,d,f);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
44 return a+b+c+d+f;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
45 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
46
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
47
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
48 int
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
49 i0()
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
50 {
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
51 int a,b,c;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
52 a=3;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
53 b=-3;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
54 c=5;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
55 c = i(a*3,b*c,b+c,b/c,b-c);
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
56 printf("#0055:int: %d\n",c);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
57 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
58
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
59 int
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
60 g()
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
61 {
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
62 float a,b,c;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
63 a=3.0;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
64 b=-3.0;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
65 c=5.0;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
66 c = f(a*3,b*c,b+c,b/c,b-c);
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
67 printf("#0066:float: %g\n",c);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
68 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
69
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
70 int
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
71 h()
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
72 {
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
73 double a,b,c;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
74 a=3.0;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
75 b=-3.0;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
76 c=5.0;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
77 c = d(a*3,b*c,b+c,b/c,b-c);
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
78 printf("#0077:double: %g\n",c);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
79 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
80
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
81 int
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
82 h1()
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
83 {
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
84 long long a,b,c;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
85 a=3;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
86 b=-3;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
87 c=5;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
88 c = l(a*3,b*c,b+c,b/c,b-c);
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
89 printf("#0088:long long: %lld\n",c);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
90 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
91
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
92 int
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
93 c1()
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
94 {
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
95 char a,b,c;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
96 a=3;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
97 b=-3;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
98 c=5;
252
1452eb0eab20 *** empty log message ***
kono
parents: 249
diff changeset
99 c = ch(a*3,b*c,b+c,b/c,b-c);
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
100 printf("#0099:char: %d\n",c);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
101 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
102
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
103 int
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
104 s1()
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
105 {
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
106 short a,b,c;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
107 a=3;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
108 b=-3;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
109 c=5;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
110 c = s(a*3,b*c,b+c,b/c,b-c);
491
a379da780856 cond signed/unsigned
kono
parents: 467
diff changeset
111 printf("#0110:short: %d\n",c);
249
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
112 }
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
113
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
114 main()
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
115 {
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
116 i0();
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
117 g();
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
118 h();
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
119 h1();
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
120 return 0;
8313c965c0e2 *** empty log message ***
kono
parents:
diff changeset
121 }