PaddiM8 / kalker

Scientific calculator with math syntax that supports user-defined variables and functions, complex numbers, and estimation of derivatives and integrals
https://kalker.xyz
MIT License
1.59k stars 70 forks source link

Trigonometric functions with degrees not convenient #96

Closed chemPolonium closed 11 months ago

chemPolonium commented 1 year ago

When I want to calculate sin(90deg) without brackets this is what I got:

>> sin 90deg
0.0156031853 rad

which is actually:

>> (sin 90)deg
0.0156031853 rad

Maybe the "deg" can have a higher order in calculation?

By the way, If the function is provided with "degrees"

>> sin (90deg)
1 rad

the "rad" after "sin" "cos" "tan" still exists. But these functions should "eat" the "rad".

PaddiM8 commented 11 months ago

This should now be fixed on master. This was due to an issue with precedence for parenthesis-less calls in general. sin90deg now returns just 1! Thanks for letting me know about this.