

Cool! Another thing I discovered is that 1/n CANNOT have more than n-1 digits in its decmial (can anyone prove this?) And for 1/(7^n), the decimal expansion has exactly 6*(7^(n-1)) digits. Any fraction of the form 1/(9^n) is exactly 9^(n-1) digits long! So 1/59049 has exactly 6561 digits before repeating. I have found a lot of really cool things with this program. When you divide that by 7, you get 142857, so thus, 1/7 is equal to 0.142857 with all digits after the 0.

So for 1/7, you keep looking through strings of 9s until you get 999999, which is divisible by 7. What the program does is it finds a long string of 9s that is divisible by n. So far, my program works only for numbers that end in 1, 3, 7, or 9 (n cannot divide 2 or 5, since those numbers divide 10, our numeral base).
#Converting repeating decimals to fractions calculator code
Click setup gear to set your 'Bump to Nearest' value.I have been struggling for a while to try to code a program to convert any fraction 1/n to a repeating decimal.'Bump to Nearest' Decimal = 0.1, 0.01, 0.001, 0.0001 or Fraction = 1/4, 1/8, 1/16, 1/32, 1/64 and 1/128 or enter your own Custom Fraction Denominator from 1/2 to 1/10000 by clicking left or right halves of the inch style number line.For both negative (increase left) and positive (increase right) input. Displays an imperial inch or centimeter style number line (not actual size) that updates itself as you input your values (either decimal or fraction).Repeating decimals are displayed as green decimal numbers when active. Capable of inputting repeating decimals.Title Bar configurable to display total length and the repeating decimals starting position.Converting fraction to decimal displays last 3 decimal of returned value after an ellipse on decimal values of up to 12M in length.History list saves the last 50 calculationsĬonvert a decimal to fraction or fraction to decimal:.Hold (Long click) the list button to clear the "Saved" or "History" list of all values.If input has an answer, select the list button to "Save".Select the list button to fill the equation (after operator) with either "Saved" or "History" answer values.Convert answer between inch and centimeter by long clicking the in/cm base unit button in the upper left calculator row.Display your entered fraction, decimal or answer to the measurement screen by clicking the "=" button.


Long click in/cm unit button to switch between base units.Then paste into a google search to compare / confirm answers. Copy equation: Long click the equation.Click on the equation again to return to normal entry mode. Operator edit: Click operator you want to edit, click orange delete button, enter new operator.Then click the equation again to return to normal entry mode. Edit equation by clicking the term you want to edit.Units of measure include yd, ft, in, m, cm, mm.Begin repeating decimals entry by clicking the Ṝ button. Easy fraction entry: Blue buttons for whole numbers and Green buttons for numerator over denominators.Works with fractions, decimals and repeating decimals in the order of operations.
