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

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Apr 10 16:59:56 PDT 2013


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

David Schleef <ds> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1

--- Comment #2 from David Schleef <ds at schleef.org> 2013-04-10 23:59:51 UTC ---
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;
}

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