comparison tests/mini/arrayops4.d @ 703:06576ece1a1b

Changed premake.lua to work with mingw. Implemented array operations, not perfect but ok for tonight. closes #89
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 13 Oct 2008 23:19:32 +0200
parents
children
comparison
equal deleted inserted replaced
702:353d9d184091 703:06576ece1a1b
1 void main()
2 {
3 auto a = new float[1024];
4 auto b = new float[1024];
5 auto c = new float[1024];
6
7 for (auto i=0; i<1024; i++)
8 {
9 a[i] = i;
10 b[i] = i*2;
11 c[i] = i*4;
12 }
13
14 a[] = b[] + c[] / 2;
15
16 foreach(i,v; a)
17 {
18 assert(eq(v, b[i] + c[i] / 2));
19 }
20 }
21
22 float abs(float x)
23 {
24 return x<0?-x:x;
25 }
26 bool eq(float a, float b)
27 {
28 return abs(a-b) <= float.epsilon;
29 }