Re: Posix(?) on numeric entry
- From: Olexiy Avramchenko <olexiy ctech cn ua>
- To: antongiulio <antongiulio email it>
- Cc: gtk-list gnome org
- Subject: Re: Posix(?) on numeric entry
- Date: Tue, 15 Feb 2005 13:01:49 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]