Skip to content

Commit f1f9663

Browse files
committed
Fix naming issue of division function, syntax error
1 parent e1c4f8e commit f1f9663

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

source-code/interfacing-c-c++-fortran/Pybind11/Simple/computations.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ double mul(double a, double b) {
66
return a * b;
77
}
88

9-
double div(double a, double b) {
9+
double divide(double a, double b) {
1010
return a/b;
1111
}

source-code/interfacing-c-c++-fortran/Pybind11/Simple/computations.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
double add(double a, double b);
55
double mul(double a, double b);
6-
double div(double a, double b);
6+
double divide(double a, double b);
77

88
#endif
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#include <pybind11/pybind11.h>
22
#include "computations.h"
33

4+
namespace py = pybind11;
5+
46
PYBIND11_MODULE(computations, m) {
57
m.doc() = "pybind11 wrapper module for cmoputations.h";
68
m.def("add", &add, "function that adds two numbers");
79
m.def("mul", &mul, "function that multiplies two numbers");
8-
m.def("div", &div, "function that divides two numbers"
9-
py::arg("left_op"), py::arg("right_op"));
10+
m.def("div", &divide, "function that divides two numbers",
11+
py::arg("num"), py::arg("denom"));
1012
}

0 commit comments

Comments
 (0)