In Python 2.6, I found that the Decimal equivalent of sqrt(pi)
is
Decimal(pi).sqrt()
Is there anything like that for sin, cos or other (inverse) trigonometric functions?
The docs only mention how to calculate cos
and sin
computationally. Decimal(pi).cos()
doesn't exist nor does from decimal import cos
Update: the problem with using the default trigonometric functions is that it defeats the point of using Decimal
if I convert them from float and back every time I want to calculate something. (Also typing Decimal
around every calculation is annoying, but I guess I could make a wrapper function)