fixed math formula for bearing