Swap out some periodic and non-periodic parts In the decimal representation of every rational number p/q, you have a periodic tail, a non-periodic head, and a section before the decimal point in the following format: 

(before decimal point).(non-periodic)(periodic)


Some examples include:

1/70 = 0.0142857... = (0).(0)(142857)
10/7 = 1.428571... = (1).()(428571)            ## no non-periodic part
1/13 = 0.076923... = (0).()(076923)
3/40 = 0.075 = (0).(075)()                    ## no periodic part
-2/15 = -0.13... = -(0).(1)(3)                ## negative
75/38 = 1.9736842105263157894... = (1).(9)(736842105263157894)
                                              ## periodic part longer than float can handle
25/168 = 0.148809523... = (0).(148)(809523)
120/99 = 40/33 = 1.212121... = (1).()(21)
2/1 = 2 = (2).()()                            ## no periodic, no non-periodic
0/1 = 0 = (0).()()
0/2 = 0 = (0).()()
299/792 = 0.37752... = (0).(377)(52)
95/-14 = -6.7857142... = -(6).(7)(857142)
-95/-14 = 6.7857142... = (6).(7)(857142)


The challenge is to swap the periodic and non-periodic parts, leaving the before decimal point alone, to create a new number. For example:

25/168 = 0.148809523... = (0).(148)(809523)
       =&gt; (0).(809523)(148) = 0.809523148148... = 870397/1080000


If a number has no periodic part like 0.25 turn that number into a new periodic number, and vice versa.

1/4 = 0.25 = (0).(25)() =&gt; (0).()(25) = 0.252525... = 25/99
4/9 = 0.444444... = (0).()(4) =&gt; (0).(4)() = 0.4 = 2/5
5/1 = 5 = (5).()() =&gt; (5).()() = 5 = 5/1


The challenge


Take a fraction x as input, as a string, two inputs, a rational number, or whatever method suits your language.
Swap the periodic and non-periodic parts of the decimal representation of x to create a new number, leaving the part before the decimal alone. The periodic part always starts as soon as possible so that the non-periodic part is as short as possible. Examples are below.
Return the swapped number as a new fraction. The input is not necessarily reduced though the output should be. Input format is allowed to differ from output format.
The numerator p of x will be an integer with absolute value of one million or less and the denominator q of x will be a non-zero integer with absolute value of one million or less.
The numerator r and denominator s of the result is not guaranteed to be less than one million. Given the length of the periodic parts of these numbers, it is recommended that you avoid directly converting to floats.
This is code golf. Shortest answer in bytes wins.


Examples

1/70 = (0).(0)(142857)     =&gt; (0).(142857)(0) = (0).(142857)() = 0.142857 = 142857/1000000
10/7 = (1).()(428571)      =&gt; (1).(428571)() = 1.428571 = 1428571/1000000
1/13 = (0).()(076923)      =&gt; (0).(076923)() = 0.076293 = 76923/1000000
3/40 = (0).(075)()         =&gt; (0).()(075) = 0.075075... = 75/999 = 25/333
-2/15 = -(0).(1)(3)        =&gt; -(0).(3)(1) = -0.311111... = -28/90 = -14/45
75/38 = (1).(9)(736842105263157894)
      =&gt; (1).(736842105263157894)(9) = (1).(736842105263157895)()  ## since 0.999... = 1
      = 1.736842105263157895 = 1736842105263157895/1000000000000000000
      = 347368421052631579/200000000000000000
25/168 = (0).(148)(809523) =&gt; (0).(809523)(148) = 0.809523148148... = 870397/1080000
120/99 = (1).()(21)        =&gt; (1).(21)() = 1.21 = 121/100
2/1 = (2).()()             =&gt; (2).()() = 2 = 2/1
0/1 = (0).()()             =&gt; (0).()() = 0 = 0/1
0/2 = (0).()()             =&gt; (0).()() = 0 = 0/1
299/792 = (0).(377)(52)    =&gt; (0).(52)(377) = 0.52377377... = 2093/3996
95/-14 = -(6).(7)(857142)  =&gt; -(6).(857142)(7) = -6.857142777... = -12342857/1800000
-95/-14 = (6).(7)(857142)  =&gt; (6).(857142)(7) = 6.857142777... = 12342857/1800000
Python 2, 292 bytes
def x(n,d):
 L=len;s=cmp(n*d,0);n*=s;b=p=`n/d`;a={};n%=d
 while not n in a:
  a[n]=p;q=n/d;n=n%d
  if q==0:n*=10;p+=' '
  p=p[:-1]+`q`
 p=p[L(a[n]):];a=a[n][L(b):]
 if n==0:p=''
 n=int(b+p+a);d=10**L(p+a)
 if a!='':n-=int(b+p);d-=10**L(p)
 import fractions as f;g=f.gcd(n,d);return(n/g*s,d/g)

Ungolfed version, works in both python 2&amp;3. Also prints decimal representation.
def x(n,d):
# sign handling
 s=n*d&gt;0-n*d&lt;0
 n*=s
# b, a, p: BEFORE decimal, AFTER decimal, PERIODIC part
 b=p=str(n//d)
 a={}
 n%=d
# long division
 while not n in a:
  a[n]=p
  q=n//d
  n=n%d
  if q==0:
   n*=10
   p+=' '
  p=p[:-1]+str(q)
# a/p still contain b/ba as prefixes, remove them
 p=p[len(a[n]):]
 a=a[n][len(b):]
 if n==0: p=''
# print decimal representation
 print(&quot;(&quot; + b + &quot;).(&quot; + a + &quot;)(&quot; + p + &quot;)&quot;)
# reassemble fraction (with a and p exchanged)
 n=int(b+p+a)
 d=10**len(p+a)
 if a!='':
  n-=int(b+p)
  d-=10**len(p)
# reduce output
 from fractions import gcd
 g=gcd(n,d)
 return(n//g*s,d//g)