How do I convert Degrees to radians?
I'm wiring a program (Obj-C, command line) to calculate the earths declination at any given day of the year.
The formal is:
Declination Angle = asin(0.39795*cos((0.98563*(DOY - 173))))
I started by trying to evaluate how the computer deals with each ( ) and whats inside of it.
The first part (DOY - 173) is easy
The second part (0.98563 * (DOY - 173)) i run into a little bit of problems as this is degrees but needs to be converted to radians to make cos and asin work properly. right now I found that:
(0.98563 * (DOY - 173)) * (3.14159/180)
works but is their an easier way? I'm going to have a lot of these in the feature todo and would very much like to find an easier way.
Also how do I round values. I'm using float but I read don't need the earths declination down to the millionths of a degree?
I would also like to say thank you to any one who has been helping me in my other post. I hope that I'm not driving anyone nuts. I am actually going some where with this.
I'm wiring a program (Obj-C, command line) to calculate the earths declination at any given day of the year.
The formal is:
Declination Angle = asin(0.39795*cos((0.98563*(DOY - 173))))
I started by trying to evaluate how the computer deals with each ( ) and whats inside of it.
The first part (DOY - 173) is easy
The second part (0.98563 * (DOY - 173)) i run into a little bit of problems as this is degrees but needs to be converted to radians to make cos and asin work properly. right now I found that:
(0.98563 * (DOY - 173)) * (3.14159/180)
works but is their an easier way? I'm going to have a lot of these in the feature todo and would very much like to find an easier way.
Also how do I round values. I'm using float but I read don't need the earths declination down to the millionths of a degree?
I would also like to say thank you to any one who has been helping me in my other post. I hope that I'm not driving anyone nuts. I am actually going some where with this.