[SciPy-user] nice floating point display ?
Fri Feb 29 12:51:23 CST 2008
Robert Kern wrote:
> 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.
I didn't know that, but it sounds very plausible after all ;-)
> You can explicitly format the numbers yourself:
> In : x = 1.2345678901
> In : '%f' % x
> Out: '1.234568'
Yes that's part of the answer ( I already knew),
but the rest of the problem looks more complicated to me,
(whether I have a range of 1..1000 or 0.0000004 ...0.00000041 etc)
and I think a number of people has already solved this part of the
problem (like in MatPlotlib).
For now I'm going to for a very simple solution,
let the user specify the format ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user