Quote notation[1] is a way of expressing rational integers in a precise, finite manner, based on the concept of \$p\$-adic numbers. The notation is in the form of a string of digits (\$0123456789\$) containing exactly one "quote" (a \$\newcommand{'}[2]{#1\text{'}#2} \text{'}\:\$) and one "radix point" (a \$.\:\$). Like with standard decimal notation, if the radix point is at the right end of the string, it is omitted. Some examples of quote notation:
$$\begin{array} & \' {123} {456} & \' {123} {} & \' {} {456} \\ \' {12.3} {456} & \' {12.3} {} & \' {} {4.56} \\ \end{array}$$
Interpreting quote notation
The first thing to handle is the radix point. This point has the same function as regular decimal notation: it divides the integer form of the number by the base (\$10\$) equal to the number of places it is from the end. Therefore, we can rewrite our 3 examples with a radix point as
$$\begin{array} & \' {123} {456} \div 10^4 & \' {123} {} \div 10 & \' {} {456} \div 10^2 & \end{array}$$
Now, we can interpret the quote. The quote indicates that the digits to its left should be repeated infinitely to the left, then have the digits to the right appended to the right end. If there are no digits to the left of the quote, a zero is taken instead:
$$ \' {123} {456} = \dots 123123456 \\ \' {123} {} = \dots 123123 \\ \' {} {456} = \dots 000 456 $$
We then consider the following converging series:
$$\cdots + 10^{3k} + 10^{2k} + 10^{k} + 10^{0} = \frac 1 {1 - 10^k}$$
where \$k\$ is equal to the number of digits to the left of the quote (\$k = 1\$ from the implicit \$0\$ if there are no digits). We can then approach the infinite number in the following way:
$$\begin{align} \' {123} {456} & = \dots 123123456 \\ & = 456 + \dots 123123000 \\ & = 456 + 1000 \times \dots 123123 \\ & = 456 + 1000 \times \dots \' {123} {} \\ & = 456 + 1000 \times (\cdots 123 \times 10^9 + 123 \times 10^6 + 123 \times 10^3 + 123 \times 10^0) \\ & = 456 + 1000 \times 123 \times (\cdots + 10^9 + 10^6 + 10^3 + 10^0) \\ & = 456 + 123000 \times \left( \frac 1 {1 - 10^3} \right) \\ & = 456 - \frac {123000} {999} \\ & = \frac {110848} {333} \end{align}$$
If the original number had a radix point in (say, \$\' {12.3} {456}\$), then we just "bring back" the division we performed earlier: \$\' {12.3} {456} = \' {123} {456} \div 10^4 = \frac {110848} {333} \div 10^4 = \frac {6928} {208125}\$
With this notation, we can express any rational number in a finite string of digits with a quote and potentially a radix point.
Additionally, the 4 basic operations - addition, subtraction, multiplication and division - are fully defined for quote notated values, and produce exact values with no roundoff errors.
Rational numbers to quote notation
Unfortunately, while there is a clearly defined algorithm for mapping a quote notated value to a rational number, doing the inverse can be far more taxing. The simplest method is to combine the fact that negation and division are clearly and fully defined for quote notated values, then using these to calculate the quote notation form of a rational number.
Natural numbers are easily expressed in quote notation, as are positive finite terminating decimals. \$\' {} z\$ is the quote notation form of a natural number \$z\$, or a finite terminating decimal \$z\$. For example, \$\' {} 2 = 2\$ and \$\' {} {3.2} = 3.2\$. Negative integers and negative finite terminating decimals are also fairly trivial to derive, through negation of their positive equivalents. From these two points, we can then divide any two integers or finite terminating decimals to construct any arbitrary rational number, expressed in quote notation form.
Negating quote notated values
The easiest way to negate any quote notated value is to subtract it from \$\' 0 {}\$. This is almost exactly like digit-wise subtraction for regular decimal numbers, but rather than "borrowing" a digit from the left if the minuend digit is less than the subtrahend, we "carry" a digit. For example, to negate \$\' {429} {}\$:
$$\begin{array} \dots & 0 & 0 & 0 & 0 & 0 & 0 \\ \dots & 4_1 & 2_1 & 9_1 & 4_1 & 2_1 & 9 \\ \hline \\ \dots & 5 & 7 & 0 & 5 & 7 & 1 & = \' {057} 1 \end{array}$$
We start by subtracting the \$9\$ from \$0\$ on the right end. As \$0 < 9\$, we carry a digit along (notated by \$2_1\$ etc.) and subtract \$9\$ from \$10\$, yielding \$1\$. We then repeat this for each digit to the left, adding the carry to the subtrahend (\$10 - (2 + 1) = 7\$, carry a \$1\$ as \$0< (2+1)\$, etc.). Eventually, we'll end up with a section repeating infinitely to the left, so we can put our quote in.
Dividing quote notated values
Division can be calculated through examining the last digit of both the divisor and the dividend, and is built up from the right end of the result. This is best demonstrated with an example, \$\' {} {143} \div \' {} {333}\$:
We examine the last digit to determine what we multiply the divisor by. We then subtract this multiple from the dividend until we reach a repeated difference. In the example below, the quotes have been fully expanded, and subtraction carries have been omitted:
$$\begin{array}{rrccccccccl} & \dots & 0 & 0 & 0 & 0 & 0 & 1 & 4 & 3 & = \' {} {143} \\ - & \dots & 0 & 0 & 0 & 0 & 0 & 3 & 3 & 3 & = \' {} {333} \times 1 \\ \hline \\ & \dots & 9 & 9 & 9 & 9 & 9 & 8 & 1 & & \' {} {} \\ - & \dots & 0 & 0 & 0 & 2 & 3 & 3 & 1 & & = \' {} {333} \times 7 \\ \hline \\ & \dots & 9 & 9 & 9 & 7 & 6 & 5 & & & \\ - & \dots & 0 & 0 & 1 & 6 & 6 & 5 & & & = \' {} {333} \times 5 \\ \hline \\ & \dots & 9 & 9 & 8 & 1 & 0 & & & & \\ - & \dots & 0 & 0 & 0 & 0 & 0 & & & & = \' {} {333} \times 0 \\ \hline \\ - & \dots & 9 & 9 & 8 & 1 & & & & & \text{Repeated value} \\ \end{array}$$
Each step, we leave the last digit that was cancelled from the subtraction blank. Note that this is only the last digit, not all trailing zeros, as these can have an impact on the final result.
In this case, we have the digits of our division, we just need to know where to place the quote. We always place the quote immediately after the first occurrence of the repeated value (marked with a quote in the example above). For our example, \$\' {} {143} \div \' {} {333} = \' {057} {1}\$
However, this only works in cases where the divisor (\$\' {} {333}\$ in the example) is co-prime with \$10\$. If the denominator in the fraction \$\frac a b\$ is not co-prime with \$10\$, we need to manipulate the fraction to the form \$\frac x {10\times y}\$ where \$y\$ is co-prime to \$10\$, then extract the \$\div 10\$ to modify the position of the radix point in the result \$x \div y\$. For example, \$8 \div 15\$:
$$\begin{align} 8 \div 15 & = 16 \div 30 \\ & = 16 \div 3 \div 10 \\ 16 \div 3 & = \' 6 {72} \\ \therefore 16 \div 3 \div 10 & = \' 6 {72} \div 10 \\ & = \' 6 {7.2} \\ \therefore 8 \div 15 & = \' 6 {7.2} \end{align}$$
This way, we are fully able to divide any natural number by another, allowing us to express all positive rational numbers. Through negation, we can then express all rational numbers.
Normalisation of quote notation
As the left hand side of the quote is infinite, it is possible to "roll" it into the right hand side, to obtain an alternate form of the value. For example \$\' {057} 1 = \' {705} {71}\$ (try writing them both out if you can't see it). Therefore, it is usually possible to normalise a quote notated value by potentially rolling any leading digits from the right side of the quote into the left side.
The normalised form of quote notation is always the shortest possible representation of that number.
You are to take a rational number as input, and output the normalised quote notation form of this rational number.
You may choose to take input as either a fraction \$\frac a b\$, or as two integers \$a, b\$. If the input is negative and you take 2 integers as input, you may choose which integer has the negative sign, so long as it's consistent. In either case, the fraction will be fully simplified, and \$b\$ will never be equal to 0. If \$b\$ is equal to \$1\$, you may choose to omit it.
You may output the quote notated value in any reasonable manner. For example, outputting as a string with 2 distinct, non-digit characters representing the quote and radix point, or outputting 2 lists of digits and a power of 10 to represent the radix point.
Note that there may not be digits after the quote, and that leading zeros matter for both strings of digits, so the format you choose must be able to represent significant leading zeros, as well as distinguish between an empty output and a zero output.
This is code-golf so the shortest code in bytes wins.
Test cases
2/1 = '2
-85/7 = 571428'45
58/3 = 6'86
-11/8 = 9'8.625
32/21 = 047619'2
-85/56 = 714285'5.625
677/86 = 162790697674418604651'9.5
-332/9 = 8'52
71/51 = 1960784313725490'21
1/17 = 2941176470588235'3
-1/900 = .11'
389/198 = 35'5.5
-876/83 = 38554216867469879518072289156626506024096'28
-38/2475 = 3.5'2
-1081/2475 = 67'.24
. 1'
/.11'
, where the number of repeating digits is less than the distance between the quote and the decimal point? \$\endgroup\$-1/900
is.11'
, as the power of 10 to divide by with.1'
is too low, and "places" should only be filled with digits \$\endgroup\$-11/8
should be9'8.625
, and389/198
should be3.5'55
\$\endgroup\$-11/8
.389/198
should be35'5.5
, and I've corrected the3.5'2
input \$\endgroup\$