Skip to content

Commit b1c417c

Browse files
Menno Deij - van Rijswijkdavidscn
Menno Deij - van Rijswijk
authored andcommitted
Remove std::pow from constexpr
This is not supported by Intel oneAPI C++ compiler: ``` rigid_body_solver.cpp(117): error: expression must have a constant value constexpr double inertia_moment = (1. / 12) * mass * (4 * std::pow(length, 2) + std::pow(height, 2)); ^ /usr/include/c++/8/cmath(418): note: cannot call non-constexpr function "pow" (declared at line 140 of "/usr/include/bits/mathcalls.h") return pow(__type(__x), __type(__y)); ^ ```
1 parent c7d9034 commit b1c417c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

quickstart/solid-cpp/rigid_body_solver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int main()
114114
// The moment of inertia is computed according to the rigid body configuration:
115115
// a thin rectangular plate of height h, length l and mass m with axis of rotation
116116
// at the end of the plate: I = (1/12)*m*(4*l^2+h^2)
117-
constexpr double inertia_moment = (1. / 12) * mass * (4 * std::pow(length, 2) + std::pow(height, 2));
117+
constexpr double inertia_moment = (1. / 12) * mass * (4 * length * length + height * height);
118118
constexpr double delta_y = height / (n_vertical_nodes - 1);
119119
constexpr double delta_x = length / (n_horizontal_nodes - 1);
120120

0 commit comments

Comments
 (0)