[FFmpeg-devel] [PATCH] avfilter/showcqt: BASEFREQ and ENDFREQ cast to double

Michael Niedermayer michaelni at gmx.at
Mon Nov 30 18:25:15 CET 2015


On Mon, Nov 30, 2015 at 04:52:20PM +0100, Nicolas George wrote:
> Le decadi 10 frimaire, an CCXXIV, Muhammad Faiz a écrit :
> > -    if (s->basefreq != BASEFREQ || s->endfreq != ENDFREQ) {
> > +    if (s->basefreq != (double) BASEFREQ || s->endfreq != (double) ENDFREQ) {
> 
> Looks wrong to me. Since s->basefreq is double and operands are always
> converted to the largest type before comparison, the cast would be implicit.
> And BASEFREQ and ENDFREQ are double anyway.
> 
> The problem, if any, is somewhere else.

ISO/IEC 9899:TC3
    5.2.4.2.2 Characteristics of floating types <float.h>

    8 Except for assignment and cast (which remove all extra range and precision), the values
    of operations with floating operands and values subject to the usual arithmetic
    conversions and of floating constants are evaluated to a format whose range and precision
    may be greater than required by the type. The use of evaluation formats is characterized
    by the implementation-defined value of FLT_EVAL_METHOD:19)
        -1       indeterminable;
        0       evaluate all operations and constants just to the range and precision of the
                type;
        1       evaluate operations and constants of type float and double to the
                range and precision of the double type, evaluate long double
                operations and constants to the range and precision of the long double
                type;
        2       evaluate all operations and constants to the range and precision of the
                long double type.
    All other negative values for FLT_EVAL_METHOD characterize implementation-defined
    behavior.


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151130/a212ee40/attachment.sig>


More information about the ffmpeg-devel mailing list