In C++, the following code:
#include <math.h>
#include <iostream>
int main() {
std::cout << remainder(-177.14024960054252, 360) << std::endl;
}
Compiled with x86-64 GCC 12.2 (https://godbolt.org/z/43MzbE1ve)
Outputs:
-177.14
However in Python:
np.remainder(-177.14024960054252, 360)
# and
-177.14024960054252 % 360
Both output:
182.85975039945748
According to the numpy docs, np.remainder
is doing the IEEE remainder function. According to the C++ docs, remainder
is also doing the IEEE remainder function.
Why are these two numbers different?