[Numpy-discussion] Array printing and another question
Tue Apr 8 10:22:33 CDT 2008
Thanks, but it's been my experience that formatting FP numbers into
decimal causes a lot of false alarms
all by itself; that is, you get different decimal representations of the
same FP memory value. I've had this happen
often enough that I found the first thing I did when an output
difference arose was to print the FP in hex to see if the
difference was "real" or just a formatting artifact. This formatting
function is designed to do that all the time, while
providing enough clarity to examine values. Here are a couple examples:
>>> pi = 3.14159
'-(+0008)0x3a28b43958106' # Note that the exponent is a decimal
value with a base of 2, so "8" is 256.
These strings can also be converted back to FP with absolute accuracy,
which is almost impossible to guarantee
with decimal representations, in my experience.
Alan G Isaac wrote:
> Will set_printoptions not work for you?
> Alan Isaac
> Numpy-discussion mailing list
More information about the Numpy-discussion