patch for bug: use double for Gtk Adjustment.set_value
Felix Ruess <[email protected]> Sun, 17 Aug 2014 20:45:06 +0200
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <CAEc+GFeN-1pus4AAbvPeREHMyOFUZydfd4y4+ow_4bY-rhnWXA@mail.gmail.com> |
--001a11c3856e2b6c5a0500d7a726 Content-Type: multipart/alternative; boundary=001a11c3856e2b6c560500d7a724 --001a11c3856e2b6c560500d7a724 Content-Type: text/plain; charset=UTF-8 Hi all, I found a problem when using sliders spin buttons and the like via gtk adjustment: Trying to set them to large values (that don't fit into a single precision float) to it results in a wrong valuing being displayed. The gtk functions actually use doubles, the problem is that gtk_adjustment_set_value uses Float_val instead of Double_val I quickly built a new package using the attached patch and it fixes the bug (although there might be a few more places where Float_val should actually be Double_val). Now it correctly displays values like 2467627534 that are otherwise displayed as 2467627520 since the conversion to float removes the lower nibble... Cheers, Felix --001a11c3856e2b6c560500d7a724 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi all,<div><br></div><div>I found a problem when using sl= iders spin buttons and the like via gtk adjustment:</div><div>Trying to set= them to large values (that don't fit into a single precision float) to= it results in a wrong valuing being displayed.</div> <div>The gtk functions actually use doubles, the problem is that=C2=A0gtk_a= djustment_set_value uses Float_val instead of Double_val</div><div><br></di= v><div>I quickly built a new package using the attached patch and it fixes = the bug (although there might be a few more places where Float_val should a= ctually be Double_val).</div> <div>Now it correctly displays values like=C2=A02467627534 that are otherwi= se displayed as=C2=A02467627520 since the conversion to float removes the l= ower nibble...</div><div><br></div><div>Cheers, Felix</div><div><br></div><= /div> --001a11c3856e2b6c560500d7a724-- --001a11c3856e2b6c5a0500d7a726 Content-Type: text/x-patch; charset=US-ASCII; name="02_adjustment_set_value_double.patch" Content-Disposition: attachment; filename="02_adjustment_set_value_double.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hyyq3oqc0 IyMgRGVzY3JpcHRpb246IHNldF92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Y29weV9kb3VibGUpCg== --001a11c3856e2b6c5a0500d7a726 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Lablgtk-list mailing list [email protected] https://lists.ocamlcore.org/cgi-bin/listinfo/lablgtk-list --001a11c3856e2b6c5a0500d7a726--