Add option to format float point output #190

cmmp opened this Issue Oct 27, 2010 · 1 comment


None yet
2 participants

cmmp commented Oct 27, 2010

Currently it is not possible to format how many digits of precision one wants to have in the output of IPython. For example, typing 1.0/3 returns 0.33333333333333331. In Octave, the same computation returns: ans = 0.33333. The set_printoptions function partially solves this:

In [4]: set_printoptions(precision=4)
In [5]: array([1.0/3])
Out[5]: array([ 0.3333])

However, it doesn't work for regular python floats. Matlab has this, Octave has this (format long/short). It would be very nice if IPython had it too.

This comment has been minimized.

Show comment Hide comment

minrk Feb 23, 2011


add %precision magic

closed by 637f887


minrk commented Feb 23, 2011

add %precision magic

closed by 637f887

markvoorhies pushed a commit to markvoorhies/ipython that referenced this issue Apr 21, 2011

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment