Shower Thoughts

Office Checklist

History is written by the winners

A mystical incantation

C++ Libraries for Arbitrary Precision Rational Arithmetic

There are C++ libraries for arbitrary precision rational arithmetic, which allow you to perform calculations with rational numbers (fractions) of any size. Here are a few examples:

These libraries provide various features and trade-offs regarding performance, ease of use, and licensing. You can choose the one that best fits your project's requirements.

3. Available Operations for mpq_class
From examining the implementation, here are the commonly available operations:
Arithmetic operators:

+, -, *, / (binary and unary -)
+=, -=, *=, /=

Comparison operators:

==, !=, <, >, <=, >=

Member functions:

.get_num(), .get_den() - get numerator/denominator as mpz_class
.get_d() - convert to double
.canonicalize() - normalize the fraction (usually automatic)

Functions in :

abs(mpq_class)
sqrt(mpq_class) - returns mpf_class (floating-point)
cmp(mpq_class, mpq_class)