From d78cc5836306c3231bb958bffe88ce54c898b512 Mon Sep 17 00:00:00 2001 From: Julian Weigt Date: Thu, 15 Jan 2026 21:17:07 +0100 Subject: Introduce is_greater_certainly and is_greater_possibly to make more robust the printing and finding of records. Start reorganizing to allow eventual printing of all records. --- ratio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ratio.c') diff --git a/ratio.c b/ratio.c index e23aabd..747aeab 100644 --- a/ratio.c +++ b/ratio.c @@ -85,13 +85,17 @@ rational difference(rational r1, rational r2){ return sum(r1,r2); } -bool is_greater(rational r1, rational r2){ +bool is_greater_certainly(rational r1, rational r2){ rational diff = difference(r1,r2); return !diff.s && diff.n > 0; } +bool is_greater_possibly(rational r1, rational r2){ + return is_greater_certainly(r1,r2); +} + rational maximum(rational r1, rational r2){ - if(is_greater(r1,r2)) return r1; + if(is_greater_certainly(r1,r2)) return r1; else return r2; } -- cgit v1.2.3