Re: [Fwd: Re: slider]

From: Tim Gimmel <tjg_at_gimmel.org>
Date: Fri, 02 Jan 2009 17:01:39 -0600
To: Dmitry Karasik <dmitry_at_karasik.eu.org>

On Fri, 2009-01-02 at 22:21 +0100, Dmitry Karasik wrote:
> > Your previous email showed the problem with floats that I am unaware of,
> > adding 00001 did fix the problem. Can you explain the "classic trouble"
> > you were referring to? I am still having trouble with the slider delta;
> > I am using numbers very small (.000xxx) and comparisons like ($x > $y)
> > are giving erroneous answers. For ex. .00047 > .00048 turns out to be
> > true(!) and the difference is .0004699952!! Any suggestions would be
> > appreciated.
>
> 00047 > .00048 is something of an extreme, I've never seen that. But the
> classic problem is basically that a float number is rarely same as declared
> in the source, because the way ieee64 floats are stored in memory (that means
> that the effect is wider than in perl, its valid practically for all
> languages). For example, 5.0 can easily be something like 4.9999999994, and
> thus cycles like "for i = 1.0, i <= 5.0, i++" can run 4 cycles instead of 5.
> This is exactly what has happened to your code, when max(), and thus the text
> label allocation routine, did a wrong number of iterations. It's not a problem
> in Prima::Slider, nor it is the problem with your code, it's just the way float

Thanks Dmitry,
 I did however find a multiplication error in my code that made the
problem appear worse that it was. Now I am running things through
sprintf. I currently fighting with onChange and onTrack. I am having
trouble with fine changes. If I click to the right (or left) of the
slider it will increment "step" units, but if I hold the mouse button
down it may only increment 1 step. I thought the behavior if autoTrack
= 0 would be onTrack fires during a 'slide' and onChange fires on a
finite change. Does any of this sound correct?

BTW, I get this message when starting VB since the update:

Useless use of unshift with no values
at /usr/local/lib/perl/5.8.8/Prima/Sliders.pm line 1158.

Tim

> numbers are handled, which should be kept in mind.
>
Received on Fri 02 Jan 2009 - 23:58:37 CET

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:06 CET