[FFmpeg-devel] [PATCH] avfilter/showcqt: BASEFREQ and ENDFREQ cast to double
Michael Niedermayer
michaelni at gmx.at
Mon Nov 30 18:51:36 CET 2015
On Mon, Nov 30, 2015 at 06:25:15PM +0100, Michael Niedermayer wrote:
> 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.
a few more related parts:
5 The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
<math.h> and <complex.h> that return floating-point results is implementation-
defined, as is the accuracy of the conversion between floating-point internal
representations and string representations performed by the library functions in
<stdio.h>, <stdlib.h>, and <wchar.h>. The implementation may state that the
accuracy is unknown.
6.4.4.2 Floating constants
7 The translation-time conversion of floating constants should match the execution-time
conversion of character strings by library functions, such as strtod, given matching
inputs suitable for both conversions, the same result format, and default execution-time
rounding.64)
>
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Republics decline into democracies and democracies degenerate into
> despotisms. -- Aristotle
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- 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/fc226614/attachment.sig>
More information about the ffmpeg-devel
mailing list