[FFmpeg-devel] [PATCH] Implement the function cmdutils.c:parse_int_or_die

Michael Niedermayer michaelni
Tue Feb 19 17:45:50 CET 2008


Hi

On Tue, Feb 19, 2008 at 01:07:21PM +0100, Stefano Sabatini wrote:
[...]
> > I have NOT looked at the codebase that these patches are intended for.
> > How frequently will parse_double_or_die be called with interesting
> > bounds (i.e. other than [-INFINITY, INFINITY])?  My hunch is that it
> > would be uncommon (based on no data!).  I know that the range check
> > makes sense for integers but it might not for floats.
> 
> I have no strong opinion on this, but from a purely mathematically
> point of view if we're saying that a double may be e.g. say <= inf
> then we should accept also the inf value, so I think the function
> shouldn't exit if the value is "inf", and we could have a variable
> which for some strange reason accept the inf or -inf value.

yes


> 
> Eventually we could add a flag to tell parse_double_or_die() to accept
> only finite values; another idea could be to have a flag for
> inclusivity/exclusivity in the range check.

If you dont want infinty, use DBL_MAX as limit.
Inclusivity/exclusivity distinction doesnt make sense in a finite set. Which
any practical implementation uses.
That is while in math you cant neccessarily change a
x<5 to a x<=C (4.999... = 5) that problem cannot occur with floats or doubles.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- 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/20080219/411fb372/attachment.pgp>



More information about the ffmpeg-devel mailing list