Pulover / PuloversMacroCreator

Automation Utility - Recorder & Script Generator
http://www.macrocreator.com
Other
1.66k stars 235 forks source link

Cos() function always returning 1.000000 #221

Closed kaedog closed 2 years ago

kaedog commented 2 years ago

when I multiply a variable (either by V := VM or V = M) before passing it through the Cos() function it always returns 1.000000 bugexample

This doesn't happen when I pass it any other variable

very frustrating, seems like a bug. Anybody have ideas for workarounds? Thanks in advance

kaedog commented 2 years ago

Just to illustrate, here is the same script without the multiplication before the Cos(): bugexample2

works like it should

PaulCauchois commented 2 years ago

The cosine function works as intended, it's just that you multiply r2 by 2pi beforehand. The cosine of an integer multiplied by 2pi is always 1, so it's completely logical it would return that value. Short proof : cos(2pin) = Re(e^(i2pi*n)) = Re((e^i 2pi)^n) = Re(1^n) = 1^n = 1 given that n is an integer.

kaedog commented 2 years ago

Thank you for the explanation. I realize now that I just wasn't understanding the math. Sorry for posting this non-issue.