[SciPy-user] nice floating point display ?
Thu Feb 28 18:07:04 CST 2008
On Thu, Feb 28, 2008 at 5:43 PM, Stef Mientki <email@example.com> wrote:
> I'm creating an float / log slider,
> now I need a nice representation of the min / max / value
> of the slider.
> For some unknown reason
> doesn't work,
> and I doubt if it is adequate in my application,
> because precision and notation depends more on the range
> than on the actual value itself.
> Does anyone has a elegant solution ?
set_printoptions() doesn't affect Python floats at all, and that looks
like what you are trying to print.
You can explicitly format the numbers yourself:
In : x = 1.2345678901
In : '%f' % x
In : '%g' % x
In : '%1.2f' % x
In : '%1.10f' % x
In : '%f' % (x*1e20)
In : '%g' % (x*1e20)
In : '%e' % x
In : '%.*f' % (3, x)
"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 SciPy-user