jepler_udecimal.utrig

Trig functions using jepler_udecimal

Importing this module adds the relevant methods to the Decimal object.

Generally speaking, these routines increase the precision by some amount, perform argument range reduction followed by evaluation of a taylor polynomial, then reduce the precision of the result to equal the origial context’s precision.

There is no guarantee that the results are correctly rounded in all cases, however, in all but the rarest cases the digits except the last one can be trusted.

Here are some examples of using utrig:

>>> import jepler_udecimal.utrig
>>> from jepler_udecimal import Decimal
>>> Decimal('.7').atan()
Decimal('0.6107259643892086165437588765')
>>> Decimal('.1').acos()
Decimal('1.470628905633336822885798512')
>>> Decimal('-.1').asin()
Decimal('-0.1001674211615597963455231795')
>>> Decimal('.4').tan()
Decimal('0.4227932187381617619816354272')
>>> Decimal('.5').cos()
Decimal('0.8775825618903727161162815826')
>>> Decimal('.6').sin()
Decimal('0.5646424733950353572009454457')
>>> Decimal('1').asin()
Decimal('1.570796326794896619231321692')
>>> Decimal('-1').acos()
Decimal('3.141592653589793238462643383')

Module Contents

Functions

atan(x[, context])

Compute the arctangent of the specified value, in radians

sin(x[, context])

Compute the sine of the specified value, in radians

cos(x[, context])

Compute the cosine of the specified value, in radians

tan(x[, context])

Compute the tangent of the specified value, in radians

asin(x[, context])

Compute the arcsine of the specified value, in radians

acos(x[, context])

Compute the arccosine of the specified value, in radians

jepler_udecimal.utrig.atan(x, context=None)

Compute the arctangent of the specified value, in radians

jepler_udecimal.utrig.sin(x, context=None)

Compute the sine of the specified value, in radians

jepler_udecimal.utrig.cos(x, context=None)

Compute the cosine of the specified value, in radians

jepler_udecimal.utrig.tan(x, context=None)

Compute the tangent of the specified value, in radians

jepler_udecimal.utrig.asin(x, context=None)

Compute the arcsine of the specified value, in radians

jepler_udecimal.utrig.acos(x, context=None)

Compute the arccosine of the specified value, in radians