extract degrees function from math