GNU Multiprecision has a LibMPQ sublibrary implementing fractions, consisting of several mostly-trivial utilities around a struct holding a numerator & denominator as MPN & MPZ numbers. These utilities include:
* Swapping fields between 2 `mpq_ptr`s.
* Accessors for the 2 fields.
* Conversion from/to long pair (signed or not), MPF, double, string, or file. Most complex part.
* Copy from one MPQ to another.
* Swap numerator & denominator.
0/d is normalized to 0/1.
1/2!