Commit cd4ef9ee authored by amitjans's avatar amitjans
Browse files

Merge branch 'main' of

parents 52376d24 251e56c1
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(){
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>
......@@ -8,6 +8,12 @@
#include <iomanip> // for std::setprecision
#include <limits> // for std::numeric_limits
Yes, I think your assessment is correct.
However, note that the two definitions you quote are identical.
The bisection method gets the true value of epsilon as
......@@ -65,5 +71,3 @@ int main() {
<< "Double: " << epsilon_limits<double>() << '\n'
<< "Long double: " << epsilon_limits<long double>() << '\n';
# Pascal:
# Looks good to me. Just note that the project name (and variables...) should
# "make sense".
# One complaint: Your shared library generation doesn't work. It took me way
# too long to find out what the issue is. I challenge you to track down the
# issue too.
# Note that the data file is a build artefact which I should be able to
# generate. No need to add this to the repo.
# require minimum version of CMake
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.21)
# set name of project
......@@ -15,6 +25,7 @@ else()
# tell CMake that there is another CMakeLists.txt in this subdirectory
......@@ -26,5 +37,3 @@ target_link_libraries(print_integrals integratorLib)
# specify install rules
install(TARGETS print_integrals DESTINATION bin)
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