annotate run/s/short_04_B.d @ 560:dc5ce97dab82

Nick <Nick_member@pathlink.com> 2005-05-25 news:d72fan$60m$1@digitaldaemon.com
author thomask
date Wed, 01 Jun 2005 13:02:35 +0000
parents
children 1e6afb94ce6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
560
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
1 // $HeadURL$
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
2 // $Date$
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
3 // $Author$
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
4
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
5 // @author@ Nick <Nick_member@pathlink.com>
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
6 // @date@ 2005-05-25
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
7 // @uri@ news:d72fan$60m$1@digitaldaemon.com
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
8
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
9 // __DSTRESS_DFLAGS__ -O
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
10
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
11 module dstress.run.s.short_04_B;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
12
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
13 int main(){
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
14 static short[] params = [1,3,5];
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
15
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
16 short[] sums = new short[3];
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
17 sums[] = 0;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
18
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
19 foreach(short d; params){
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
20 short prod = d;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
21
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
22 for(int i; i<2; i++){
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
23 sums[i] += prod;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
24 prod *= d;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
25 }
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
26 sums[2] += prod;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
27 }
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
28
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
29 assert(sums[0]==9);
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
30 assert(sums[1]==35);
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
31 assert(sums[2]==153);
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
32
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
33 return 0;
dc5ce97dab82 Nick <Nick_member@pathlink.com>
thomask
parents:
diff changeset
34 }