I am working on some matrix problems and I’d really like the matrix outputs in the shell to look readable so I can see if the elements in it are correct. Currently I get stuff in scientific notation like 123.4345362e-102 and entire matrices of this are really distracting. Ideally, I’d like small enough numbers to round down to 0 and the rest to be decimals up to 4 places.
I did this before, too, but I can’t remember how to do it! It was something similar to Decimal’s getcontext().prec=3, where I set it in my code at the very top and all my output looked a certain way. It was very convenient!
From Python Doc :