What am I doing wrong with this math.js expression?

Why is math.js returning the wrong number??

At math.js.org I have verified that the expression below will return the number -4.15, but when I run it in my app, it returns the number -61.6. I can’t figure it out!!

20log10(sqrt((((1)cos(0.1pi/180)+(1)cos(-216pi/180))^2)+(((1sin(0.1pi/180))+(1sin(-216*pi/180)))^2)))

2020-07-31 at 16.35.10

Solved! I saw in some other posts people talking about EncodeURI, which, I still don’t really understand, but I updated the expression at this site and math.js returned the correct answer. :man_shrugging:

20*log10(sqrt((((1)*cos(0.1*pi%2F180)%2B(1)*cos(-216*pi%2F180))%5E2)%2B(((1*sin(0.1*pi%2F180))%2B(1*sin(-216*pi%2F180)))%5E2)))

1 Like