 # Java Trigonometry

This is really a math problem but I am trying to get the sin for angles in compass bearings.
Azimuth starts from North and bearings are from 0 to 359 degrees. All goes well from 0 to 90 but then the results are incorrect due to the fact that java math requires angles in radians and higher angles return minus results. What would be the best solution to get around this. Should I break the compass into quadrants and return results to their specific quadrant?
Editors IDEsMath / Science Last Comment
bravotango

8/22/2022 - Mon
Cyril Joudieh

Even if they return minus, that does not mean anything wrong.

For SIN
SIN(180-x) = SIN(x)
SIN(180+x) = -SIN(x) of course you have to convert to radians

SIN(90-x) = COS(x)
SIN(90+x) = COS(x)
ozo

where pi = 4*atan2(1,1) = 3.141592653589793238462643383279...
aburr

the sine of some angles ARE neative.
bravotango

Thanks for the comments.. I think I am on a better understanding of my problem now.
I found this comment on a very good site regarding solar problems.
The warning about trigonometric functions expecting angles expressed in radians still applies. Note that the azimuth needs to be expressed as a value between 0º and 360º, or -180º and 180º. To do this, consider that the tangent of an angle is y/x. Typically, programming languages and spreadsheets include arctangent functions that require both the x and y coordinates to be specified so the function can consider the sign of each component to determine the proper quadrant for the result.
I just need to work out how to do  this.