[FFmpeg-cvslog] mathematics: Don't use division by zero in NAN/INFINITY macros
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Mon Jul 2 07:58:31 CEST 2012
On 2 Jul 2012, at 07:41, Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
> On 1 Jul 2012, at 22:48, git at videolan.org (Ronald S. Bultje) wrote:
>
>> ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Jun 22 13:05:21 2012 +0300| [a1245d5ca1bed154a3bf38843b63018ae3544115] | committer: Martin Storsjö
>>
>> mathematics: Don't use division by zero in NAN/INFINITY macros
>>
>> Some compilers, MSVC among them, don't recognize the divisions by
>> zero as meaning infinity/nan.
>>
>> These macros should, according to the standard, expand to constant
>> expressions, but this shouldn't matter for our usage.
>
> mathematics.h to my knowledge is an installed header, IMHO this is an API change and changes should not be made looking only at what FFmpeg needs.
> Also at least for INF I believe the correct way is to define it to _HUGE_VAL for MSVC.
In addition, it seems that DBL_MAX + DBL_MAX (that one seems a bit risky, so _HUGE_VAL migh be better) and INFINITY-INFINITY (that one probably can be used risk-free on Linux, too) work to generate those two values at compiletime constants at least with MSVC.
More information about the ffmpeg-cvslog
mailing list