Re: Strange double value in gtk_entry

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

 




On Tue, 16 Mar 2004 francex@xxxxxxxxxx wrote:

> 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);

instead of these two lines, try: 

    buffer = g_strdup_printf("%3f", val1);

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


regards

Vincent TORRI

> 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/
> 
> 
> 
> _______________________________________________
> 
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 
> 

_______________________________________________

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