# types – Double precision floating values in Python?

## types – Double precision floating values in Python?

Pythons built-in `float`

type has double precision (its a C `double`

in CPython, a Java `double`

in Jython). If you need more precision, get NumPy and use its `numpy.float128`

.

- Unlike hardware based binary floating point, the decimal module has a user alterable precision (defaulting to 28 places) which can be as large as needed for a given problem.

If you are pressed by performance issuses, have a look at GMPY

#### types – Double precision floating values in Python?

For some applications you can use `Fraction`

instead of floating-point numbers.

```
>>> from fractions import Fraction
>>> Fraction(1, 3**54)
Fraction(1, 58149737003040059690390169)
```

(For other applications, theres `decimal`

, as suggested out by the other responses.)