| View previous topic :: View next topic |
| Author |
Message |
vlcek
Joined: 19 Feb 2007 Posts: 338 Location: Czech Republic
|
Posted: Thu Apr 30, 2009 4:28 pm Post subject: sin, cos, tan problem. |
|
|
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. |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1651 Location: Denmark
|
|
| Back to top |
|
 |
vlcek
Joined: 19 Feb 2007 Posts: 338 Location: Czech Republic
|
Posted: Fri May 01, 2009 7:53 am Post subject: |
|
|
But next problem.
Sinus 30 is 0,5, but my calculator show 0,983... Why? _________________ Thanks. |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 3254 Location: Simi Valley, CA
|
Posted: Fri May 01, 2009 8:02 am Post subject: |
|
|
| 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 Fri May 01, 2009 8:08 am; edited 1 time in total |
|
| Back to top |
|
 |
Guest
|
Posted: Fri May 01, 2009 8:05 am Post subject: |
|
|
| Incorrect |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1651 Location: Denmark
|
|
| Back to top |
|
 |
vlcek
Joined: 19 Feb 2007 Posts: 338 Location: Czech Republic
|
Posted: Fri May 01, 2009 9:07 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1651 Location: Denmark
|
Posted: Fri May 01, 2009 9:39 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
vlcek
Joined: 19 Feb 2007 Posts: 338 Location: Czech Republic
|
Posted: Fri May 01, 2009 12:28 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1651 Location: Denmark
|
Posted: Fri May 01, 2009 1:55 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|