improved testing with macro and Inf-NaN handling