gtk_spin_button_get_value_as_float is Broken



Why is the following necessary:

GtkSpinButton *spin;
gchar buf[32];
sprintf (buf, "%0.*f", spin->digits, gtk_spin_button_get_value_as_float (spin));

?

double john;
john = gtk_spin_button_get_value_as_float (spin);

will set john to either the displayed value or a value just a bit above or
below the displayed value, even if that value is explicitly typed into the
spinbutton in by the user (never mind the value displayed after a bit of
slewing).

I've never seen this bogus round-off problem explained.  Code examples like the
one involving spin->digits are cited without explanation.

John

-- 
John GOTTS <jgotts linuxsavvy com>  http://linuxsavvy.com/staff/jgotts




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]