Tests of longer real input and fix
2 files changed, 17 insertions(+), 1 deletions(-)

M fft-real.sml
M test.sml
M fft-real.sml +1 -1
@@ 94,7 94,7 @@ fun forward_inplace (t : t, re_in, re_ou
             (fn i =>
                 let
                     val c = VEC.sub (#cos_f t, i)
-                    val s = VEC.sub (#sin_f t, i)
+                    val s = ~ VEC.sub (#sin_f t, i)
                     val k = i + 1
                     val r0 = sub (re_a, k)
                     val r1 = sub (re_a, hs - k)

          
M test.sml +16 -0
@@ 1,6 1,8 @@ 
         
 (* Unit tests *)
 
+val cospi4 = 0.5 * Math.sqrt(2.0)
+
 val testcases = [
     { name = "dc",
       real = true,

          
@@ 27,6 29,20 @@ val testcases = [
       input = ([ 1.0, 0.0, ~1.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0 ]),
       output = ([ 0.0, 2.0, 0.0, 2.0 ], [ 0.0, 0.0, 0.0, 0.0 ]),
       ccs = ([ 0.0, 2.0, 0.0 ], [ 0.0, 0.0, 0.0 ])},
+    { name = "cosine_8",
+      real = true,
+      input = ([ 1.0, cospi4, 0.0, ~cospi4, ~1.0, ~cospi4, 0.0, cospi4 ],
+               [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]),
+      output = ([ 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0 ],
+                [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]),
+      ccs = ([ 0.0, 4.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0, 0.0 ]) },
+    { name = "sine_8",
+      real = true,
+      input = ([ 0.0, cospi4, 1.0, cospi4, 0.0, ~cospi4, ~1.0, ~cospi4 ],
+               [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]),
+      output = ([ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ],
+                [ 0.0, ~4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0 ]),
+      ccs = ([ 0.0, 0.0, 0.0, 0.0, 0.0 ], [ 0.0, ~4.0, 0.0, 0.0, 0.0 ]) },
     { name = "sine_cosine",
       real = true,
       input = ([ 0.5, 1.0, ~0.5, ~1.0 ], [ 0.0, 0.0, 0.0, 0.0 ]),