Re: Is gtk_spin_button_get_value_as_float() broken?



jgotts linuxsavvy com writes: 
> Why does gtk_spin_button_get_value_as_float() sometimes return an inexact
> value?  There are two cases where it does this, (1) being the most severe:
> 
> 1) The user types in a number like 3.21.  gtk_spin_button_get_value_as_float()
> returns 3.20999 or 3.21002.
>

Because floats are fairly inexact. In GTK 2 it's been changed to
double.
 
> 1) The exact keyed in value or the visible value if the arrows were used, or
> 2) Only the visible value no matter how it got there.

You could use the fact that spin button is a GtkEntry, and maybe parse
its contents with strtod().

Havoc




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