Fixed bug with Euler angle calculation. Used fabs() for double rather than abs() which is for int only