uns ist letztens was lustiges Untergekommen, was Inkonsistent in sich selbst und mit Matlab / C ebenfalls:
Die Ergebnisse sind unterschiedlich, man beachte dass fuer ints in Python ein anderes Ergebniss kommt als fuer floats...
Python 2.6:
Code: Alles auswählen
from math import atan2
atan2(0,-0)
0.0
atan2(0.0,-0.0)
3.1415926535897931
Code: Alles auswählen
>> atan2(0,-0)
ans =
0
>> atan2(0.0,-0.0)
ans =
0
Mit C++
Code: Alles auswählen
#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main ()
{
double x, y, result;
x = 0.0;
y = -0.0;
result = atan2 (y,x) ;
printf ("The arc tangent for (x=%lf, y=%lf) is %lf ", x, y, result );
return 0;
}
The arc tangent for (x=0.000000, y=-0.000000) is -0.000000
Wo liegt der Fehler?
Gruesse,
T