This is a development version (9.14.0.dev) and may be unstable. Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.14.0.dev / IPython / core / magics / basic / BasicMagics / precision

function

IPython.core.magics.basic:BasicMagics.precision

source: /IPython/core/magics/basic.py :510

Signature

def   precision ( self s = '' )

Summary

Set floating point precision for pretty printing.

Extended Summary

Can set either integer precision or a format string.

If numpy has been imported and precision is an int, numpy display precision will also be set, via numpy.set_printoptions.

If no argument is given, defaults will be restored.

Examples

:: In [1]: from math import pi In [2]: %precision 3 Out[2]: '%.3f' In [3]: pi Out[3]: 3.142 In [4]: %precision %i Out[4]: '%i' In [5]: pi Out[5]: 3 In [6]: %precision %e Out[6]: '%e' In [7]: pi**10 Out[7]: 9.364805e+04 In [8]: %precision Out[8]: '%r' In [9]: pi**10 Out[9]: 93648.047476082982

Aliases

  • IPython.core.magics.BasicMagics.precision