-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Description
Description
In the code, the scale is set to scalar_type(1/2) when the exponential value is used. This is to ensure that there is a compile-time conversion between the scalar type of the class and the scalar type of the exponential value. However, this can cause an issue because the value is computed at compile time with integer division, which result zero.
Position
You can find this issue in the code by searching for scalar_type(1/2). The issue is ever present in the exponential computation.
Small test
#include <iostream>
template <class scale_type> class Test {
public:
Test() { std::cout << scale_type(1 / 2) << ' '; }
};
int main() {
Test<int> t0;
Test<float> t1;
Test<double> t2;
return 0;
}
Result:
0 0 0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels