Opened 2 years ago

Closed 2 years ago

#9595 closed defect (invalid)

av_add_q(0/-1, -1/0) returns 1/0

Reported by: namniav Owned by:
Priority: normal Component: avutil
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by namniav)

Summary of the bug:

https://ffmpeg.org/doxygen/4.1/rational_8c_source.html#l00093

av_add_q(0/-1, -1/0) incorrectly returns 1/0.
Adding 0 to -inf should be -inf, not inf.

More generally, av_add_q(x/-1, -1/0) should return -inf, not inf.

Change History (2)

comment:1 by namniav, 2 years ago

Description: modified (diff)
Summary: av_add_q(1/-1, -1/0) returns 1/0av_add_q(0/-1, -1/0) returns 1/0

comment:2 by Cigaes, 2 years ago

Resolution: invalid
Status: newclosed
  1. The doc says Add two rationals., neither +∞ nor -∞ are rationals.
  1. Anyway, integer 0 does not have a sign, so -1/0 is the same as -1/-0, i.e. 1/0.
Note: See TracTickets for help on using tickets.