[FFmpeg-devel] [PATCH] Implement the function cmdutils.c:parse_int_or_die
Rich Felker
dalias
Wed Feb 20 08:18:44 CET 2008
On Wed, Feb 20, 2008 at 02:01:36AM -0500, D. Hugh Redelmeier wrote:
> | From: Michael Niedermayer <michaelni at gmx.at>
>
> | 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.
>
> I'm not sure what you mean. Are you saying that
> x <= DBL_MAX
> is the same as
> x < DBL_MAX ?
> I don't think that that is true.
No, rather x<=DBL_MAX is the same as x<INFINITY
>
> | 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.
>
> I'm not sure what you mean.
He was simply saying that floating point numbers (excluding nan) are a
finite fully ordered set and thus any subset has a maximal element.
> It is likely that strtod("5") == strtod("4.9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999")
> This isn't guaranteed as far as I know.
Not sure about C99, but posix specifies that whenever the exact result
is not representable and at least DECIMAL_DIG digits are provided, the
result of strtod must be one of the two adjacent values, with the
stipulation that the sign of the error must agree with the current
rounding direction.
> Are you saying that it isn't easy to change a < to a <=? I agree.
No, he said that it's trivial to change them with floats, just like
with integers. a<b is the same as a<=nextafter(b,-INFINITY).
Rich
More information about the ffmpeg-devel
mailing list