[FFmpeg-devel] [PATCH] eval: add bitor and bitand functions

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Mar 14 22:16:39 CET 2013


On Thu, Mar 14, 2013 at 09:34:40PM +0100, Stefano Sabatini wrote:
> On date Wednesday 2013-03-13 22:51:02 +0100, Michael Niedermayer encoded:
> > On Wed, Mar 13, 2013 at 10:36:45PM +0100, Stefano Sabatini wrote:
> > > TODO: bump micro
> > > ---
> > >  doc/eval.texi       |    8 ++++++++
> > >  libavutil/eval.c    |    9 ++++++++-
> > >  tests/ref/fate/eval |    9 +++++++++
> > >  3 files changed, 25 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/doc/eval.texi b/doc/eval.texi
> > > index 3b7964c..1dca2da 100644
> > > --- a/doc/eval.texi
> > > +++ b/doc/eval.texi
> > > @@ -32,6 +32,14 @@ Compute arcsine of @var{x}.
> > >  @item atan(x)
> > >  Compute arctangent of @var{x}.
> > >  
> > > + at item bitand(x, y)
> > > + at item bitor(x, y)
> > > +Compute bitwise and/or operation on @var{x} and @var{y}.
> > > +
> > > + at var{x} and @var{y} are converted to integers before executing the
> > > +operation. Operation result is undefined if the integer representation
> > > +of @var{x} or @var{y} takes more than 64 bits.
> > 
> > double precission floats do not have 64 bit mantissas so this will
> > fail with many 64bit values
> 
> Updated with this commented removed. I assume the reader realizes
> that the conversion is potentially lossy.

That is assuming a bit much I think, maybe it would be better to add
something like:
Note that both the conversion to integer and the conversion back to
floating point can lose precision. Beware of unexpected results for large numbers
(usually 2^53 and larger).


More information about the ffmpeg-devel mailing list