GNOME Bugzilla – Bug 322837
Precision problems when storing doubles
Last modified: 2018-08-17 13:57:19 UTC
The following code fails, whereas I guess it ought to work: #include <gconf/gconf-client.h> int main (int argc, char **argv) { GConfClient *client; double a, b; a = 10.0 / 3.0; g_print ("a: %lf\n", a); client = gconf_client_get_default (); gconf_client_set_float (client, "/apps/test/float", a, NULL); b = gconf_client_get_float (client, "/apps/test/float", NULL); g_print ("b: %lf\n", b); g_assert (a == b); return 0; }
Testing with gconf_string_to_double() and gconf_double_to_string() there are no problems, so I'm guessing the problem is in orbit somewhere.
Note that this works fine using the DBus port of GConf.
Created attachment 55775 [details] [review] Patch: fixes the problem for me.
I don't think we can do that, though - it changes the CORBA interface incompatibly. i.e. we need to keep "1.4 lib <-> 2.14 daemon" and "2.12 lib <-> 2.14 daemon" and "2.14 lib <-> 2.12 daemon" etc. working I guess we could have a ConfigValue2, a ConfigListener2 and a ConfigDatabase4 where ConfigDatabase4 contains ConfigValue2 versions of all methods which use ConfigValue ... but that's a lot of work to fix this. Looks this just gets fixed with the switch to D-BUS.
GConf has been deprecated since 2011. GConf is not under active development anymore. Its codebase has been archived: https://gitlab.gnome.org/Archive/gconf/commits/master dconf and gsettings are its successors. See https://developer.gnome.org/gio/stable/ch34.html and https://developer.gnome.org/GSettings/ for porting info. Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Feel free to open a task in GNOME Gitlab if the issue described in this task still applies to a recent + supported version of dconf/gsettings. Thanks!