compiler/nir: move tan-calculation to helper