def _float_precision_changed(self, name, old, new):
if '<STR_LIT:%>' in new:<EOL><INDENT>fmt = new<EOL>try:<EOL><INDENT>fmt%<NUM_LIT><EOL><DEDENT>except Exception:<EOL><INDENT>raise ValueError("<STR_LIT>"%new)<EOL><DEDENT><DEDENT>elif new:<EOL><INDENT>try:<EOL><INDENT>i = int(new)<EOL>assert i >= <NUM_LIT:0><EOL><DEDENT>except ValueError:<EOL><INDENT>raise ValueError("<STR_LIT>"%new)<EOL><DEDENT>except AssertionError:<EOL><INDENT>raise ValueError("<STR_LIT>"%i)<EOL><DEDENT>fmt = '<STR_LIT>'%i<EOL>if '<STR_LIT>' in sys.modules:<EOL><INDENT>import numpy<EOL>numpy.set_printoptions(precision=i)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>fmt = '<STR_LIT>'<EOL>if '<STR_LIT>' in sys.modules:<EOL><INDENT>import numpy<EOL>numpy.set_printoptions(precision=<NUM_LIT:8>)<EOL><DEDENT><DEDENT>self.float_format = fmt<EOL>
float_precision changed, set float_format accordingly.

        float_precision can be set by int or str.
        This will set float_format, after interpreting input.
        If numpy has been imported, numpy print precision will also be set.

        integer `n` sets format to '%.nf', otherwise, format set directly.

        An empty string returns to defaults (repr for float, 8 for numpy).

        This parameter can be set via the '%precision' magic.