iam_agf
iam_agf

Reputation: 689

Get more decimals in complex python division

I'm using the division obtained from using

from __future__ import division

in Python 2.7, and I'm using the complex numbers in Python. I want to get more decimals from the division of complex numbers. Does exists a way to do this? I know the decimal.Decimal command, but it needs to receive the numbers before, and it doesn't get complex numbers.

Upvotes: 0

Views: 204

Answers (2)

casevh
casevh

Reputation: 11404

You should look at the gmpy2 library. It provides fast arbitrary precision integer, real, and complex arithmetic.

Upvotes: 2

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798754

The answer is still decimal.Decimal. But you'll need to use two of them per complex number, and you'll have to implement the math operations yourself. Fortunately there are plenty of references for the basic complex operations.

Upvotes: 0

Related Questions