New answers tagged

3

Neither double nor long double are suitable for expressing fractional numbers. They are for floating point numbers, not fractional numbers. You should use a fractional number data type, something like this: struct fraction { intmax_t numerator; uintmax_t denominator; }; Instead of intmax_t / uintmax_t, you should probably use an arbitrary sized ...


Top 50 recent answers are included