Quantcast
Channel: User Mark - Stack Overflow
Viewing all articles
Browse latest Browse all 44

Sin, cos etc for Python 2 Decimal?

$
0
0

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)


Viewing all articles
Browse latest Browse all 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>