无限小数转分数修复1

master
IoTcat 5 years ago
parent a058b918d2
commit 33ad0332af
  1. 10
      as1/Fraction.h
  2. BIN
      as1/a.exe

@ -573,11 +573,11 @@ void Fraction::repeated_decimal_to_fraction(double d)
unsigned int repeat = get_repeat_part(t);
//cout << repeat << endl;
cout << repeat << endl;
confirm_repeat_part(t, repeat, start);
//cout << repeat << endl;
cout << repeat << endl;
for(int i = 0; i < get_long_int_length(repeat); i++){
@ -586,13 +586,13 @@ void Fraction::repeated_decimal_to_fraction(double d)
down *= (unsigned int)pow(10, (get_long_int_length(t) - start));
//cout << down << endl;
cout << down << endl;
up = t % (unsigned int)pow(10, get_long_int_length(repeat));
up = t % (unsigned int)pow(10, get_long_int_length(repeat)) + (t / (unsigned int)pow(10, start)) * ((unsigned int)pow(10, get_long_int_length(repeat)) - 1);
up = up + get_double_integer_part(d) * down;
//cout << up << endl;
cout << up << endl;
_top = up;
_bottom = down;
}

Binary file not shown.
Loading…
Cancel
Save