[FFmpeg-user] Problem with signbit()

Moritz Barsnick barsnick at gmx.net
Thu Jul 18 10:24:56 EEST 2019


On Thu, Jul 18, 2019 at 01:41:02 +0200, Ulf Zibis wrote:
> Given this code snippet:
>     float a = 0.0F;
>     float b = -0.0F;
>     printf("a: %f, signbit(a): %d\n", a, signbit(a));
>     printf("b: %f, signbit(b): %d\n", b, signbit(b));
> Result:
>     a: 0.000000, signbit(a): 0
>     b: -0.000000, signbit(b): 0
> I would expect:
>     a: 0.000000, signbit(a): 0
>     b: -0.000000, signbit(b): <something not 0>
> ... according to: http://man7.org/linux/man-pages/man3/signbit.3.html
>
> Are there some flags in the your build script which cause this problem?

Obviously "-fno-signed-zeros".

Committed here with an explanation:
https://github.com/FFmpeg/FFmpeg/commit/b2eb2ff098b

It doesn't have an effect with all compilers, apparently. Not sure if
that's important.

Are you developing something use the libav* libraries? Or are you
developing something for inclusion within ffmpeg? At least in the
former case, I recommend the "libav-user" mailing list.

Cheers,
Moritz


More information about the ffmpeg-user mailing list