1. Mathematical functions
- Posted by Nathan T Dudek <c.overload at JUNO.COM> Mar 15, 1997
- 905 views
Hi everyone -- I'm a little new to the Euphoria world (actually, I've had it for three months but never have had time to fool around with it!). This is probably a dumb question. I'm trying to write a trigonometry program for my geometry class. It's supposed to get an angle which the user inputs, and then it should return the cosine, sine, and tangent of the angle. It works fine, except when the numbers are converted to the cosine, sine, and tangent, they are wrong!!! I've been inputting 35 as a test angle when trying the program. The program returns .4738147 as the tangent (the actual tan of 35 is .7002075)! Help!! Thanks in advance, Nate Dudek
2. Re: Mathematical functions
- Posted by Jacques Deschjnes <desja at QUEBECTEL.COM> Mar 15, 1997
- 902 views
Hi Nathan, The problem is that euphoria trigonometrics functions work with radians not degrees. You have to convert from degrees to radians. function DegToRad(atom deg) return deg/180*3.1415 end function function RadToDeg(atom rad) return rad/3.1415*180 end function ? sin(DegToRad(35))