MineralsCloud / qha

A Python package for calculating thermodynamic properties under quasi-harmonic approximation, using data from ab-initio calculations
https://mineralscloud.github.io/qha/
GNU General Public License v3.0
27 stars 13 forks source link

`mpmath.workprec` and `bigfloat.precision` #73

Open singularitti opened 5 years ago

singularitti commented 5 years ago

I just found that what we used before, i.e., bigfloat.precision(self.precision), equivalent to bigfloat.Context(precision=self.precision), is

Precision of the floating-point format, given in bits.

To keep the modified code functioning as the old code, I also use mpmath.workprec(self.precision), also in bits. However, mpmath does provide mpmath.workdps, using decimal precision.

In general, the number of bits can be converted to decimal digits by multiplying it by ln(2)/ln(10) ~= 0.3. I think we should notice the users in doc, to let them know what precision we are using.