Skip to content

Commit

Permalink
Simplify reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
brdvd committed Jan 25, 2025
1 parent a9ad94e commit fde1cc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void Fraction::Reduce()
m_numerator = -m_numerator;
m_denominator = -m_denominator;
}
int gcdVal = std::gcd(abs(m_numerator), abs(m_denominator));
const int gcdVal = std::gcd(m_numerator, m_denominator);
if (gcdVal != 1) {
m_numerator /= gcdVal;
m_denominator /= gcdVal;
Expand Down

0 comments on commit fde1cc4

Please sign in to comment.