AutoHotkey Community

It is currently May 26th, 2012, 5:56 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: sin, cos, tan problem.
PostPosted: April 30th, 2009, 5:28 pm 
Offline

Joined: February 19th, 2007, 9:03 am
Posts: 338
Location: Czech Republic
Hi, I need this:
gui,add,text,sinus
gui,add,edit,vsinnum
gui,add,edit,gok,ok
gui,show,sinus
return
ok:
gui,submit,nohide
sin(sinnum)
msgbox, Result is %sinnum%
This return normaly user writen number, why not sinus result?

_________________
Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2009, 7:04 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
Code:
msgbox, % "Result is " . sin(sinnum) ; ?

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 8:53 am 
Offline

Joined: February 19th, 2007, 9:03 am
Posts: 338
Location: Czech Republic
But next problem.
Sinus 30 is 0,5, but my calculator show 0,983... Why?

_________________
Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 9:02 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3329
Location: Simi Valley, CA
vlcek wrote:
But next problem.
Sinus 30 is 0,5, but my calculator show 0,983... Why?

The Manual wrote:
Sin(Number) | Cos(Number) | Tan(Number) : Returns the trigonometric sine|cosine|tangent of Number. Number must be expressed in radians.

Code:
DegToRad(deg)
{
   static pi := 3.14159265358979323846
   return deg * pi / 180
}


[edit:] quick fix

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Last edited by [VxE] on May 1st, 2009, 9:08 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 9:05 am 
Incorrect


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 9:08 am 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
Code:
DegToRad(deg)
{
   static pi := 3.14159265358979323846
   return deg * pi / 180
}

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 10:07 am 
Offline

Joined: February 19th, 2007, 9:03 am
Posts: 338
Location: Czech Republic
tonne wrote:
Code:
DegToRad(deg)
{
   static pi := 3.14159265358979323846
   return deg * pi / 180
}

Result of sin 30 is with your code 0,983032.
I use your code and msgbox, % "Result is " . sin(sinnum)

_________________
Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 10:39 am 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
I get 0.5 with:
Code:
msgbox % sin(degtorad(30))   

DegToRad(deg)
{
   static pi := 3.14159265358979323846
   return deg * pi / 180
}

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 1:28 pm 
Offline

Joined: February 19th, 2007, 9:03 am
Posts: 338
Location: Czech Republic
Now, I have problem with Asin(number.
When I want asin(0.5), the result is 30, but my calculator show 0.523... Why?

_________________
Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 2:55 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
From the help file
Quote:
Note: To convert a radians value to degrees, multiply it by 180/pi (approximately 57.29578). To convert a degrees value to radians, multiply it by pi/180 (approximately 0.01745329252). The value of pi (approximately 3.141592653589793) is 4 times the arctangent of 1.


Code:
msgbox % RadToDeg(Asin(0.5))

RadToDeg(rad)
{
  static pi := 3.14159265358979323846
  return rad * 180 / pi
}

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: batto, BrandonHotkey, Mtes, rafaelloureiro, tic and 72 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group