Fix automatic evaluation for sin/cos(pi*n/2): consider n.is_even case

fixes #8298
Merge pull request #8303 from skirpichev/8298-fix

Fix automatic evaluation for sin/cos(pi*n/2): consider n.is_even case