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 Discussion / al kashi's theorem

Author
Message
RYD
16
Years of Service
User Offline
Joined: 29th Apr 2008
Location: realspace
Posted: 8th Jul 2009 07:06
can somewhone explain why this doesnt work
its to calculate an angle from the lenth of three sides


ARM YOURSELF WITH KNOLEGE
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 8th Jul 2009 08:26


That is probably your problem. Don't forget: Computers are inherently stupid.They will do EXACTLY What you well them so for instance:

div#=hay#/2*b#

Will be read as

div#=(hay#/2)*b#

Introducing the correct parenthesis should correct the problem (though I haven't tested that).
So this is what you want:
hay#=(a#*a#)+(b#*b#)-(c#*c#)
div#=hay#/(2.0*b#)

Also notice the 2.0 . It could be getting confused with an integer on the bottom. 2.0 is a float and will maintain it throughout the calculations (again, I don't know if it is changing anything but it can't hurt)

Hope this helps

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
RYD
16
Years of Service
User Offline
Joined: 29th Apr 2008
Location: realspace
Posted: 8th Jul 2009 22:48
whell i solved the problem now ,
here it is

i'll be putting it in the code base

ARM YOURSELF WITH KNOLEGE

Login to post a reply

Server time is: 2024-05-20 12:00:53
Your offset time is: 2024-05-20 12:00:53