Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
374fbaf0
Commit
374fbaf0
authored
Aug 21, 2007
by
Matthias Braun
Browse files
make fehler68 deterministic
[r15575]
parent
a3c0f216
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/be/test/fehler68.c
View file @
374fbaf0
...
...
@@ -29,6 +29,8 @@ main()
float
*
aa
=
(
float
*
)
ca
;
float
*
ab
=
(
float
*
)
cb
;
srand
(
0
);
printf
(
"Scalar product
\n
==============
\n\n
"
);
//printf("Array Position: %u, %u, %u, %u\n", a, b, aa, ba/*(unsigned int) &aa[0] % 16, (unsigned int) &ba[0] % 16*/);
...
...
@@ -42,7 +44,6 @@ main()
//printf("(%g * %g) + ", a[i], b[i]);
}
//for(i = 0; i < max_elements - 4; i += 4)
res
=
scalar_product
(
aa
,
ab
,
max_elements
);
printf
(
"
\n
Result: %g
\n
"
,
res
);
...
...
@@ -51,19 +52,15 @@ main()
float
scalar_product
(
float
*
a
,
float
*
b
,
unsigned
int
max_elements
)
{
float
res
;
float
res
=
0
;
int
i
;
/*for(i = 0; i < 4; i++)
{
a[i] = (float) (rand() % 10);
b[i] = (float) (rand() % 10);
printf("(%g * %g) + ", a[i], b[i]);
}*/
for
(
i
=
0
;
i
<
max_elements
;
i
+=
4
)
res
+=
a
[
i
]
*
b
[
i
]
+
a
[
i
+
1
]
*
b
[
i
+
1
]
+
a
[
i
+
2
]
*
b
[
i
+
2
]
+
a
[
i
+
3
]
*
b
[
i
+
3
];
for
(
i
=
0
;
i
<
max_elements
;
i
+=
4
)
{
res
+=
a
[
i
]
*
b
[
i
];
res
+=
a
[
i
+
1
]
*
b
[
i
+
1
];
res
+=
a
[
i
+
2
]
*
b
[
i
+
2
];
res
+=
a
[
i
+
3
]
*
b
[
i
+
3
];
}
return
(
res
)
;
return
res
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment