[FFmpeg-devel] [PATCH v1] filter select - avoid 2 times rounding
Nicolas George
george at nsup.org
Fri Jul 19 21:01:04 EEST 2019
Ulf Zibis (12019-07-19):
> May be, but I believe single rounding over twice rounding is less fragile.
Yes. And two plastic bags will slow your fall more than one when you
jump from a plane.
> Try this:
> printf("single rounding: %.40f\n", 130560LL * 1 / (double)12800);
> printf("twice rounding: %.40f\n", 130560LL * (double)(1 /
> (double)12800));
> Result:
> single rounding: 10.1999999999999992894572642398998141288757
> twice rounding: 10.2000000000000010658141036401502788066864
> The 1st result is closer to 10.2 as the 2nd.
By a completely negligible difference. And that is assuming it would
hold for other values of 10.2, which I am not convinced.
You are wasting your time and making the code less readable for no
actual benefit.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190719/f9683bf1/attachment.sig>
More information about the ffmpeg-devel
mailing list