[FFmpeg-devel] [PATCH] djgpp port
Michael Niedermayer
michaelni
Wed Dec 26 19:12:16 CET 2007
On Wed, Dec 26, 2007 at 08:29:14PM +0300, Michael Kostylev wrote:
>
> At Wed, Dec 26 2007 04:38:29 CET +0100,
> Michael Niedermayer wrote:
>
> >> +#ifndef HAVE_ROUND
> >> +static av_always_inline double round(double x)
> >> +{
> >> + return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
> >> +}
> >> +#endif /* HAVE_ROUND */
> > iam ok with this, though if i were picky i could complain that
> > your round implementation fails for 0.49999999999999994449 amongth others
> > but i guess its good enough. Fixing that would make it slower and
> > uglier with no real advantage ...
>
> IIRC the glibc round has the same behavior inside the __DBL_EPSILON__ neighborhood of x.5.
not here, just try:
#define _ISOC99_SOURCE
#include <math.h>
#include <stdio.h>
main(){
printf("%f %f\n", round(0.49999999999999994449), floor(0.49999999999999994449 + 0.5));
printf("%f %f\n", round(4503599627370497.0), floor(4503599627370497.0 + 0.5));
}
> In addition you could complain that my fake round uses uncommon rounding mode.
not sure what you mean ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I count him braver who overcomes his desires than him who conquers his
enemies for the hardest victory is over self. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071226/82ef3f0f/attachment.pgp>
More information about the ffmpeg-devel
mailing list