[Bug 697715] floating point precision problem in check test gst/gstvalue

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Apr 11 00:53:39 PDT 2013


https://bugzilla.gnome.org/show_bug.cgi?id=697715
  GStreamer | gstreamer (core) | 1.x

--- Comment #4 from Alexander Schrab <alexas at axis.com> 2013-04-11 07:53:34 UTC ---
(In reply to comment #2)
> Your analysis about the floating point value is of course correct.
> 
> The relevant code should instead be doing something like this:
> 
> {
>   double x;
>   double xi;
>   int usec;
>   x = 10.000001;
> 
>   xi = floor(x);
>   usec = floor ((x-xi)*1000000);
>   if (xi + (usec + 1) * 0.000001 <= x) {
>     usec++;
>   }
> 
>   printf("usec %d\n", usec);
> 
>   return 0;
> }

Problem is that we use g_date_time_new on a gdouble. And in the case where you
provide the gdouble you have some control over it, but when it is derived from
a parsed caps string we have less control. The problem is in my mind that we
use date_time_new at all and expect usec precision.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list