Im trying to do a simple rotation to a point, but i dont know why im not getting it accurate.

as i know the cos and sin expect an angle in radian.

f.e. I want to rotate a point A(x1,y1) around a Point (xo,yo) with 270 degree.
lets assume

Qt Code:
  1. qreal xo,yo,x1,y1,radianAngle,angle;
  2. qreal newX,newY;
  3.  
  4.  
  5. angle = 270;
  6. radianAngel = angle * M_PI/180;
  7.  
  8. xo = 0;
  9. yo = 0;
  10. x1 = 0;
  11. y1 = 1000;
  12. qreal c = cos(radianAngel);
  13. qreal s = sin(radianAngel);
  14.  
  15. newX= (x1-xo) * c - (y1-yo) * s+yo;
  16. newY= (x1-xo) * s + (y1-yo) * c+yo;
  17.  
  18. qDebug()<< QString("rotatin x=%1 , y=%2 with %3 = newx=%4 newy=%5")
  19. .arg(x1)
  20. .arg(y1)
  21. .arg(angel)
  22. .arg(newX)
  23. .arg(newY);
  24.  
  25. // this is what i get !!
  26. // "rotating x=0 , y=1000 with 270 = newx=1000 newy=-1.83691e-13"
To copy to clipboard, switch view to plain text mode 

I don't know why for the newY im not getting "0" instead i'm getting "-1.83691e-13".
so the issue is when i transfer to radian and get the cos and sin im not getting the exact correct value.

any suggestion, or what mistake im doing.

Thanks