annotate CbC-examples/parallel_check/c-int-double.c @ 42:9e4f9e20b8f1

add some examples.
author kent@teto.cr.ie.u-ryukyu.ac.jp
date Mon, 25 Jan 2010 17:13:59 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #include<stdio.h>
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 #include<math.h>
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 #define dprint(f, args...) \
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 printf("in %s env=%p: "f, __FUNCTION__, __builtin_frame_address(1), ## args)
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
7 int
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8 test(int a)
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
9 {
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10 return (int)pow(a, 2.0);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11 }
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13 int
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14 callee(double a, double b, double c, int d)
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15 {
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
16 dprint("a=%d,b=%d,c=%d,d=%d\n", a,b,c,d);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17 return a+b+c+d;
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
18 }
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
19
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20 int
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
21 caller(int a, double b, double c, double d)
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
22 {
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
23 int x;
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
24 double y,z,w;
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 //x = test(a);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26 //y = test(b);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27 //z = test(c);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
28 //w = test(d);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
29 x=a, y=b;
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
30 z=c, w=d;
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
31
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32 return callee(y,z,w,x);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
33 //return callee(b,c,d, a);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
34 }
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36 int
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37 main (int argc, char **argv)
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38 {
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
39 int r;
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
40 r = caller(11,22,33,44);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
41 //r = caller(11,22,33,44, 55,66,77,88);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
42 printf("r = %d\n", r);
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
43 }
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
44
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
45
9e4f9e20b8f1 add some examples.
kent@teto.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
46