Skip to content
Snippets Groups Projects
Commit 310694e0 authored by Sander Mathijs van Veen's avatar Sander Mathijs van Veen
Browse files

Fixed 'float vs double' source file.

parent edff8604
No related branches found
No related tags found
No related merge requests found
......@@ -3,3 +3,4 @@ speed
fp
float_double
report.pdf
fd*
CC=clang
FLAGS=-Wall -Wextra -std=c99 -pedantic -O0 -lm
TYPES=float double LD
OPS=ADD DIV MULT SQRT
all: fp speed report.pdf float_double
all: fp speed report.pdf fd
%.pdf: %.tex
pdflatex $^
......@@ -12,23 +13,29 @@ speed: speed.c
for t in $(TYPES); do \
for o in $(OPS); do \
sed "s#{TYPE}#$$t#" $^ | sed "s#{OP}#$$o#" > speed.$$t.$$o.c; \
gcc $(FLAGS) -o speed.$$t.$$o speed.$$t.$$o.c; \
$(CC) $(FLAGS) -o speed.$$t.$$o speed.$$t.$$o.c; \
rm speed.$$t.$$o.c; \
done; \
done;
touch $@
fp: floating_point.o
gcc $(FLAGS) -o $@ $^
$(CC) $(FLAGS) -o $@ $^
float_double: float_vs_double.o
gcc $(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; \
done;
touch $@
%.o: %.c
gcc $(FLAGS) -o $@ -c $^
$(CC) $(FLAGS) -o $@ -c $^
%.s: %.c
gcc $(FLAGS) -o $* $^
$(CC) $(FLAGS) -o $* $^
clean:
rm -vf *.o *.i *.s fp speed speed.*.* floating_point
rm -vf *.o *.i *.s fp fd* speed speed.*.* floating_point \
report.pdf *.aux *.log *.toc
#include <stdlib.h>
#include <stdio.h>
{TYPE} sum_forward(int N);
{TYPE} sum_backward(int N);
int main(void) {
puts("Using type {TYPE}.");
......@@ -32,3 +35,4 @@ int main(void) {
return sum;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment