DXsmiley / mathbot

Discord bot for mathematics
https://dxsmiley.github.io/mathbot/
GNU General Public License v3.0
278 stars 50 forks source link

Support degrees using "°" #9

Open ioistired opened 6 years ago

ioistired commented 6 years ago

To do this, replace with rad(x).

DXsmiley commented 5 years ago

So I've finally given some thought to this idea.

If someone puts in 20°, the naive approach will result in the output being the same result in radians. This might be ok if people are aware of the behavior. If someone puts in asin(sin(20°)) without an understanding of how things work they might end up very confused. This might be a reasonable trade off for convenience though.

If the calculator had a stronger type system, I'd suggest putting degrees at the type level and having some smart conversions between degrees and radians, as well as smarter output, but unfortunately we don't have that.