Re: scale problem
- From: Chris Roadfeldt <chris roadfeldt com>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-devel-list gnome org
- Subject: Re: scale problem
- Date: 18 Feb 2002 16:09:53 -0600
[croadfeldt kenny Gemu-0.8]$ gtk-config --version
1.2.10
[croadfeldt kenny croadfeldt]$ more test.c
#include <glib.h>
#include <stdio.h>
void main ()
{
gfloat test = 2147483647;
printf("test: %f\n", test);
}
[croadfeldt kenny croadfeldt]$ ./test-gfloat
test: 2147483648.000000
Problem found? Can someone explain this?
After doing some creative math. I have been able to force all my scales
to have a range of 0-100, precision is not that critical, so this small
range is fine. After doing this, everything works fine. I consider the
matter closed.
Chris
On Mon, 2002-02-18 at 09:07, Owen Taylor wrote:
>
> Chris Roadfeldt <chris roadfeldt com> writes:
>
> > Hello all,
> >
> > I am having an annoying problem with a couple of scale widgets. The
> > code to create the scales is quite large, but it works. The core of the
> > problem is the scale allows a value 1 larger than the adjustment max.
> > The adjustment max I am setting is 2147483647, but when the scale is
> > moved to the max, it returns 2147483648 as the adjustment value. This
> > causes my app to do bad things. I can set the adjustment max to a lower
> > value, but this seems like a hack. I would rather fix the problem
> > itself. Does anyone have any ideas?
>
> If this is with GTK+-1.2, the problem you are running into is the
> limited precision of 'float' variables that store adjustment values.
> Your max value probably got rounded to the nearest representable value.
>
> Regards,
> Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]