Refine HW4 truncated normal code.