Correct impl is: ( observer_lat.sin() * alt.sin() - observer_lat.cos() * **alt**.cos() * az.cos() ).asin()