Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uva
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
uva
Commits
897a1d64
Commit
897a1d64
authored
14 years ago
by
Sander Mathijs van Veen
Browse files
Options
Downloads
Plain Diff
Merged makefile.
parents
cadc6ad6
9e7fee90
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
simmod/ass1/.gitignore
+3
-0
3 additions, 0 deletions
simmod/ass1/.gitignore
simmod/ass1/Makefile
+10
-9
10 additions, 9 deletions
simmod/ass1/Makefile
simmod/ass1/sum.c
+13
-17
13 additions, 17 deletions
simmod/ass1/sum.c
with
26 additions
and
26 deletions
simmod/ass1/.gitignore
+
3
−
0
View file @
897a1d64
sum.float
sum.double
sum
speed.*.*
speed
fp
...
...
This diff is collapsed.
Click to expand it.
simmod/ass1/Makefile
+
10
−
9
View file @
897a1d64
CC
=
gcc
FLAGS
=
-Wall
-Wextra
-std
=
c99
-pedantic
-O0
-lm
TYPES
=
float double LD
SPEED_TYPES
=
float double LD
SUM_TYPES
=
float double
OPS
=
ADD DIV MULT SQRT
all
:
fp speed report.pdf
fd
pr
all
:
fp speed report.pdf
sum
pr
%.pdf
:
%.tex
pdflatex
$^
pdflatex
$^
speed
:
speed.c
for
t
in
$(
TYPES
);
do
\
for
t
in
$(
SPEED_
TYPES
);
do
\
for
o
in
$(
OPS
);
do
\
sed
"s#{TYPE}#
$$
t#"
$^
|
sed
"s#{OP}#
$$
o#"
>
speed.
$$
t.
$$
o.c
;
\
$(
CC
)
$(
FLAGS
)
-o
speed.
$$
t.
$$
o speed.
$$
t.
$$
o.c
;
\
...
...
@@ -25,11 +26,11 @@ pr: extra_precision.o
fp
:
floating_point.o
$(
CC
)
$(
FLAGS
)
-o
$@
$^
fd
:
float_vs_double
.c
for
t
in
float double
;
do
\
sed
"s#{TYPE}#
$$
t#"
$^
>
fd
.
$$
t.c
;
\
$(
CC
)
$(
FLAGS
)
-o
fd
.
$$
t
fd
.
$$
t.c
;
\
rm
fd
.
$$
t.c
;
\
sum
:
sum
.c
for
t
in
$(
SUM_TYPES
)
;
do
\
sed
"s#{TYPE}#
$$
t#"
$^
>
sum
.
$$
t.c
;
\
gcc
$(
FLAGS
)
-o
sum
.
$$
t
sum
.
$$
t.c
;
\
rm
sum
.
$$
t.c
;
\
done
;
touch
$@
...
...
@@ -41,4 +42,4 @@ fd: float_vs_double.c
clean
:
rm
-vf
*
.o
*
.i
*
.s fp fd
*
speed speed.
*
.
*
floating_point
\
report.pdf
*
.aux
*
.log
*
.toc
report.pdf
*
.aux
*
.log
*
.toc
sum
sum.float sum.double
This diff is collapsed.
Click to expand it.
simmod/ass1/
float_vs_double
.c
→
simmod/ass1/
sum
.c
+
13
−
17
View file @
897a1d64
#include
<stdlib.h>
#include
<stdio.h>
{
TYPE
}
sum_forward
(
int
N
);
{
TYPE
}
sum_backward
(
int
N
);
int
main
(
void
)
{
puts
(
"Using type {TYPE}."
);
puts
(
"Forward summation:"
);
printf
(
"N = 1e8: %e
\n
"
,
sum_forward
(
1e8
));
printf
(
"N = 2e8: %e
\n
"
,
sum_forward
(
2e8
));
puts
(
"Backward summation:"
);
printf
(
"N = 1e8: %e
\n
"
,
sum_backward
(
1e8
));
printf
(
"N = 2e8: %e
\n
"
,
sum_backward
(
2e8
));
return
0
;
}
{
TYPE
}
sum_forward
(
int
N
)
{
{
TYPE
}
sum
=
0
;
...
...
@@ -36,3 +19,16 @@ int main(void) {
return
sum
;
}
int
main
(
void
)
{
puts
(
"Using type {TYPE}."
);
puts
(
"Forward summation:"
);
printf
(
"N = 1e8: %e
\n
"
,
sum_forward
(
1e8
));
printf
(
"N = 2e8: %e
\n
"
,
sum_forward
(
2e8
));
puts
(
"Backward summation:"
);
printf
(
"N = 1e8: %e
\n
"
,
sum_backward
(
1e8
));
printf
(
"N = 2e8: %e
\n
"
,
sum_backward
(
2e8
));
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment