Strange double value in gtk_entry



Hi,

I have a "curious" problem with glib/gtk:

in app I have defined:

double val1 = 8,324670e-01;
double val2 2,106000e-01;

and they are insert into gtkentry with (for val1 - same thing for val2):

  buffer = g_malloc (G_ASCII_DTOSTR_BUF_SIZE);

  buffer = g_ascii_dtostr (&buffer[0], G_ASCII_DTOSTR_BUF_SIZE, val1);

  val1_entry = gtk_entry_new ();
  gtk_entry_set_text (GTK_ENTRY (val1_entry), buffer);
  gtk_widget_show (val1_entry);

value showed in val1_entry is:
0.83246699999999996

for val2:
0.21060000000000001

why???

Is it possible get 'clean' values in gtk_entry
(0.2106 or 2.106e-01 not 0.21060000000000001)?

Thanks,
France

__________________________________________________________________
ADSL Senza Canone 640Kbps:
attivala entro il 31 marzo e avrai GRATIS il costo di adesione,
quello di attivazione e il modem per tutto il 2004.
E per i primi 3 mesi navighi a 1,5 euro l'ora! Affrettati!
http://point.tiscali.it/adsl/prodotti/senzacanone/






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