Cosine function

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Cosine function

Post by nodochau » Wed Jan 22, 2020 6:46 pm

Hello All,
What wrong with this function:
Let>ans={cos(340)}
And it returns me ans=0.759668310007225.
My calculator returns me 0.93969207859...
:(
??
Please help

hagchr
Automation Wizard
Posts: 327
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: Cosine function

Post by hagchr » Wed Jan 22, 2020 8:40 pm

Hi, According to the manual, the COS function requires the angle to be entered in radians, not degrees, see conversion below:

Code: Select all

Let>val_in_degrees=340
Let>val_in_radians={%val_in_degrees%/360*2*Pi}
Let>result={cos(%val_in_radians%)}
MDL>result

nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Re: Cosine function

Post by nodochau » Thu Jan 23, 2020 11:31 am

Yes, You are right.
Thanks a lot. I haven't read the instruction well enough :(

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts