added NaN test for diag_post_multiply
added NaN test for diag_pre_multiply