I'm curious, how?
As 1/3 - exactly as it's on your screen. All rational numbers can be represented exactly.
Sure, there are times when space or speed concerns favor inexact representation over correctness, but that's an optimization that ought to be properly evaluated; the fact that lots of languages are designed in a way which makes it the default everyone reaches for contributes to lots of errors.
struct rational {
int numerator;
int denominator;
};Is possible to convert to rationals in calculations?
So if I do:
1/3 + 4 + sum / total it record values properly?