[Ffmpeg-devel] [PATCH] Redefine NAN in eval.c

Måns Rullgård mru
Sat Sep 23 20:34:02 CEST 2006


Rich Felker <dalias at aerifal.cx> writes:

> On Sat, Sep 23, 2006 at 05:33:07PM +0100, M?ns Rullg?rd wrote:
>> Rich Felker <dalias at aerifal.cx> writes:
>> 
>> > On Sat, Sep 23, 2006 at 02:13:14AM +0200, Michael Niedermayer wrote:
>> >> Hi
>> >> 
>> >> On Fri, Sep 22, 2006 at 11:35:36PM +0200, Panagiotis Issaris wrote:
>> >> > Hi,
>> >> > 
>> >> > In the process of modifying the AVOptions code to use eval.c I noticed
>> >> > that I could not report a failed parsing, as ff_eval returned 0 not NAN.
>> >> > The attached patch, defines NAN -if not already defined as f.e. in C99-
>> >> > to be sqrt(-1) in the scope of eval.c. Regression tests succeed.
>> >> 
>> >> iam fine with 0.0/0.0
>> >
>> > 0.0/0.0 is correct. sqrt(-1) is not a constant and thus it's nonsense.
>> > Also you can define a non-exception-raising NAN using unions; this
>> > might be preferable but it requires C99 and IEEE float.
>> 
>> C99 already requires NAN to be defined.
>
> IIRC it's only required if NAN makes sense/if the host implements IEEE
> float. ISO C is very lax about floating point requirements unless your
> implementation claims conformance to additional standards. However I
> may be mistaken on this one.

>From C99, section 7.12 Mathematics <math.h>:
  The macro
       NAN
  is defined if and only if the implementation supports quiet NaNs for
  the float type. It expands to a constant expression of type float
  representing a quiet NaN.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list