The Daily Click ::. Forums ::. Klik Coding Help ::. Advanced math's Arctan feature
 

Post Reply  Post Oekaki 
 

Posted By Message

mushi-games



Registered
  17/02/2005
Points
  136
15th August, 2005 at 03:07:22 -

Ok, sorry if this has already been asked, I've solved this myself a coupla times in TGF, but in my latest venture I'm kinda stumped.
Why is it that "( ArcTan( "Advanced Math object", ( 100 / 100 ) ) ) * ( 180 * 3.14159 )" equals 25446.9
where it's supposed to evaluate to 45.
Am I missing some brackets or something, I know how maths should be working, it's gotta be something simple, no?
Cheers

 

He did harken unto her, "hark hark," harkened he.

http://www.freepgs.com/mushi/

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
15th August, 2005 at 05:41:25 -

ArcTan( "Advanced Math object", (100/100))
=
ArcTan( "Advanced Math object", (1))
=
45

180 * 3.14159
=
565.4862


45 * 565.4862
=
25446.879

I know arctan(1) = 0.785398163, so I guess the AMO must do what you're trying to do automatically.
Still might want to check your maths though, because I hit arctan(1) * (180 * 3.14159) on my calculator and got 444.131823.

 
n/a

mushi-games



Registered
  17/02/2005
Points
  136
15th August, 2005 at 09:07:49 -

Hi, thanks.
OK *deep breath*
Yeah advanced maths is automatically converting radians to degrees. Arctangent (the inverse function if tangent (tan^-1)) finds the answer in radians but most calculators are automatically set to convert to degrees these days, mine was old so I needed to go radians*(180/pi) to get the degrees.

Also the arctan function in the advanced maths object does NOT work AT ALL, because I doesn't handle decimals correctly (although obviously it can always find an angle such as 45 correctly (whole number input)). Also it's ultra screwy when the decimal offset is turned on, because of the way it fakes decimals, which means arctan won't work, it needs real decimals. (Cellosoft's own example shows that it doesn't work, try it).

*throws advanced math object out the window*, is there another (newer) extension that has arctan?

(I'm about 99% sure of all of this, I hope I can be proven wrong, it's a bitch of an extension.)

Thanks again, it would've taken me ages to notice!


 

He did harken unto her, "hark hark," harkened he.

http://www.freepgs.com/mushi/

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
15th August, 2005 at 09:37:35 -

MMF is generally screwy with decimals. Is there no way you could fake it? Like, with trig conversion formulas, and an AMO operation that does work?

 
n/a

mushi-games



Registered
  17/02/2005
Points
  136
15th August, 2005 at 10:00:20 -

"MMF is generally screwy with decimals"

That’s very true, I'm gonna look into it, but I'm not holding out, the actual trig functions are VERY complicated and involve i's (imaginary number) and all sorts of very complex things to re-create, It's far beyond MMF (and me).
Also faking decimals for trig functions is a no go, because of the way they work, need real decimals (unless the extensions is written to convert MMF whole numbers to C decimals, which I think some of the amath functions are (just not the ones I need ).
Short of writing a quick maths extension myself, I don't think it can be done.

Again, im not 100%... I may be able to use the angle calculator to do what I'm trying to do (It has a find angle' function built in, but again, it doesn't seem to function identically to the C/++/Java equivalent, or any other real language, which are perfect).


 

He did harken unto her, "hark hark," harkened he.

http://www.freepgs.com/mushi/

mushi-games



Registered
  17/02/2005
Points
  136
15th August, 2005 at 10:06:07 -

Bloody hell, sorry for the woeful grammar in all that ...

 

He did harken unto her, "hark hark," harkened he.

http://www.freepgs.com/mushi/

RapidFlash

Savior of the Universe

Registered
  14/05/2002
Points
  2712
15th August, 2005 at 17:11:47 -

If you're using MMF, you don't need to use the Advanced Math Object. The arctan() function in MMF works perfectly for me.

 
http://www.klik-me.com

mushi-games



Registered
  17/02/2005
Points
  136
15th August, 2005 at 21:42:42 -

ARRRRRRRRRRRRRRRRRRRRRRRR!!!!!!!!!!!!!
Thanks! Man I didn't even KNOW mmf had a damn arctan function (why the HELL isn't it in the expression editor?), holy crap that was a waste of time/effort, well I guess I don't need any extensions.

(btw, it took me a while to figure out it was ATan() not arctan(), as you said. And also, anyone else wanting to use it, you need to deliberately use floats in the function otherwise it won't work, damn MMF.)
Cheers again.

 

He did harken unto her, "hark hark," harkened he.

http://www.freepgs.com/mushi/
   

Post Reply



 



Advertisement

Worth A Click