added NaN test for trace_gen_quad_form