boostorg / multiprecision

Boost.Multiprecision
Boost Software License 1.0
188 stars 112 forks source link

[Question] Simplifying a rational #610

Closed sloriot closed 4 months ago

sloriot commented 4 months ago

Hi,

Is there a built-in method to simplify a rational? Calling gcd and doing the division of the numerator and denominator is possible but while computing the gcd we should already have the simplified rational.

Thanks.

jzmaddock commented 4 months ago

The short answer is no, but I'm not quite sure what you're asking - for the ratio of two integers, the Euclid GCD algorithm doesn't compute the reduced terms just the common divisor.