diff options
| author | Julian Weigt <juw@posteo.de> | 2026-01-15 21:17:07 +0100 |
|---|---|---|
| committer | Julian Weigt <juw@posteo.de> | 2026-02-04 15:55:52 +0100 |
| commit | d78cc5836306c3231bb958bffe88ce54c898b512 (patch) | |
| tree | d26da095166ce52ebda1cb59966c84b9d03b1200 /ratio.c | |
| parent | 8e5bf1e894d36ee939653da7bf029f7a10f002d6 (diff) | |
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.
Diffstat (limited to 'ratio.c')
| -rw-r--r-- | ratio.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; } |
