Re: Posix(?) on numeric entry

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

 



antongiulio wrote:
[...]
gdouble value = 4.1;
gchar buffer[G_ASCII_DTOSTR_BUF_SIZE];

gtk_entry_set_text (GTK_ENTRY (value_entry), \
g_ascii_dtostr(buffer, G_ASCII_DTOSTR_BUF_SIZE, value));
but on output I got for value -> 4.0999999999999996


How can I "round" value? Or g_ascii_formatd(...) is more appropriate?
Yes, try smth like: g_formatd(buffer, sizeof(buffer), "%.1g", value).

	Olexiy

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux