After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 118959 - GtkScale value '-0'
GtkScale value '-0'
Product: gtk+
Classification: Platform
Component: Widget: GtkRange
Other Linux
: Low minor
: Small fix
Assigned To: gtk-bugs
: 139858 (view as bug list)
Depends on:
Reported: 2003-08-02 23:50 UTC by Jonas
Modified: 2016-06-08 03:07 UTC
See Also:
GNOME target: ---
GNOME version: ---

Description Jonas 2003-08-02 23:50:31 UTC
If you have a hscale which has the range -100 to 100 (any neagtive to any
positive), then the value next to the scale is -0, when you move from the
right (negative) to the left. If you move the other way (from positive to
negative), then the value is 0.

It would be nice, if it didn't show that minus-sign in front of the zero.
Comment 1 Owen Taylor 2003-08-04 15:12:57 UTC
I think the best thing to do is probably to simply
in _gtk_scale_format_value() check whether the outut
of g_strdup_printf("%0.*f") has a leading - sign
and no digits other than 0, and if so, strip the 
leading - sign. (g_ascii_digit_value() probably
useful in the implementation)

Trying to avoid small negative values before formatting
is going to be less reliable and harder to implement.
Comment 2 Owen Taylor 2004-04-16 18:55:41 UTC
Same issue for GtkSpinbutton in bug 139858
Comment 3 Owen Taylor 2004-04-16 18:56:07 UTC
*** Bug 139858 has been marked as a duplicate of this bug. ***
Comment 4 Elijah Newren 2004-06-19 18:44:45 UTC
Mass changing gtk+ bugs with target milestone of 2.4.2 to target 2.4.4, as
Matthias said he was trying to do himself on IRC and was asking for help with. 
If you see this message, it means I was successful at fixing the borken-ness in
bugzilla :)  Sorry for the spam; just query on this message and delete all
emails you get with this message, since there will probably be a lot.
Comment 5 Mariano Suárez-Alvarez 2006-09-05 18:45:36 UTC
I don't seem to be able to reproduce this with HEAD. Maybe ITFIXEDITSELF?
Comment 6 Björn Lindqvist 2008-03-28 17:00:09 UTC
The core of the problem seem to be g_strdup_printf() which GtkScale uses in _gtk_scale_format_value. E.g:

  gchar *s = g_strdup_printf ("%0.*f", 5, -0.0);

will create the string "-0.00000" on my machine. But the output is very much hardware and C library dependant, on Windows it is very likely to come out as "0.00000" without the minus sign. IEEE 754 defines negative zero as a valid number distinct from 0, but it isn't implemented like that on many platforms. 

So I think the bug is in g_strdup_printf() that should string format negative zeroes as a normal, positive ones instead. Negative zeroes aren't very useful anyway and since they are platform dependant, we might as well skip them.