From 12466ff4e71a28b31341b3f5fc23afa69b5b3431 Mon Sep 17 00:00:00 2001
From: Pascal Engeler <engelerp@phys.ethz.ch>
Date: Tue, 28 Sep 2021 13:40:45 +0200
Subject: [PATCH] ex01 feedback added

---
 ex1/epsilon.cpp | 15 +++++++++++++--
 ex1/main.cpp    |  4 ++++
 ex1/simpson.cpp |  9 +++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/ex1/epsilon.cpp b/ex1/epsilon.cpp
index c6a209c..440f5e2 100644
--- a/ex1/epsilon.cpp
+++ b/ex1/epsilon.cpp
@@ -1,3 +1,15 @@
+/*
+	Pascal: Looks good to me, albeit not necessarily precise.
+
+	Note that python's import is very different from preprocessor directives.
+	In python, there is a whole import machinery, while the #include directive
+	merely instructs the preprocessor to copy-paste a specific file.
+
+	Personally, I'm not a fan of 'using namespace xxx'. At the very least, you
+	pollute the global namespace and make it harder to keep track of where specific
+	functions and classes are actually coming from.
+*/
+
 // "include" is like the import in Python
 #include <iostream>
 // namespace allow us to group named entities into narrower scopes, that otherwise
@@ -5,7 +17,7 @@
 using namespace std;
 
 void machineEpsilon(float EPS) {
-	
+
 	float prev_epsilon = EPS;
 
 	while ((1+EPS) != 1){
@@ -20,4 +32,3 @@ void machineEpsilon(float EPS) {
 int main(){
 	machineEpsilon(0.5);
 }
-
diff --git a/ex1/main.cpp b/ex1/main.cpp
index c6cb9d2..0d8eeda 100644
--- a/ex1/main.cpp
+++ b/ex1/main.cpp
@@ -1,3 +1,7 @@
+/*
+	Pascal: Looks good to me.
+*/
+
 # include <iostream>
 
 using namespace std;
diff --git a/ex1/simpson.cpp b/ex1/simpson.cpp
index 1836122..e19a0c5 100644
--- a/ex1/simpson.cpp
+++ b/ex1/simpson.cpp
@@ -1,3 +1,12 @@
+/*
+	Pascal: Looks good to me.
+
+	You could still optimize the number of mathematical operations. For example,
+	per call to calculateSimpsonIntegral, you only need one multiplication with
+	binSize/6, as opposed to the N you are performing. You are also calling f
+	more often than necessary.
+*/
+
 //Simpson's integration method
 #include <iostream>
 #include <cmath>
-- 
GitLab