int ReducedFraction::ticks() const
      {
      int integral = numerator_ / denominator_;
      int newNumerator = numerator_ % denominator_;
      int division = MScore::division * 4;

      Q_ASSERT_X(!isMultiplicationOverflow(newNumerator, division),
                 "ReducedFraction::ticks", "Multiplication overflow");
      Q_ASSERT_X(!isAdditionOverflow(newNumerator * division, denominator_ / 2),
                 "ReducedFraction::ticks", "Addition overflow");

      const int tmp = newNumerator * division + denominator_ / 2;

      Q_ASSERT_X(!isDivisionOverflow(tmp, denominator_),
                 "ReducedFraction::ticks", "Division overflow");
      Q_ASSERT_X(!isMultiplicationOverflow(integral, division),
                 "ReducedFraction::ticks", "Multiplication overflow");
      Q_ASSERT_X(!isAdditionOverflow(tmp / denominator_, integral * division),
                 "ReducedFraction::ticks", "Addition overflow");

      return tmp / denominator_ + integral * division;
      }
int fractionPart(int lcmPart, int numerator, int denominator)
      {

      Q_ASSERT_X(!isDivisionOverflow(lcmPart, denominator),
                 "ReducedFraction::fractionPart", "Division overflow");

      const int part = lcmPart / denominator;

      Q_ASSERT_X(!isMultiplicationOverflow(numerator, part),
                 "ReducedFraction::fractionPart", "Multiplication overflow");

      return numerator * part;
      }
ReducedFraction toMuseScoreTicks(int tick, int oldDivision)
      {

      Q_ASSERT_X(!isMultiplicationOverflow(tick, MScore::division),
                 "ReducedFraction::toMuseScoreTicks", "Multiplication overflow");
      Q_ASSERT_X(!isAdditionOverflow(tick * MScore::division, oldDivision / 2),
                 "ReducedFraction::toMuseScoreTicks", "Addition overflow");

      const int tmp = tick * MScore::division + oldDivision / 2;

      Q_ASSERT_X(!isDivisionOverflow(tmp, oldDivision),
                 "ReducedFraction::toMuseScoreTicks", "Division overflow");

      return ReducedFraction::fromTicks(tmp / oldDivision);
      }