Q struct

the field $\mathbb{Q}$ of rational numbers

Constructors, destructors, conversion operators

Q(int_coeff p)
constructor from integers
Q(int_coeff p, int_coeff q)
standard constructor

Public functions

auto reduce() -> Q
divide numerator and denominator by their gcd

Public variables

int_coeff p
numerator
int_coeff q
denominator