[Numpy-discussion] Number of digits
Robert Kern
robert.kern at gmail.com
Mon Jul 10 09:46:33 EDT 2006
Tim Hochberg wrote:
> Nils Wagner wrote:
>> Hi all,
>>
>> how can I increase the number of digits in the output of str(.) ?
>>
> You can't as far as I know. For floats, you can use "%.nf". For example:
>
> "%.13f" % 493.4802200544680
The problem is is that he doesn't have a float. He has one of our float64scalar
objects. The str() of a real Python float will give as many digits as are
necessary to recreate number and no more (or maybe one or two more). A str() of
a float64scalar will round according to some rule that I haven't figured out,
yet. It doesn't seem to be configurable with numpy.set_printoptions().
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion
mailing list