title: Scipy's fftpack dct and idct
body: <p>Let say you use the dct function, then do no manipulation of the data and use the invert transform; wouldn't the inverted data be the same as the pre-transformed data? Why the floating point issue? Is it a reported issue or is it a normal behavior?</p>
  
  <pre><code>In [21]: a = [1.2, 3.4, 5.1, 2.3, 4.5]
  
  In [22]: b = dct(a)
  
  In [23]: b
  Out[23]: array([ 33.        ,  -4.98384545,  -4.5       ,  -5.971707  ,   4.5       ])
  
  In [24]: c = idct(b)
  
  In [25]: c
  Out[25]: array([ 12.,  34.,  51.,  23.,  45.])
  </code></pre>
  
  <p>Anyone has an explanation as why? Of course, a simple <code>c*10**-1</code> would do the trick, but if you repeat the call of the function to use it on several dimensions, the error gets bigger:</p>
  
  <pre><code>In [37]: a = np.random.rand(3,3,3)
  
  In [38]: d = dct(dct(dct(a).transpose(0,2,1)).transpose(2,1,0)).transpose(2,1,0).transpose(0,2,1)
  
  In [39]: e = idct(idct(idct(d).transpose(0,2,1)).transpose(2,1,0)).transpose(2,1,0).transpose(0,2,1)
  
  In [40]: a
  Out[40]: 
  array([[[ 0.48709809,  0.50624831,  0.91190972],
          [ 0.56545798,  0.85695062,  0.62484782],
          [ 0.96092354,  0.17453537,  0.17884233]],
  
         [[ 0.29433402,  0.08540074,  0.18574437],
          [ 0.09942075,  0.78902363,  0.62663572],
          [ 0.20372951,  0.67039551,  0.52292875]],
  
         [[ 0.79952289,  0.48221372,  0.43838685],
          [ 0.25559683,  0.39549153,  0.84129493],
          [ 0.69093533,  0.71522961,  0.16522915]]])
  
  In [41]: e
  Out[41]: 
  array([[[ 105.21318703,  109.34963575,  196.97249887],
          [ 122.13892469,  185.10133376,  134.96712825],
          [ 207.55948396,   37.69964085,   38.62994399]],
  
         [[  63.57614855,   18.44656009,   40.12078466],
          [  21.47488098,  170.42910452,  135.35331646],
          [  44.00557341,  144.80543099,  112.95260949]],
  
         [[ 172.69694529,  104.15816275,   94.69156014],
          [  55.20891593,   85.42617016,  181.71970442],
          [ 149.2420308 ,  154.48959477,   35.68949734]]])
  </code></pre>
  
  <p>Here a link to the <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.fftpack.dct.html" rel="nofollow">doc</a>.</p>