When porting a javascript library to Python, I found this code:
return Math.atan2(
Math.sqrt(
(_ = cosφ1 * sinΔλ) * _ + (_ = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * _
),
sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ
);
Am I wrong or (_ = cosφ1 * sinΔλ) * _
could be written like Math.pow(cosφ1 * sinΔλ, 2)
?
I guess the author is trying to avoid using Math.pow, is this expensive in javascript compared to the temporary assignment?
[update]
As of late 2016, with Chrome 53.0 (64-bit) looks like the difference is not as large as it used to be.