diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-01 02:42:47 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-01 02:59:44 +0100 |
commit | 6204ea17f16d7bcf94058e71877a6ce0266ee884 (patch) | |
tree | 85f57a6c91f7469be563dbfd670d4ce0ee823136 /libavutil/rational.c | |
parent | 841bf0ef240f0d862b1f07076e079829456fb117 (diff) | |
download | ffmpeg-6204ea17f16d7bcf94058e71877a6ce0266ee884.tar.gz |
rational: test add/sub too
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/rational.c')
-rw-r--r-- | libavutil/rational.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/rational.c b/libavutil/rational.c index 1a833ebec1..0fb855a46d 100644 --- a/libavutil/rational.c +++ b/libavutil/rational.c @@ -148,7 +148,7 @@ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list) #ifdef TEST int main(void) { - AVRational a,b; + AVRational a,b,r; for (a.num = -2; a.num <= 2; a.num++) { for (a.den = -2; a.den <= 2; a.den++) { for (b.num = -2; b.num <= 2; b.num++) { @@ -162,6 +162,9 @@ int main(void) if (c != d) av_log(0, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num, a.den, b.num, b.den, c,d); + r = av_sub_q(av_add_q(b,a), b); + if(b.den && (r.num*a.den != a.num*r.den || !r.num != !a.num || !r.den != !a.den)) + av_log(0, AV_LOG_ERROR, "%d/%d ", r.num, r.den); } } } |