Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / DBPro's COS function

Author
Message
CSL
17
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 23rd Apr 2013 04:33 Edited at: 23rd Apr 2013 04:37
For the life of me, I give up. I\'ve been trying to write my own COS function COSRAD, to return my results in radians by converting DBPro\'s built in COS function, which defaults to degrees

Comparing the results from the program below on my old Texas Instruments computer, which uses radians, they don\'t match with DBPro\'s.

The TI computer results come out as .5 on both instances, while DBPro returns 1. What am I doing wrong?!?!?



CSL
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Apr 2013 04:48
Well cos takes an angle, it doesn't return one. acos is what returns an angle. Is that what you mean?

"You're all wrong. You're all idiots." ~Fluffy Rabbit
pcRaider
19
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 23rd Apr 2013 05:15


windowsXp
CSL
17
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 23rd Apr 2013 05:41 Edited at: 23rd Apr 2013 07:04
Arrrghhh, I figured it out!!!!



I confirmed the results here
http://www.rkm.com.au/calculators/CALCULATOR-radians-sine-cosine-tan.html


Correction!

The actual function should look like this.



The angle in degrees parameter (argument#) is converted to angle in radians (b#) then you find the cosine and return the result#.

The multiplier of 57.295.... is the equivalent of 180.0 / 3.141592653589793

CSL

Login to post a reply

Server time is: 2026-07-07 04:33:04
Your offset time is: 2026-07-07 04:33:04