Commit 251e56c1 authored by amitjans's avatar amitjans
Browse files

Merge branch 'feedback' into 'main'

ex01 feedback added

See merge request !2
parents c18204cd 12466ff4
/*
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);
}
/*
Pascal: Looks good to me.
*/
# include <iostream>
using namespace std;
......
/*
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>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment