Trigo : javascript VS Math Expression = radians VS degres ;)

yanomano's picture

Perhaps i forget something, but i have just discovered that the javascript patch return Math.trigo functions in RADIANS while the math expression return DEGRES

ex with 90 as input :
With a Math expression patch : sin(90) =1 (degres)
With a javascript patch : Math.sin (90) = 0.8939966 (radians)

Both are correct, but when you convert code to expression or vice versa sometimes it can take time before you start to understand why it's not working ;)

So to have Math.sin in degres with javascript you have to do :
Math.sin(angle*(Math.PI/180))

As as I have lost 3 hours to understand it, I hope perhaps this will be helpful for someone :)

PreviewAttachmentSize
Javascript_VS_mathEX.qtz6.8 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

usefuldesign.au's picture
Re: Trigo : javascript VS Math Expression = radians VS ...

Hey this comes up time to time Yanamano you're not the first to lose time on it!

dust's picture
Re: Trigo : javascript VS Math Expression = radians VS ...

cool i was messing with these differences yesterday so its nice to see this today.