add sub_handle_invert_trig(); to factorize the code