Except (0,0), if I enter any point on coordinate axes I am not getting the correct answer. For example If I enter (1,-0.01) I should get an angle close to 2pi. On (1,0), I should get pi/2. For (-1,0), (0,-1) I should get pi and 3pi/2 respectively. Do I need to redefine atan function on the coordinate axes? Please help.
real x,y,s;
cout<<"Enter x-coordinate : ";
cin>>x;
cout<<"Enter y-coordinate : ";
cin>>y;
s=atan(y/x);
cout<<"Polar angle of the coordinate is : ";
cout<<s;