Midpoint on a great circle

Percentage Accurate: 98.7% → 99.6%
Time: 19.9s
Alternatives: 24
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (+
  lambda1
  (atan2
   (* (cos phi2) (sin (- lambda1 lambda2)))
   (+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.cos(phi1) + (Math.cos(phi2) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2):
	return lambda1 + math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.cos(phi1) + (math.cos(phi2) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2)
	return Float64(lambda1 + atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(cos(phi1) + Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 24 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 98.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (+
  lambda1
  (atan2
   (* (cos phi2) (sin (- lambda1 lambda2)))
   (+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.cos(phi1) + (Math.cos(phi2) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2):
	return lambda1 + math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.cos(phi1) + (math.cos(phi2) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2)
	return Float64(lambda1 + atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(cos(phi1) + Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}

Alternative 1: 99.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (+
  lambda1
  (atan2
   (*
    (- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
    (cos phi2))
   (+
    (cos phi1)
    (*
     (cos phi2)
     (+ (* (sin lambda1) (sin lambda2)) (* (cos lambda2) (cos lambda1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (cos(phi1) + (cos(phi2) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = lambda1 + atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (cos(phi1) + (cos(phi2) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (Math.cos(phi1) + (Math.cos(phi2) * ((Math.sin(lambda1) * Math.sin(lambda2)) + (Math.cos(lambda2) * Math.cos(lambda1))))));
}
def code(lambda1, lambda2, phi1, phi2):
	return lambda1 + math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (math.cos(phi1) + (math.cos(phi2) * ((math.sin(lambda1) * math.sin(lambda2)) + (math.cos(lambda2) * math.cos(lambda1))))))
function code(lambda1, lambda2, phi1, phi2)
	return Float64(lambda1 + atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(cos(phi1) + Float64(cos(phi2) * Float64(Float64(sin(lambda1) * sin(lambda2)) + Float64(cos(lambda2) * cos(lambda1)))))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = lambda1 + atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (cos(phi1) + (cos(phi2) * ((sin(lambda1) * sin(lambda2)) + (cos(lambda2) * cos(lambda1))))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\lambda_1 + \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)}
\end{array}
Derivation
  1. Initial program 99.1%

    \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
    2. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    4. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
    13. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
    14. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
    15. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
    16. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
    18. cos-lowering-cos.f6499.1%

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
  3. Simplified99.1%

    \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. sin-diffN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    4. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f6499.1%

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
  6. Applied egg-rr99.1%

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
  7. Step-by-step derivation
    1. cos-diffN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\color{blue}{\phi_2}\right)\right)\right)\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\color{blue}{\phi_2}\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\left(\sin \lambda_1 \cdot \sin \lambda_2\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\color{blue}{\phi_2}\right)\right)\right)\right)\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \sin \lambda_2\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    5. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \sin \lambda_2\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    9. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    10. cos-lowering-cos.f6499.6%

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.6%

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \color{blue}{\left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)} \cdot \cos \phi_2} \]
  9. Final simplification99.6%

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)} \]
  10. Add Preprocessing

Alternative 2: 98.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (+
  lambda1
  (atan2
   (*
    (- (* (sin lambda1) (cos lambda2)) (* (cos lambda1) (sin lambda2)))
    (cos phi2))
   (+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = lambda1 + atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + Math.atan2((((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.cos(lambda1) * Math.sin(lambda2))) * Math.cos(phi2)), (Math.cos(phi1) + (Math.cos(phi2) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2):
	return lambda1 + math.atan2((((math.sin(lambda1) * math.cos(lambda2)) - (math.cos(lambda1) * math.sin(lambda2))) * math.cos(phi2)), (math.cos(phi1) + (math.cos(phi2) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2)
	return Float64(lambda1 + atan(Float64(Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(cos(lambda1) * sin(lambda2))) * cos(phi2)), Float64(cos(phi1) + Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = lambda1 + atan2((((sin(lambda1) * cos(lambda2)) - (cos(lambda1) * sin(lambda2))) * cos(phi2)), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[(N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\lambda_1 + \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Derivation
  1. Initial program 99.1%

    \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
    2. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    4. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
    13. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
    14. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
    15. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
    16. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
    18. cos-lowering-cos.f6499.1%

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
  3. Simplified99.1%

    \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. sin-diffN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    4. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f6499.1%

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
  6. Applied egg-rr99.1%

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
  7. Final simplification99.1%

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  8. Add Preprocessing

Alternative 3: 85.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\cos \phi_1 \leq 0.75:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \mathbf{elif}\;\cos \phi_1 \leq 0.999996:\\ \;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2)))
        (t_1 (* (cos phi2) (sin (- lambda1 lambda2)))))
   (if (<= (cos phi1) 0.75)
     (+
      lambda1
      (atan2 t_1 (+ (cos phi1) (* t_0 (+ 1.0 (* -0.5 (* phi2 phi2)))))))
     (if (<= (cos phi1) 0.999996)
       (atan2 t_1 (+ (cos phi1) (* (cos lambda2) (cos phi2))))
       (+
        lambda1
        (atan2 t_1 (+ (* (cos phi2) t_0) (+ 1.0 (* phi1 (* phi1 -0.5))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double t_1 = cos(phi2) * sin((lambda1 - lambda2));
	double tmp;
	if (cos(phi1) <= 0.75) {
		tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	} else if (cos(phi1) <= 0.999996) {
		tmp = atan2(t_1, (cos(phi1) + (cos(lambda2) * cos(phi2))));
	} else {
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = cos((lambda1 - lambda2))
    t_1 = cos(phi2) * sin((lambda1 - lambda2))
    if (cos(phi1) <= 0.75d0) then
        tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0d0 + ((-0.5d0) * (phi2 * phi2))))))
    else if (cos(phi1) <= 0.999996d0) then
        tmp = atan2(t_1, (cos(phi1) + (cos(lambda2) * cos(phi2))))
    else
        tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0d0 + (phi1 * (phi1 * (-0.5d0))))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos((lambda1 - lambda2));
	double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
	double tmp;
	if (Math.cos(phi1) <= 0.75) {
		tmp = lambda1 + Math.atan2(t_1, (Math.cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	} else if (Math.cos(phi1) <= 0.999996) {
		tmp = Math.atan2(t_1, (Math.cos(phi1) + (Math.cos(lambda2) * Math.cos(phi2))));
	} else {
		tmp = lambda1 + Math.atan2(t_1, ((Math.cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos((lambda1 - lambda2))
	t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2))
	tmp = 0
	if math.cos(phi1) <= 0.75:
		tmp = lambda1 + math.atan2(t_1, (math.cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))))
	elif math.cos(phi1) <= 0.999996:
		tmp = math.atan2(t_1, (math.cos(phi1) + (math.cos(lambda2) * math.cos(phi2))))
	else:
		tmp = lambda1 + math.atan2(t_1, ((math.cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2)))
	tmp = 0.0
	if (cos(phi1) <= 0.75)
		tmp = Float64(lambda1 + atan(t_1, Float64(cos(phi1) + Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(phi2 * phi2)))))));
	elseif (cos(phi1) <= 0.999996)
		tmp = atan(t_1, Float64(cos(phi1) + Float64(cos(lambda2) * cos(phi2))));
	else
		tmp = Float64(lambda1 + atan(t_1, Float64(Float64(cos(phi2) * t_0) + Float64(1.0 + Float64(phi1 * Float64(phi1 * -0.5))))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos((lambda1 - lambda2));
	t_1 = cos(phi2) * sin((lambda1 - lambda2));
	tmp = 0.0;
	if (cos(phi1) <= 0.75)
		tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	elseif (cos(phi1) <= 0.999996)
		tmp = atan2(t_1, (cos(phi1) + (cos(lambda2) * cos(phi2))));
	else
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[phi1], $MachinePrecision], 0.75], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[Cos[phi1], $MachinePrecision] + N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Cos[phi1], $MachinePrecision], 0.999996], N[ArcTan[t$95$1 / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + N[(1.0 + N[(phi1 * N[(phi1 * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_1 \leq 0.75:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\

\mathbf{elif}\;\cos \phi_1 \leq 0.999996:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (cos.f64 phi1) < 0.75

    1. Initial program 99.8%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \color{blue}{\left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right)\right) \]
      9. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \left(\frac{-1}{2} \cdot {\phi_2}^{2}\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      10. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)}\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)}\right)\right)\right)\right) \]
      13. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\color{blue}{\frac{-1}{2} \cdot {\phi_2}^{2}} + 1\right)\right)\right)\right)\right) \]
      14. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\color{blue}{\frac{-1}{2}} \cdot {\phi_2}^{2} + 1\right)\right)\right)\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(1 + \color{blue}{\frac{-1}{2} \cdot {\phi_2}^{2}}\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2}\right)}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({\phi_2}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(\phi_2 \cdot \color{blue}{\phi_2}\right)\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f6486.4%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \color{blue}{\phi_2}\right)\right)\right)\right)\right)\right)\right) \]
    7. Simplified86.4%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}} \]

    if 0.75 < (cos.f64 phi1) < 0.999995999999999996

    1. Initial program 97.2%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6497.2%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified97.2%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6497.2%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified97.2%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in lambda1 around 0

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}} \]
    9. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \sin \left(\lambda_1 - \lambda_2\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \lambda_2 \cdot \cos \phi_2\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \sin \left(\lambda_1 - \lambda_2\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \lambda_2 \cdot \cos \phi_2\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \left(\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \left(\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \lambda_2 \cdot \cos \phi_2\right)}\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \lambda_2} \cdot \cos \phi_2\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \phi_2 \cdot \color{blue}{\cos \lambda_2}\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \lambda_2}\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\lambda_2}\right)\right)\right) \]
      11. cos-lowering-cos.f6480.8%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right) \]
    10. Simplified80.8%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]

    if 0.999995999999999996 < (cos.f64 phi1)

    1. Initial program 99.0%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.0%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \left(\frac{-1}{2} \cdot {\phi_1}^{2} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right) + \color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \color{blue}{\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot \left(\phi_1 \cdot \color{blue}{\phi_1}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\left(\frac{-1}{2} \cdot \phi_1\right) \cdot \color{blue}{\phi_1}\right)\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\phi_1 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \phi_1\right)}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \color{blue}{\left(\frac{-1}{2} \cdot \phi_1\right)}\right)\right)\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \left(\phi_1 \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6499.0%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \mathsf{*.f64}\left(\phi_1, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right)\right) \]
    7. Simplified99.0%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_1 \leq 0.75:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \mathbf{elif}\;\cos \phi_1 \leq 0.999996:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 90.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\cos \phi_2 \leq 0.996:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2)))
        (t_1 (* (cos phi2) (sin (- lambda1 lambda2)))))
   (if (<= (cos phi2) 0.996)
     (+
      lambda1
      (atan2 t_1 (+ (* (cos phi2) t_0) (+ 1.0 (* phi1 (* phi1 -0.5))))))
     (+
      lambda1
      (atan2 t_1 (+ (cos phi1) (* t_0 (+ 1.0 (* -0.5 (* phi2 phi2))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double t_1 = cos(phi2) * sin((lambda1 - lambda2));
	double tmp;
	if (cos(phi2) <= 0.996) {
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	} else {
		tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = cos((lambda1 - lambda2))
    t_1 = cos(phi2) * sin((lambda1 - lambda2))
    if (cos(phi2) <= 0.996d0) then
        tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0d0 + (phi1 * (phi1 * (-0.5d0))))))
    else
        tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0d0 + ((-0.5d0) * (phi2 * phi2))))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos((lambda1 - lambda2));
	double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
	double tmp;
	if (Math.cos(phi2) <= 0.996) {
		tmp = lambda1 + Math.atan2(t_1, ((Math.cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	} else {
		tmp = lambda1 + Math.atan2(t_1, (Math.cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos((lambda1 - lambda2))
	t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2))
	tmp = 0
	if math.cos(phi2) <= 0.996:
		tmp = lambda1 + math.atan2(t_1, ((math.cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))))
	else:
		tmp = lambda1 + math.atan2(t_1, (math.cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2)))
	tmp = 0.0
	if (cos(phi2) <= 0.996)
		tmp = Float64(lambda1 + atan(t_1, Float64(Float64(cos(phi2) * t_0) + Float64(1.0 + Float64(phi1 * Float64(phi1 * -0.5))))));
	else
		tmp = Float64(lambda1 + atan(t_1, Float64(cos(phi1) + Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(phi2 * phi2)))))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos((lambda1 - lambda2));
	t_1 = cos(phi2) * sin((lambda1 - lambda2));
	tmp = 0.0;
	if (cos(phi2) <= 0.996)
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	else
		tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[phi2], $MachinePrecision], 0.996], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + N[(1.0 + N[(phi1 * N[(phi1 * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[Cos[phi1], $MachinePrecision] + N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_2 \leq 0.996:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 phi2) < 0.996

    1. Initial program 99.3%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.3%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \left(\frac{-1}{2} \cdot {\phi_1}^{2} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right) + \color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \color{blue}{\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot \left(\phi_1 \cdot \color{blue}{\phi_1}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\left(\frac{-1}{2} \cdot \phi_1\right) \cdot \color{blue}{\phi_1}\right)\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\phi_1 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \phi_1\right)}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \color{blue}{\left(\frac{-1}{2} \cdot \phi_1\right)}\right)\right)\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \left(\phi_1 \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6481.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \mathsf{*.f64}\left(\phi_1, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right)\right) \]
    7. Simplified81.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}} \]

    if 0.996 < (cos.f64 phi2)

    1. Initial program 98.8%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6498.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified98.8%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \color{blue}{\left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right)\right) \]
      9. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \left(\frac{-1}{2} \cdot {\phi_2}^{2}\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      10. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)}\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)}\right)\right)\right)\right) \]
      13. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\color{blue}{\frac{-1}{2} \cdot {\phi_2}^{2}} + 1\right)\right)\right)\right)\right) \]
      14. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\color{blue}{\frac{-1}{2}} \cdot {\phi_2}^{2} + 1\right)\right)\right)\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(1 + \color{blue}{\frac{-1}{2} \cdot {\phi_2}^{2}}\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2}\right)}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({\phi_2}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(\phi_2 \cdot \color{blue}{\phi_2}\right)\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f6498.4%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \color{blue}{\phi_2}\right)\right)\right)\right)\right)\right)\right) \]
    7. Simplified98.4%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_2 \leq 0.996:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 89.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\cos \phi_1 \leq 0.975:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + 1}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2)))
        (t_1 (* (cos phi2) (sin (- lambda1 lambda2)))))
   (if (<= (cos phi1) 0.975)
     (+
      lambda1
      (atan2 t_1 (+ (cos phi1) (* t_0 (+ 1.0 (* -0.5 (* phi2 phi2)))))))
     (+ lambda1 (atan2 t_1 (+ (* (cos phi2) t_0) 1.0))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double t_1 = cos(phi2) * sin((lambda1 - lambda2));
	double tmp;
	if (cos(phi1) <= 0.975) {
		tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	} else {
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + 1.0));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = cos((lambda1 - lambda2))
    t_1 = cos(phi2) * sin((lambda1 - lambda2))
    if (cos(phi1) <= 0.975d0) then
        tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0d0 + ((-0.5d0) * (phi2 * phi2))))))
    else
        tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + 1.0d0))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos((lambda1 - lambda2));
	double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
	double tmp;
	if (Math.cos(phi1) <= 0.975) {
		tmp = lambda1 + Math.atan2(t_1, (Math.cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	} else {
		tmp = lambda1 + Math.atan2(t_1, ((Math.cos(phi2) * t_0) + 1.0));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos((lambda1 - lambda2))
	t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2))
	tmp = 0
	if math.cos(phi1) <= 0.975:
		tmp = lambda1 + math.atan2(t_1, (math.cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))))
	else:
		tmp = lambda1 + math.atan2(t_1, ((math.cos(phi2) * t_0) + 1.0))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2)))
	tmp = 0.0
	if (cos(phi1) <= 0.975)
		tmp = Float64(lambda1 + atan(t_1, Float64(cos(phi1) + Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(phi2 * phi2)))))));
	else
		tmp = Float64(lambda1 + atan(t_1, Float64(Float64(cos(phi2) * t_0) + 1.0)));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos((lambda1 - lambda2));
	t_1 = cos(phi2) * sin((lambda1 - lambda2));
	tmp = 0.0;
	if (cos(phi1) <= 0.975)
		tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	else
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + 1.0));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[phi1], $MachinePrecision], 0.975], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[Cos[phi1], $MachinePrecision] + N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_1 \leq 0.975:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 phi1) < 0.974999999999999978

    1. Initial program 99.1%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.1%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.1%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \frac{-1}{2}\right)}\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \color{blue}{\left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right)\right) \]
      9. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \left(\frac{-1}{2} \cdot {\phi_2}^{2}\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      10. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)}\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)}\right)\right)\right)\right) \]
      13. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\color{blue}{\frac{-1}{2} \cdot {\phi_2}^{2}} + 1\right)\right)\right)\right)\right) \]
      14. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\color{blue}{\frac{-1}{2}} \cdot {\phi_2}^{2} + 1\right)\right)\right)\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(1 + \color{blue}{\frac{-1}{2} \cdot {\phi_2}^{2}}\right)\right)\right)\right)\right) \]
      16. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {\phi_2}^{2}\right)}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left({\phi_2}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(\phi_2 \cdot \color{blue}{\phi_2}\right)\right)\right)\right)\right)\right)\right) \]
      19. *-lowering-*.f6481.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \color{blue}{\phi_2}\right)\right)\right)\right)\right)\right)\right) \]
    7. Simplified81.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}} \]

    if 0.974999999999999978 < (cos.f64 phi1)

    1. Initial program 99.1%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.1%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.1%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \color{blue}{1}\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{1}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), 1\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), 1\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), 1\right)\right)\right) \]
      6. --lowering--.f6494.4%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), 1\right)\right)\right) \]
    7. Simplified94.4%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_1 \leq 0.975:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 88.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\cos \phi_2 \leq 0.9992:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (- lambda1 lambda2))))
   (if (<= (cos phi2) 0.9992)
     (+ lambda1 (atan2 (* (cos phi2) t_0) (+ (cos phi2) (cos phi1))))
     (+
      lambda1
      (atan2 t_0 (+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((lambda1 - lambda2));
	double tmp;
	if (cos(phi2) <= 0.9992) {
		tmp = lambda1 + atan2((cos(phi2) * t_0), (cos(phi2) + cos(phi1)));
	} else {
		tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sin((lambda1 - lambda2))
    if (cos(phi2) <= 0.9992d0) then
        tmp = lambda1 + atan2((cos(phi2) * t_0), (cos(phi2) + cos(phi1)))
    else
        tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin((lambda1 - lambda2));
	double tmp;
	if (Math.cos(phi2) <= 0.9992) {
		tmp = lambda1 + Math.atan2((Math.cos(phi2) * t_0), (Math.cos(phi2) + Math.cos(phi1)));
	} else {
		tmp = lambda1 + Math.atan2(t_0, (Math.cos(phi1) + (Math.cos(phi2) * Math.cos((lambda1 - lambda2)))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.sin((lambda1 - lambda2))
	tmp = 0
	if math.cos(phi2) <= 0.9992:
		tmp = lambda1 + math.atan2((math.cos(phi2) * t_0), (math.cos(phi2) + math.cos(phi1)))
	else:
		tmp = lambda1 + math.atan2(t_0, (math.cos(phi1) + (math.cos(phi2) * math.cos((lambda1 - lambda2)))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(lambda1 - lambda2))
	tmp = 0.0
	if (cos(phi2) <= 0.9992)
		tmp = Float64(lambda1 + atan(Float64(cos(phi2) * t_0), Float64(cos(phi2) + cos(phi1))));
	else
		tmp = Float64(lambda1 + atan(t_0, Float64(cos(phi1) + Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = sin((lambda1 - lambda2));
	tmp = 0.0;
	if (cos(phi2) <= 0.9992)
		tmp = lambda1 + atan2((cos(phi2) * t_0), (cos(phi2) + cos(phi1)));
	else
		tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Cos[phi2], $MachinePrecision], 0.9992], N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[Cos[phi2], $MachinePrecision] + N[Cos[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$0 / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_2 \leq 0.9992:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\cos \phi_2 + \cos \phi_1}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 phi2) < 0.999199999999999977

    1. Initial program 99.3%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.3%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6497.9%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified97.9%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 + \color{blue}{\cos \phi_1}\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_2, \color{blue}{\cos \phi_1}\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\phi_1}\right)\right)\right) \]
      4. cos-lowering-cos.f6473.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\phi_1\right)\right)\right)\right) \]
    10. Simplified73.5%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 + \cos \phi_1}} \]

    if 0.999199999999999977 < (cos.f64 phi2)

    1. Initial program 98.8%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6498.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified98.8%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      2. --lowering--.f6498.2%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. Simplified98.2%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_2 \leq 0.9992:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 87.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\cos \phi_2 \leq 0.9992:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (- lambda1 lambda2))))
   (if (<= (cos phi2) 0.9992)
     (+ lambda1 (atan2 (* (cos phi2) t_0) (+ (cos phi2) (cos phi1))))
     (+ lambda1 (atan2 t_0 (+ (cos phi1) (* (cos lambda2) (cos phi2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((lambda1 - lambda2));
	double tmp;
	if (cos(phi2) <= 0.9992) {
		tmp = lambda1 + atan2((cos(phi2) * t_0), (cos(phi2) + cos(phi1)));
	} else {
		tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(lambda2) * cos(phi2))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sin((lambda1 - lambda2))
    if (cos(phi2) <= 0.9992d0) then
        tmp = lambda1 + atan2((cos(phi2) * t_0), (cos(phi2) + cos(phi1)))
    else
        tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(lambda2) * cos(phi2))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin((lambda1 - lambda2));
	double tmp;
	if (Math.cos(phi2) <= 0.9992) {
		tmp = lambda1 + Math.atan2((Math.cos(phi2) * t_0), (Math.cos(phi2) + Math.cos(phi1)));
	} else {
		tmp = lambda1 + Math.atan2(t_0, (Math.cos(phi1) + (Math.cos(lambda2) * Math.cos(phi2))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.sin((lambda1 - lambda2))
	tmp = 0
	if math.cos(phi2) <= 0.9992:
		tmp = lambda1 + math.atan2((math.cos(phi2) * t_0), (math.cos(phi2) + math.cos(phi1)))
	else:
		tmp = lambda1 + math.atan2(t_0, (math.cos(phi1) + (math.cos(lambda2) * math.cos(phi2))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(lambda1 - lambda2))
	tmp = 0.0
	if (cos(phi2) <= 0.9992)
		tmp = Float64(lambda1 + atan(Float64(cos(phi2) * t_0), Float64(cos(phi2) + cos(phi1))));
	else
		tmp = Float64(lambda1 + atan(t_0, Float64(cos(phi1) + Float64(cos(lambda2) * cos(phi2)))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = sin((lambda1 - lambda2));
	tmp = 0.0;
	if (cos(phi2) <= 0.9992)
		tmp = lambda1 + atan2((cos(phi2) * t_0), (cos(phi2) + cos(phi1)));
	else
		tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(lambda2) * cos(phi2))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Cos[phi2], $MachinePrecision], 0.9992], N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[Cos[phi2], $MachinePrecision] + N[Cos[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$0 / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_2 \leq 0.9992:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\cos \phi_2 + \cos \phi_1}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 phi2) < 0.999199999999999977

    1. Initial program 99.3%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.3%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6497.9%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified97.9%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 + \color{blue}{\cos \phi_1}\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_2, \color{blue}{\cos \phi_1}\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\phi_1}\right)\right)\right) \]
      4. cos-lowering-cos.f6473.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\phi_1\right)\right)\right)\right) \]
    10. Simplified73.5%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 + \cos \phi_1}} \]

    if 0.999199999999999977 < (cos.f64 phi2)

    1. Initial program 98.8%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6498.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified98.8%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6497.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified97.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
      2. --lowering--.f6497.0%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    10. Simplified97.0%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_2 \leq 0.9992:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 78.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \phi_2 \leq -0.01:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (if (<= (cos phi2) -0.01)
   (+
    lambda1
    (atan2
     (*
      (cos phi2)
      (*
       lambda1
       (+
        1.0
        (*
         (* lambda1 lambda1)
         (+
          (* (* lambda1 lambda1) 0.008333333333333333)
          -0.16666666666666666)))))
     (+ (* (cos phi2) (cos (- lambda1 lambda2))) 1.0)))
   (+
    lambda1
    (atan2
     (sin (- lambda1 lambda2))
     (+ (cos phi1) (* (cos lambda2) (cos phi2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double tmp;
	if (cos(phi2) <= -0.01) {
		tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), ((cos(phi2) * cos((lambda1 - lambda2))) + 1.0));
	} else {
		tmp = lambda1 + atan2(sin((lambda1 - lambda2)), (cos(phi1) + (cos(lambda2) * cos(phi2))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: tmp
    if (cos(phi2) <= (-0.01d0)) then
        tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0d0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333d0) + (-0.16666666666666666d0)))))), ((cos(phi2) * cos((lambda1 - lambda2))) + 1.0d0))
    else
        tmp = lambda1 + atan2(sin((lambda1 - lambda2)), (cos(phi1) + (cos(lambda2) * cos(phi2))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double tmp;
	if (Math.cos(phi2) <= -0.01) {
		tmp = lambda1 + Math.atan2((Math.cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), ((Math.cos(phi2) * Math.cos((lambda1 - lambda2))) + 1.0));
	} else {
		tmp = lambda1 + Math.atan2(Math.sin((lambda1 - lambda2)), (Math.cos(phi1) + (Math.cos(lambda2) * Math.cos(phi2))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	tmp = 0
	if math.cos(phi2) <= -0.01:
		tmp = lambda1 + math.atan2((math.cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), ((math.cos(phi2) * math.cos((lambda1 - lambda2))) + 1.0))
	else:
		tmp = lambda1 + math.atan2(math.sin((lambda1 - lambda2)), (math.cos(phi1) + (math.cos(lambda2) * math.cos(phi2))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	tmp = 0.0
	if (cos(phi2) <= -0.01)
		tmp = Float64(lambda1 + atan(Float64(cos(phi2) * Float64(lambda1 * Float64(1.0 + Float64(Float64(lambda1 * lambda1) * Float64(Float64(Float64(lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), Float64(Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))) + 1.0)));
	else
		tmp = Float64(lambda1 + atan(sin(Float64(lambda1 - lambda2)), Float64(cos(phi1) + Float64(cos(lambda2) * cos(phi2)))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	tmp = 0.0;
	if (cos(phi2) <= -0.01)
		tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), ((cos(phi2) * cos((lambda1 - lambda2))) + 1.0));
	else
		tmp = lambda1 + atan2(sin((lambda1 - lambda2)), (cos(phi1) + (cos(lambda2) * cos(phi2))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[N[Cos[phi2], $MachinePrecision], -0.01], N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(lambda1 * N[(1.0 + N[(N[(lambda1 * lambda1), $MachinePrecision] * N[(N[(N[(lambda1 * lambda1), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\cos \phi_2 \leq -0.01:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 phi2) < -0.0100000000000000002

    1. Initial program 99.4%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.4%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sin-lowering-sin.f6466.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. Simplified66.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    8. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(\lambda_1 \cdot \left(1 + {\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \left(1 + {\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \left({\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({\lambda_1}^{2}\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(\lambda_1 \cdot \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} + \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\left(\frac{1}{120} \cdot {\lambda_1}^{2}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\left({\lambda_1}^{2} \cdot \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({\lambda_1}^{2}\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(\lambda_1 \cdot \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f6466.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    10. Simplified66.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    11. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    12. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. --lowering--.f6456.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    13. Simplified56.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right) \cdot \cos \phi_2}{\color{blue}{1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}} \]

    if -0.0100000000000000002 < (cos.f64 phi2)

    1. Initial program 99.0%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.0%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6497.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified97.5%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
      2. --lowering--.f6482.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    10. Simplified82.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_2 \leq -0.01:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 98.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (+
  lambda1
  (atan2
   (* (cos phi2) (sin (- lambda1 lambda2)))
   (+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.cos(phi1) + (Math.cos(phi2) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2):
	return lambda1 + math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.cos(phi1) + (math.cos(phi2) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2)
	return Float64(lambda1 + atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(cos(phi1) + Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}
Derivation
  1. Initial program 99.1%

    \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 10: 98.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (+
  lambda1
  (atan2
   (* (cos phi2) (sin (- lambda1 lambda2)))
   (+ (cos phi1) (* (cos lambda2) (cos phi2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(lambda2) * cos(phi2))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(lambda2) * cos(phi2))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return lambda1 + Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (Math.cos(phi1) + (Math.cos(lambda2) * Math.cos(phi2))));
}
def code(lambda1, lambda2, phi1, phi2):
	return lambda1 + math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (math.cos(phi1) + (math.cos(lambda2) * math.cos(phi2))))
function code(lambda1, lambda2, phi1, phi2)
	return Float64(lambda1 + atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(cos(phi1) + Float64(cos(lambda2) * cos(phi2)))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = lambda1 + atan2((cos(phi2) * sin((lambda1 - lambda2))), (cos(phi1) + (cos(lambda2) * cos(phi2))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2}
\end{array}
Derivation
  1. Initial program 99.1%

    \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
    2. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    4. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
    13. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
    14. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
    15. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
    16. --lowering--.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
    17. remove-double-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
    18. cos-lowering-cos.f6499.1%

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
  3. Simplified99.1%

    \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
  4. Add Preprocessing
  5. Taylor expanded in lambda1 around 0

    \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
  6. Step-by-step derivation
    1. +-lowering-+.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
    2. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
    4. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
    5. cos-negN/A

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
    6. cos-lowering-cos.f6497.8%

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
  7. Simplified97.8%

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
  8. Final simplification97.8%

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \lambda_2 \cdot \cos \phi_2} \]
  9. Add Preprocessing

Alternative 11: 68.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\cos \phi_1 \leq 0.95:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{\cos \phi_1 + t\_0 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot t\_0 + 1}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2))))
   (if (<= (cos phi1) 0.95)
     (+
      lambda1
      (atan2
       (*
        (cos phi2)
        (*
         lambda1
         (+
          1.0
          (*
           (* lambda1 lambda1)
           (+
            (* (* lambda1 lambda1) 0.008333333333333333)
            -0.16666666666666666)))))
       (+ (cos phi1) (* t_0 (+ 1.0 (* -0.5 (* phi2 phi2)))))))
     (+
      lambda1
      (atan2 (sin (- lambda1 lambda2)) (+ (* (cos phi2) t_0) 1.0))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double tmp;
	if (cos(phi1) <= 0.95) {
		tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), (cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	} else {
		tmp = lambda1 + atan2(sin((lambda1 - lambda2)), ((cos(phi2) * t_0) + 1.0));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos((lambda1 - lambda2))
    if (cos(phi1) <= 0.95d0) then
        tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0d0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333d0) + (-0.16666666666666666d0)))))), (cos(phi1) + (t_0 * (1.0d0 + ((-0.5d0) * (phi2 * phi2))))))
    else
        tmp = lambda1 + atan2(sin((lambda1 - lambda2)), ((cos(phi2) * t_0) + 1.0d0))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos((lambda1 - lambda2));
	double tmp;
	if (Math.cos(phi1) <= 0.95) {
		tmp = lambda1 + Math.atan2((Math.cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), (Math.cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	} else {
		tmp = lambda1 + Math.atan2(Math.sin((lambda1 - lambda2)), ((Math.cos(phi2) * t_0) + 1.0));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos((lambda1 - lambda2))
	tmp = 0
	if math.cos(phi1) <= 0.95:
		tmp = lambda1 + math.atan2((math.cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), (math.cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))))
	else:
		tmp = lambda1 + math.atan2(math.sin((lambda1 - lambda2)), ((math.cos(phi2) * t_0) + 1.0))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	tmp = 0.0
	if (cos(phi1) <= 0.95)
		tmp = Float64(lambda1 + atan(Float64(cos(phi2) * Float64(lambda1 * Float64(1.0 + Float64(Float64(lambda1 * lambda1) * Float64(Float64(Float64(lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), Float64(cos(phi1) + Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(phi2 * phi2)))))));
	else
		tmp = Float64(lambda1 + atan(sin(Float64(lambda1 - lambda2)), Float64(Float64(cos(phi2) * t_0) + 1.0)));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos((lambda1 - lambda2));
	tmp = 0.0;
	if (cos(phi1) <= 0.95)
		tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), (cos(phi1) + (t_0 * (1.0 + (-0.5 * (phi2 * phi2))))));
	else
		tmp = lambda1 + atan2(sin((lambda1 - lambda2)), ((cos(phi2) * t_0) + 1.0));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Cos[phi1], $MachinePrecision], 0.95], N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(lambda1 * N[(1.0 + N[(N[(lambda1 * lambda1), $MachinePrecision] * N[(N[(N[(lambda1 * lambda1), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_1 \leq 0.95:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{\cos \phi_1 + t\_0 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot t\_0 + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 phi1) < 0.94999999999999996

    1. Initial program 99.7%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sin-lowering-sin.f6466.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. Simplified66.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    8. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(\lambda_1 \cdot \left(1 + {\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \left(1 + {\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \left({\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({\lambda_1}^{2}\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(\lambda_1 \cdot \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} + \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\left(\frac{1}{120} \cdot {\lambda_1}^{2}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\left({\lambda_1}^{2} \cdot \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({\lambda_1}^{2}\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(\lambda_1 \cdot \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f6465.7%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    10. Simplified65.7%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    11. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)}\right)\right) \]
    12. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{{\phi_2}^{2}}\right)\right)\right)\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{{\phi_2}^{2}}\right)\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) + \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot {\phi_2}^{2}\right)}\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} + \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot {\phi_2}^{2}\right)\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot {\phi_2}^{2}\right)}\right)\right)\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \left({\phi_2}^{2} \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right)\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \left(\frac{-1}{2} \cdot {\phi_2}^{2}\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      8. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right), \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\left(\frac{-1}{2} \cdot {\phi_2}^{2}\right), 1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left({\phi_2}^{2}\right)\right), 1\right), \cos \left(\color{blue}{\lambda_1} - \lambda_2\right)\right)\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\phi_2 \cdot \phi_2\right)\right), 1\right), \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      15. --lowering--.f6460.9%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    13. Simplified60.9%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \left(-0.5 \cdot \left(\phi_2 \cdot \phi_2\right) + 1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}} \]

    if 0.94999999999999996 < (cos.f64 phi1)

    1. Initial program 98.7%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6498.7%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified98.7%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      2. flip--N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \lambda_1 \cdot \cos \lambda_2 + \cos \lambda_1 \cdot \sin \lambda_2}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. sin-sumN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right)}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\sin \left(\lambda_1 + \lambda_2\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 + \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Applied egg-rr95.0%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right) \cdot \sin \left(\lambda_1 - \lambda_2\right)}}} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    7. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    8. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. --lowering--.f6490.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    9. Simplified90.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right) \cdot \sin \left(\lambda_1 - \lambda_2\right)}} \cdot \cos \phi_2}{\color{blue}{1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}} \]
    10. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    11. Step-by-step derivation
      1. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f6470.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    12. Simplified70.5%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_1 \leq 0.95:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 76.2% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\phi_2 \leq 0.085:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0 \cdot \left(\left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right) + \left(\phi_2 \cdot \phi_2\right) \cdot \left(\left(\phi_2 \cdot \phi_2\right) \cdot 0.041666666666666664\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2)))
        (t_1 (* (cos phi2) (sin (- lambda1 lambda2)))))
   (if (<= phi2 0.085)
     (+
      lambda1
      (atan2
       t_1
       (+
        (cos phi1)
        (*
         t_0
         (+
          (+ 1.0 (* -0.5 (* phi2 phi2)))
          (* (* phi2 phi2) (* (* phi2 phi2) 0.041666666666666664)))))))
     (+
      lambda1
      (atan2 t_1 (+ (* (cos phi2) t_0) (+ 1.0 (* phi1 (* phi1 -0.5)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double t_1 = cos(phi2) * sin((lambda1 - lambda2));
	double tmp;
	if (phi2 <= 0.085) {
		tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * ((1.0 + (-0.5 * (phi2 * phi2))) + ((phi2 * phi2) * ((phi2 * phi2) * 0.041666666666666664))))));
	} else {
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = cos((lambda1 - lambda2))
    t_1 = cos(phi2) * sin((lambda1 - lambda2))
    if (phi2 <= 0.085d0) then
        tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * ((1.0d0 + ((-0.5d0) * (phi2 * phi2))) + ((phi2 * phi2) * ((phi2 * phi2) * 0.041666666666666664d0))))))
    else
        tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0d0 + (phi1 * (phi1 * (-0.5d0))))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos((lambda1 - lambda2));
	double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
	double tmp;
	if (phi2 <= 0.085) {
		tmp = lambda1 + Math.atan2(t_1, (Math.cos(phi1) + (t_0 * ((1.0 + (-0.5 * (phi2 * phi2))) + ((phi2 * phi2) * ((phi2 * phi2) * 0.041666666666666664))))));
	} else {
		tmp = lambda1 + Math.atan2(t_1, ((Math.cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos((lambda1 - lambda2))
	t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2))
	tmp = 0
	if phi2 <= 0.085:
		tmp = lambda1 + math.atan2(t_1, (math.cos(phi1) + (t_0 * ((1.0 + (-0.5 * (phi2 * phi2))) + ((phi2 * phi2) * ((phi2 * phi2) * 0.041666666666666664))))))
	else:
		tmp = lambda1 + math.atan2(t_1, ((math.cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2)))
	tmp = 0.0
	if (phi2 <= 0.085)
		tmp = Float64(lambda1 + atan(t_1, Float64(cos(phi1) + Float64(t_0 * Float64(Float64(1.0 + Float64(-0.5 * Float64(phi2 * phi2))) + Float64(Float64(phi2 * phi2) * Float64(Float64(phi2 * phi2) * 0.041666666666666664)))))));
	else
		tmp = Float64(lambda1 + atan(t_1, Float64(Float64(cos(phi2) * t_0) + Float64(1.0 + Float64(phi1 * Float64(phi1 * -0.5))))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos((lambda1 - lambda2));
	t_1 = cos(phi2) * sin((lambda1 - lambda2));
	tmp = 0.0;
	if (phi2 <= 0.085)
		tmp = lambda1 + atan2(t_1, (cos(phi1) + (t_0 * ((1.0 + (-0.5 * (phi2 * phi2))) + ((phi2 * phi2) * ((phi2 * phi2) * 0.041666666666666664))))));
	else
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + (1.0 + (phi1 * (phi1 * -0.5)))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, 0.085], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[Cos[phi1], $MachinePrecision] + N[(t$95$0 * N[(N[(1.0 + N[(-0.5 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(phi2 * phi2), $MachinePrecision] * N[(N[(phi2 * phi2), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + N[(1.0 + N[(phi1 * N[(phi1 * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 0.085:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0 \cdot \left(\left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right) + \left(\phi_2 \cdot \phi_2\right) \cdot \left(\left(\phi_2 \cdot \phi_2\right) \cdot 0.041666666666666664\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi2 < 0.0850000000000000061

    1. Initial program 99.0%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.0%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right) + \frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right) + \frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right) + \frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right)\right) \]
      3. distribute-lft-inN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) + \left({\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) + \color{blue}{{\phi_2}^{2} \cdot \left(\frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right)\right)\right)\right) \]
      4. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\frac{-1}{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + \color{blue}{{\phi_2}^{2} \cdot \left(\frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \frac{-1}{2}\right)\right) + {\phi_2}^{2} \cdot \left(\frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\cos \left(\lambda_1 - \lambda_2\right) + \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \frac{-1}{2}\right) + {\phi_2}^{\color{blue}{2}} \cdot \left(\frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\cos \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + {\phi_2}^{\color{blue}{2}} \cdot \left(\frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\cos \left(\lambda_1 - \lambda_2\right) + \left(\frac{-1}{2} \cdot {\phi_2}^{2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) + {\phi_2}^{\color{blue}{2}} \cdot \left(\frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right)\right) \]
      9. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right) + \color{blue}{{\phi_2}^{2}} \cdot \left(\frac{1}{24} \cdot \left({\phi_2}^{2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right)\right) \]
      10. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right) \cdot \cos \left(\lambda_1 - \lambda_2\right) + {\phi_2}^{2} \cdot \left(\left(\frac{1}{24} \cdot {\phi_2}^{2}\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right)\right) \]
    7. Simplified69.2%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right) + \left(\phi_2 \cdot \phi_2\right) \cdot \left(\left(\phi_2 \cdot \phi_2\right) \cdot 0.041666666666666664\right)\right)}} \]

    if 0.0850000000000000061 < phi2

    1. Initial program 99.2%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.2%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \left(\frac{-1}{2} \cdot {\phi_1}^{2} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right) + \color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \color{blue}{\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot \left(\phi_1 \cdot \color{blue}{\phi_1}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\left(\frac{-1}{2} \cdot \phi_1\right) \cdot \color{blue}{\phi_1}\right)\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\phi_1 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \phi_1\right)}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \color{blue}{\left(\frac{-1}{2} \cdot \phi_1\right)}\right)\right)\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \left(\phi_1 \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6484.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \mathsf{*.f64}\left(\phi_1, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right)\right) \]
    7. Simplified84.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq 0.085:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right) + \left(\phi_2 \cdot \phi_2\right) \cdot \left(\left(\phi_2 \cdot \phi_2\right) \cdot 0.041666666666666664\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 67.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1\\ \mathbf{if}\;\cos \phi_2 \leq 0.3:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{t\_0}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (+ (* (cos phi2) (cos (- lambda1 lambda2))) 1.0)))
   (if (<= (cos phi2) 0.3)
     (+
      lambda1
      (atan2
       (*
        (cos phi2)
        (*
         lambda1
         (+
          1.0
          (*
           (* lambda1 lambda1)
           (+
            (* (* lambda1 lambda1) 0.008333333333333333)
            -0.16666666666666666)))))
       t_0))
     (+ lambda1 (atan2 (sin (- lambda1 lambda2)) t_0)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = (cos(phi2) * cos((lambda1 - lambda2))) + 1.0;
	double tmp;
	if (cos(phi2) <= 0.3) {
		tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), t_0);
	} else {
		tmp = lambda1 + atan2(sin((lambda1 - lambda2)), t_0);
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (cos(phi2) * cos((lambda1 - lambda2))) + 1.0d0
    if (cos(phi2) <= 0.3d0) then
        tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0d0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333d0) + (-0.16666666666666666d0)))))), t_0)
    else
        tmp = lambda1 + atan2(sin((lambda1 - lambda2)), t_0)
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = (Math.cos(phi2) * Math.cos((lambda1 - lambda2))) + 1.0;
	double tmp;
	if (Math.cos(phi2) <= 0.3) {
		tmp = lambda1 + Math.atan2((Math.cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), t_0);
	} else {
		tmp = lambda1 + Math.atan2(Math.sin((lambda1 - lambda2)), t_0);
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = (math.cos(phi2) * math.cos((lambda1 - lambda2))) + 1.0
	tmp = 0
	if math.cos(phi2) <= 0.3:
		tmp = lambda1 + math.atan2((math.cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), t_0)
	else:
		tmp = lambda1 + math.atan2(math.sin((lambda1 - lambda2)), t_0)
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = Float64(Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))) + 1.0)
	tmp = 0.0
	if (cos(phi2) <= 0.3)
		tmp = Float64(lambda1 + atan(Float64(cos(phi2) * Float64(lambda1 * Float64(1.0 + Float64(Float64(lambda1 * lambda1) * Float64(Float64(Float64(lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), t_0));
	else
		tmp = Float64(lambda1 + atan(sin(Float64(lambda1 - lambda2)), t_0));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = (cos(phi2) * cos((lambda1 - lambda2))) + 1.0;
	tmp = 0.0;
	if (cos(phi2) <= 0.3)
		tmp = lambda1 + atan2((cos(phi2) * (lambda1 * (1.0 + ((lambda1 * lambda1) * (((lambda1 * lambda1) * 0.008333333333333333) + -0.16666666666666666))))), t_0);
	else
		tmp = lambda1 + atan2(sin((lambda1 - lambda2)), t_0);
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[N[Cos[phi2], $MachinePrecision], 0.3], N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(lambda1 * N[(1.0 + N[(N[(lambda1 * lambda1), $MachinePrecision] * N[(N[(N[(lambda1 * lambda1), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1\\
\mathbf{if}\;\cos \phi_2 \leq 0.3:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 phi2) < 0.299999999999999989

    1. Initial program 99.4%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.4%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.4%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sin-lowering-sin.f6464.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. Simplified64.5%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    8. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(\lambda_1 \cdot \left(1 + {\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \left(1 + {\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \left({\lambda_1}^{2} \cdot \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({\lambda_1}^{2}\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(\lambda_1 \cdot \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} - \frac{1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \left(\frac{1}{120} \cdot {\lambda_1}^{2} + \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\left(\frac{1}{120} \cdot {\lambda_1}^{2}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\left({\lambda_1}^{2} \cdot \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({\lambda_1}^{2}\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(\lambda_1 \cdot \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f6463.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    10. Simplified63.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    11. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    12. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. --lowering--.f6454.3%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\lambda_1, \lambda_1\right), \frac{1}{120}\right), \frac{-1}{6}\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    13. Simplified54.3%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right) \cdot \cos \phi_2}{\color{blue}{1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}} \]

    if 0.299999999999999989 < (cos.f64 phi2)

    1. Initial program 98.9%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6498.9%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified98.9%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      2. flip--N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \lambda_1 \cdot \cos \lambda_2 + \cos \lambda_1 \cdot \sin \lambda_2}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. sin-sumN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right)}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\sin \left(\lambda_1 + \lambda_2\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 + \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. difference-of-squaresN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Applied egg-rr96.2%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right) \cdot \sin \left(\lambda_1 - \lambda_2\right)}}} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    7. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    8. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. --lowering--.f6478.4%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    9. Simplified78.4%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right) \cdot \sin \left(\lambda_1 - \lambda_2\right)}} \cdot \cos \phi_2}{\color{blue}{1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}} \]
    10. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    11. Step-by-step derivation
      1. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f6472.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    12. Simplified72.5%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_2 \leq 0.3:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot \left(\left(\lambda_1 \cdot \lambda_1\right) \cdot 0.008333333333333333 + -0.16666666666666666\right)\right)\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 82.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\phi_2 \leq 0.045:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}{\cos \phi_1 + t\_0}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_1}{t\_0 + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi2) (cos (- lambda1 lambda2))))
        (t_1 (sin (- lambda1 lambda2))))
   (if (<= phi2 0.045)
     (+
      lambda1
      (atan2 (* t_1 (+ 1.0 (* -0.5 (* phi2 phi2)))) (+ (cos phi1) t_0)))
     (+
      lambda1
      (atan2 (* (cos phi2) t_1) (+ t_0 (+ 1.0 (* phi1 (* phi1 -0.5)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi2) * cos((lambda1 - lambda2));
	double t_1 = sin((lambda1 - lambda2));
	double tmp;
	if (phi2 <= 0.045) {
		tmp = lambda1 + atan2((t_1 * (1.0 + (-0.5 * (phi2 * phi2)))), (cos(phi1) + t_0));
	} else {
		tmp = lambda1 + atan2((cos(phi2) * t_1), (t_0 + (1.0 + (phi1 * (phi1 * -0.5)))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = cos(phi2) * cos((lambda1 - lambda2))
    t_1 = sin((lambda1 - lambda2))
    if (phi2 <= 0.045d0) then
        tmp = lambda1 + atan2((t_1 * (1.0d0 + ((-0.5d0) * (phi2 * phi2)))), (cos(phi1) + t_0))
    else
        tmp = lambda1 + atan2((cos(phi2) * t_1), (t_0 + (1.0d0 + (phi1 * (phi1 * (-0.5d0))))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos(phi2) * Math.cos((lambda1 - lambda2));
	double t_1 = Math.sin((lambda1 - lambda2));
	double tmp;
	if (phi2 <= 0.045) {
		tmp = lambda1 + Math.atan2((t_1 * (1.0 + (-0.5 * (phi2 * phi2)))), (Math.cos(phi1) + t_0));
	} else {
		tmp = lambda1 + Math.atan2((Math.cos(phi2) * t_1), (t_0 + (1.0 + (phi1 * (phi1 * -0.5)))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos(phi2) * math.cos((lambda1 - lambda2))
	t_1 = math.sin((lambda1 - lambda2))
	tmp = 0
	if phi2 <= 0.045:
		tmp = lambda1 + math.atan2((t_1 * (1.0 + (-0.5 * (phi2 * phi2)))), (math.cos(phi1) + t_0))
	else:
		tmp = lambda1 + math.atan2((math.cos(phi2) * t_1), (t_0 + (1.0 + (phi1 * (phi1 * -0.5)))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi2) * cos(Float64(lambda1 - lambda2)))
	t_1 = sin(Float64(lambda1 - lambda2))
	tmp = 0.0
	if (phi2 <= 0.045)
		tmp = Float64(lambda1 + atan(Float64(t_1 * Float64(1.0 + Float64(-0.5 * Float64(phi2 * phi2)))), Float64(cos(phi1) + t_0)));
	else
		tmp = Float64(lambda1 + atan(Float64(cos(phi2) * t_1), Float64(t_0 + Float64(1.0 + Float64(phi1 * Float64(phi1 * -0.5))))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(phi2) * cos((lambda1 - lambda2));
	t_1 = sin((lambda1 - lambda2));
	tmp = 0.0;
	if (phi2 <= 0.045)
		tmp = lambda1 + atan2((t_1 * (1.0 + (-0.5 * (phi2 * phi2)))), (cos(phi1) + t_0));
	else
		tmp = lambda1 + atan2((cos(phi2) * t_1), (t_0 + (1.0 + (phi1 * (phi1 * -0.5)))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, 0.045], N[(lambda1 + N[ArcTan[N[(t$95$1 * N[(1.0 + N[(-0.5 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision] / N[(t$95$0 + N[(1.0 + N[(phi1 * N[(phi1 * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq 0.045:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1 \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}{\cos \phi_1 + t\_0}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_1}{t\_0 + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi2 < 0.044999999999999998

    1. Initial program 99.0%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.0%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.0%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\left(\sin \left(\lambda_1 - \lambda_2\right) + \frac{-1}{2} \cdot \left({\phi_2}^{2} \cdot \sin \left(\lambda_1 - \lambda_2\right)\right)\right)}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) + \left(\frac{-1}{2} \cdot {\phi_2}^{2}\right) \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      2. distribute-rgt1-inN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right) \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      5. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_2}^{2}\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {\phi_2}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({\phi_2}^{2}\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(\phi_2 \cdot \phi_2\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f6479.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. Simplified79.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]

    if 0.044999999999999998 < phi2

    1. Initial program 99.2%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.2%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \left(\frac{-1}{2} \cdot {\phi_1}^{2} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right) + \color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \color{blue}{\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \left(\color{blue}{1} + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \left(1 + \frac{-1}{2} \cdot {\phi_1}^{2}\right)\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{2} \cdot {\phi_1}^{2}\right)}\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot \left(\phi_1 \cdot \color{blue}{\phi_1}\right)\right)\right)\right)\right)\right) \]
      10. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\left(\frac{-1}{2} \cdot \phi_1\right) \cdot \color{blue}{\phi_1}\right)\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \left(\phi_1 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \phi_1\right)}\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \color{blue}{\left(\frac{-1}{2} \cdot \phi_1\right)}\right)\right)\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \left(\phi_1 \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6484.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\phi_1, \mathsf{*.f64}\left(\phi_1, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right)\right) \]
    7. Simplified84.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq 0.045:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(1 + -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \left(1 + \phi_1 \cdot \left(\phi_1 \cdot -0.5\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 83.3% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\phi_1 \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + 1}\\ \mathbf{elif}\;\phi_1 \leq 2.7 \cdot 10^{+227}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2)))
        (t_1 (* (cos phi2) (sin (- lambda1 lambda2)))))
   (if (<= phi1 8.5e-6)
     (+ lambda1 (atan2 t_1 (+ (* (cos phi2) t_0) 1.0)))
     (if (<= phi1 2.7e+227)
       (+ lambda1 (atan2 t_1 (+ (cos phi2) (cos phi1))))
       (+ lambda1 (atan2 t_1 (+ (cos phi1) t_0)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double t_1 = cos(phi2) * sin((lambda1 - lambda2));
	double tmp;
	if (phi1 <= 8.5e-6) {
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + 1.0));
	} else if (phi1 <= 2.7e+227) {
		tmp = lambda1 + atan2(t_1, (cos(phi2) + cos(phi1)));
	} else {
		tmp = lambda1 + atan2(t_1, (cos(phi1) + t_0));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = cos((lambda1 - lambda2))
    t_1 = cos(phi2) * sin((lambda1 - lambda2))
    if (phi1 <= 8.5d-6) then
        tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + 1.0d0))
    else if (phi1 <= 2.7d+227) then
        tmp = lambda1 + atan2(t_1, (cos(phi2) + cos(phi1)))
    else
        tmp = lambda1 + atan2(t_1, (cos(phi1) + t_0))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos((lambda1 - lambda2));
	double t_1 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
	double tmp;
	if (phi1 <= 8.5e-6) {
		tmp = lambda1 + Math.atan2(t_1, ((Math.cos(phi2) * t_0) + 1.0));
	} else if (phi1 <= 2.7e+227) {
		tmp = lambda1 + Math.atan2(t_1, (Math.cos(phi2) + Math.cos(phi1)));
	} else {
		tmp = lambda1 + Math.atan2(t_1, (Math.cos(phi1) + t_0));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos((lambda1 - lambda2))
	t_1 = math.cos(phi2) * math.sin((lambda1 - lambda2))
	tmp = 0
	if phi1 <= 8.5e-6:
		tmp = lambda1 + math.atan2(t_1, ((math.cos(phi2) * t_0) + 1.0))
	elif phi1 <= 2.7e+227:
		tmp = lambda1 + math.atan2(t_1, (math.cos(phi2) + math.cos(phi1)))
	else:
		tmp = lambda1 + math.atan2(t_1, (math.cos(phi1) + t_0))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	t_1 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2)))
	tmp = 0.0
	if (phi1 <= 8.5e-6)
		tmp = Float64(lambda1 + atan(t_1, Float64(Float64(cos(phi2) * t_0) + 1.0)));
	elseif (phi1 <= 2.7e+227)
		tmp = Float64(lambda1 + atan(t_1, Float64(cos(phi2) + cos(phi1))));
	else
		tmp = Float64(lambda1 + atan(t_1, Float64(cos(phi1) + t_0)));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos((lambda1 - lambda2));
	t_1 = cos(phi2) * sin((lambda1 - lambda2));
	tmp = 0.0;
	if (phi1 <= 8.5e-6)
		tmp = lambda1 + atan2(t_1, ((cos(phi2) * t_0) + 1.0));
	elseif (phi1 <= 2.7e+227)
		tmp = lambda1 + atan2(t_1, (cos(phi2) + cos(phi1)));
	else
		tmp = lambda1 + atan2(t_1, (cos(phi1) + t_0));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, 8.5e-6], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 2.7e+227], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[Cos[phi2], $MachinePrecision] + N[Cos[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[Cos[phi1], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq 8.5 \cdot 10^{-6}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 \cdot t\_0 + 1}\\

\mathbf{elif}\;\phi_1 \leq 2.7 \cdot 10^{+227}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 + \cos \phi_1}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_1 + t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi1 < 8.4999999999999999e-6

    1. Initial program 99.2%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.2%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + \color{blue}{1}\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{1}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), 1\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), 1\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), 1\right)\right)\right) \]
      6. --lowering--.f6485.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), 1\right)\right)\right) \]
    7. Simplified85.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}} \]

    if 8.4999999999999999e-6 < phi1 < 2.6999999999999998e227

    1. Initial program 98.5%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6498.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified98.5%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6497.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified97.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 + \color{blue}{\cos \phi_1}\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_2, \color{blue}{\cos \phi_1}\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\phi_1}\right)\right)\right) \]
      4. cos-lowering-cos.f6479.9%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\phi_1\right)\right)\right)\right) \]
    10. Simplified79.9%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 + \cos \phi_1}} \]

    if 2.6999999999999998e227 < phi1

    1. Initial program 99.5%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      4. --lowering--.f6488.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified88.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq 8.5 \cdot 10^{-6}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\ \mathbf{elif}\;\phi_1 \leq 2.7 \cdot 10^{+227}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 82.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\phi_1 \leq 2.3 \cdot 10^{-5}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \lambda_2 \cdot \cos \phi_2 + 1}\\ \mathbf{elif}\;\phi_1 \leq 2.3 \cdot 10^{+228}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi2) (sin (- lambda1 lambda2)))))
   (if (<= phi1 2.3e-5)
     (+ lambda1 (atan2 t_0 (+ (* (cos lambda2) (cos phi2)) 1.0)))
     (if (<= phi1 2.3e+228)
       (+ lambda1 (atan2 t_0 (+ (cos phi2) (cos phi1))))
       (+ lambda1 (atan2 t_0 (+ (cos phi1) (cos (- lambda1 lambda2)))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi2) * sin((lambda1 - lambda2));
	double tmp;
	if (phi1 <= 2.3e-5) {
		tmp = lambda1 + atan2(t_0, ((cos(lambda2) * cos(phi2)) + 1.0));
	} else if (phi1 <= 2.3e+228) {
		tmp = lambda1 + atan2(t_0, (cos(phi2) + cos(phi1)));
	} else {
		tmp = lambda1 + atan2(t_0, (cos(phi1) + cos((lambda1 - lambda2))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos(phi2) * sin((lambda1 - lambda2))
    if (phi1 <= 2.3d-5) then
        tmp = lambda1 + atan2(t_0, ((cos(lambda2) * cos(phi2)) + 1.0d0))
    else if (phi1 <= 2.3d+228) then
        tmp = lambda1 + atan2(t_0, (cos(phi2) + cos(phi1)))
    else
        tmp = lambda1 + atan2(t_0, (cos(phi1) + cos((lambda1 - lambda2))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos(phi2) * Math.sin((lambda1 - lambda2));
	double tmp;
	if (phi1 <= 2.3e-5) {
		tmp = lambda1 + Math.atan2(t_0, ((Math.cos(lambda2) * Math.cos(phi2)) + 1.0));
	} else if (phi1 <= 2.3e+228) {
		tmp = lambda1 + Math.atan2(t_0, (Math.cos(phi2) + Math.cos(phi1)));
	} else {
		tmp = lambda1 + Math.atan2(t_0, (Math.cos(phi1) + Math.cos((lambda1 - lambda2))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos(phi2) * math.sin((lambda1 - lambda2))
	tmp = 0
	if phi1 <= 2.3e-5:
		tmp = lambda1 + math.atan2(t_0, ((math.cos(lambda2) * math.cos(phi2)) + 1.0))
	elif phi1 <= 2.3e+228:
		tmp = lambda1 + math.atan2(t_0, (math.cos(phi2) + math.cos(phi1)))
	else:
		tmp = lambda1 + math.atan2(t_0, (math.cos(phi1) + math.cos((lambda1 - lambda2))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2)))
	tmp = 0.0
	if (phi1 <= 2.3e-5)
		tmp = Float64(lambda1 + atan(t_0, Float64(Float64(cos(lambda2) * cos(phi2)) + 1.0)));
	elseif (phi1 <= 2.3e+228)
		tmp = Float64(lambda1 + atan(t_0, Float64(cos(phi2) + cos(phi1))));
	else
		tmp = Float64(lambda1 + atan(t_0, Float64(cos(phi1) + cos(Float64(lambda1 - lambda2)))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(phi2) * sin((lambda1 - lambda2));
	tmp = 0.0;
	if (phi1 <= 2.3e-5)
		tmp = lambda1 + atan2(t_0, ((cos(lambda2) * cos(phi2)) + 1.0));
	elseif (phi1 <= 2.3e+228)
		tmp = lambda1 + atan2(t_0, (cos(phi2) + cos(phi1)));
	else
		tmp = lambda1 + atan2(t_0, (cos(phi1) + cos((lambda1 - lambda2))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, 2.3e-5], N[(lambda1 + N[ArcTan[t$95$0 / N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 2.3e+228], N[(lambda1 + N[ArcTan[t$95$0 / N[(N[Cos[phi2], $MachinePrecision] + N[Cos[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$0 / N[(N[Cos[phi1], $MachinePrecision] + N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_1 \leq 2.3 \cdot 10^{-5}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \lambda_2 \cdot \cos \phi_2 + 1}\\

\mathbf{elif}\;\phi_1 \leq 2.3 \cdot 10^{+228}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_2 + \cos \phi_1}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi1 < 2.3e-5

    1. Initial program 99.2%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.2%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6498.0%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified98.0%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \lambda_2 \cdot \cos \phi_2\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\cos \lambda_2 \cdot \cos \phi_2\right)}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \left(\cos \phi_2 \cdot \color{blue}{\cos \lambda_2}\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \lambda_2}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\lambda_2}\right)\right)\right)\right) \]
      5. cos-lowering-cos.f6484.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    10. Simplified84.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{1 + \cos \phi_2 \cdot \cos \lambda_2}} \]

    if 2.3e-5 < phi1 < 2.30000000000000013e228

    1. Initial program 98.5%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6498.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified98.5%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6497.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified97.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 + \color{blue}{\cos \phi_1}\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_2, \color{blue}{\cos \phi_1}\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\phi_1}\right)\right)\right) \]
      4. cos-lowering-cos.f6479.9%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\phi_1\right)\right)\right)\right) \]
    10. Simplified79.9%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 + \cos \phi_1}} \]

    if 2.30000000000000013e228 < phi1

    1. Initial program 99.5%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      4. --lowering--.f6488.8%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified88.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq 2.3 \cdot 10^{-5}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \lambda_2 \cdot \cos \phi_2 + 1}\\ \mathbf{elif}\;\phi_1 \leq 2.3 \cdot 10^{+228}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 82.8% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\ t_1 := \cos \phi_2 \cdot t\_0\\ \mathbf{if}\;\phi_1 \leq 8 \cdot 10^{-6}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \lambda_2 \cdot \cos \phi_2 + 1}\\ \mathbf{elif}\;\phi_1 \leq 8.5 \cdot 10^{+226}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (- lambda1 lambda2))) (t_1 (* (cos phi2) t_0)))
   (if (<= phi1 8e-6)
     (+ lambda1 (atan2 t_1 (+ (* (cos lambda2) (cos phi2)) 1.0)))
     (if (<= phi1 8.5e+226)
       (+ lambda1 (atan2 t_1 (+ (cos phi2) (cos phi1))))
       (+
        lambda1
        (atan2
         t_0
         (+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((lambda1 - lambda2));
	double t_1 = cos(phi2) * t_0;
	double tmp;
	if (phi1 <= 8e-6) {
		tmp = lambda1 + atan2(t_1, ((cos(lambda2) * cos(phi2)) + 1.0));
	} else if (phi1 <= 8.5e+226) {
		tmp = lambda1 + atan2(t_1, (cos(phi2) + cos(phi1)));
	} else {
		tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sin((lambda1 - lambda2))
    t_1 = cos(phi2) * t_0
    if (phi1 <= 8d-6) then
        tmp = lambda1 + atan2(t_1, ((cos(lambda2) * cos(phi2)) + 1.0d0))
    else if (phi1 <= 8.5d+226) then
        tmp = lambda1 + atan2(t_1, (cos(phi2) + cos(phi1)))
    else
        tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin((lambda1 - lambda2));
	double t_1 = Math.cos(phi2) * t_0;
	double tmp;
	if (phi1 <= 8e-6) {
		tmp = lambda1 + Math.atan2(t_1, ((Math.cos(lambda2) * Math.cos(phi2)) + 1.0));
	} else if (phi1 <= 8.5e+226) {
		tmp = lambda1 + Math.atan2(t_1, (Math.cos(phi2) + Math.cos(phi1)));
	} else {
		tmp = lambda1 + Math.atan2(t_0, (Math.cos(phi1) + (Math.cos(phi2) * Math.cos((lambda1 - lambda2)))));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.sin((lambda1 - lambda2))
	t_1 = math.cos(phi2) * t_0
	tmp = 0
	if phi1 <= 8e-6:
		tmp = lambda1 + math.atan2(t_1, ((math.cos(lambda2) * math.cos(phi2)) + 1.0))
	elif phi1 <= 8.5e+226:
		tmp = lambda1 + math.atan2(t_1, (math.cos(phi2) + math.cos(phi1)))
	else:
		tmp = lambda1 + math.atan2(t_0, (math.cos(phi1) + (math.cos(phi2) * math.cos((lambda1 - lambda2)))))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(lambda1 - lambda2))
	t_1 = Float64(cos(phi2) * t_0)
	tmp = 0.0
	if (phi1 <= 8e-6)
		tmp = Float64(lambda1 + atan(t_1, Float64(Float64(cos(lambda2) * cos(phi2)) + 1.0)));
	elseif (phi1 <= 8.5e+226)
		tmp = Float64(lambda1 + atan(t_1, Float64(cos(phi2) + cos(phi1))));
	else
		tmp = Float64(lambda1 + atan(t_0, Float64(cos(phi1) + Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = sin((lambda1 - lambda2));
	t_1 = cos(phi2) * t_0;
	tmp = 0.0;
	if (phi1 <= 8e-6)
		tmp = lambda1 + atan2(t_1, ((cos(lambda2) * cos(phi2)) + 1.0));
	elseif (phi1 <= 8.5e+226)
		tmp = lambda1 + atan2(t_1, (cos(phi2) + cos(phi1)));
	else
		tmp = lambda1 + atan2(t_0, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[phi1, 8e-6], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 8.5e+226], N[(lambda1 + N[ArcTan[t$95$1 / N[(N[Cos[phi2], $MachinePrecision] + N[Cos[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[t$95$0 / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
t_1 := \cos \phi_2 \cdot t\_0\\
\mathbf{if}\;\phi_1 \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \lambda_2 \cdot \cos \phi_2 + 1}\\

\mathbf{elif}\;\phi_1 \leq 8.5 \cdot 10^{+226}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos \phi_2 + \cos \phi_1}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_0}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi1 < 7.99999999999999964e-6

    1. Initial program 99.2%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.2%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.2%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6498.0%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified98.0%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in phi1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \lambda_2 \cdot \cos \phi_2\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\cos \lambda_2 \cdot \cos \phi_2\right)}\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \left(\cos \phi_2 \cdot \color{blue}{\cos \lambda_2}\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \lambda_2}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\lambda_2}\right)\right)\right)\right) \]
      5. cos-lowering-cos.f6484.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    10. Simplified84.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{1 + \cos \phi_2 \cdot \cos \lambda_2}} \]

    if 7.99999999999999964e-6 < phi1 < 8.49999999999999974e226

    1. Initial program 98.5%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6498.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified98.5%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)}\right)\right)\right) \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
      5. cos-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right)\right)\right)\right) \]
      6. cos-lowering-cos.f6497.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
    7. Simplified97.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_1 + \cos \phi_2 \cdot \cos \lambda_2}} \]
    8. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2\right)}\right)\right) \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 + \color{blue}{\cos \phi_1}\right)\right)\right) \]
      2. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_2, \color{blue}{\cos \phi_1}\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\phi_1}\right)\right)\right) \]
      4. cos-lowering-cos.f6479.9%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\phi_1\right)\right)\right)\right) \]
    10. Simplified79.9%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \phi_2 + \cos \phi_1}} \]

    if 8.49999999999999974e226 < phi1

    1. Initial program 99.5%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      2. --lowering--.f6488.7%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. Simplified88.7%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq 8 \cdot 10^{-6}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \lambda_2 \cdot \cos \phi_2 + 1}\\ \mathbf{elif}\;\phi_1 \leq 8.5 \cdot 10^{+226}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 + \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 68.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\cos \phi_1 \leq 0.918:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\lambda_1}{\cos \phi_1 + t\_0}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{t\_0 + 1}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi2) (cos (- lambda1 lambda2)))))
   (if (<= (cos phi1) 0.918)
     (+ lambda1 (atan2 lambda1 (+ (cos phi1) t_0)))
     (+ lambda1 (atan2 (sin (- lambda1 lambda2)) (+ t_0 1.0))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi2) * cos((lambda1 - lambda2));
	double tmp;
	if (cos(phi1) <= 0.918) {
		tmp = lambda1 + atan2(lambda1, (cos(phi1) + t_0));
	} else {
		tmp = lambda1 + atan2(sin((lambda1 - lambda2)), (t_0 + 1.0));
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos(phi2) * cos((lambda1 - lambda2))
    if (cos(phi1) <= 0.918d0) then
        tmp = lambda1 + atan2(lambda1, (cos(phi1) + t_0))
    else
        tmp = lambda1 + atan2(sin((lambda1 - lambda2)), (t_0 + 1.0d0))
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos(phi2) * Math.cos((lambda1 - lambda2));
	double tmp;
	if (Math.cos(phi1) <= 0.918) {
		tmp = lambda1 + Math.atan2(lambda1, (Math.cos(phi1) + t_0));
	} else {
		tmp = lambda1 + Math.atan2(Math.sin((lambda1 - lambda2)), (t_0 + 1.0));
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.cos(phi2) * math.cos((lambda1 - lambda2))
	tmp = 0
	if math.cos(phi1) <= 0.918:
		tmp = lambda1 + math.atan2(lambda1, (math.cos(phi1) + t_0))
	else:
		tmp = lambda1 + math.atan2(math.sin((lambda1 - lambda2)), (t_0 + 1.0))
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi2) * cos(Float64(lambda1 - lambda2)))
	tmp = 0.0
	if (cos(phi1) <= 0.918)
		tmp = Float64(lambda1 + atan(lambda1, Float64(cos(phi1) + t_0)));
	else
		tmp = Float64(lambda1 + atan(sin(Float64(lambda1 - lambda2)), Float64(t_0 + 1.0)));
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(phi2) * cos((lambda1 - lambda2));
	tmp = 0.0;
	if (cos(phi1) <= 0.918)
		tmp = lambda1 + atan2(lambda1, (cos(phi1) + t_0));
	else
		tmp = lambda1 + atan2(sin((lambda1 - lambda2)), (t_0 + 1.0));
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[phi1], $MachinePrecision], 0.918], N[(lambda1 + N[ArcTan[lambda1 / N[(N[Cos[phi1], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\cos \phi_1 \leq 0.918:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\lambda_1}{\cos \phi_1 + t\_0}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{t\_0 + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 phi1) < 0.918000000000000038

    1. Initial program 99.7%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sin-lowering-sin.f6467.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. Simplified67.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    8. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. sin-lowering-sin.f6459.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    10. Simplified59.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    11. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    12. Step-by-step derivation
      1. Simplified59.2%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]

      if 0.918000000000000038 < (cos.f64 phi1)

      1. Initial program 98.7%

        \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
        2. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        4. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        6. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
        13. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
        15. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
        16. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
        17. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
        18. cos-lowering-cos.f6498.7%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. Simplified98.7%

        \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. sin-diffN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        2. flip--N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \lambda_1 \cdot \cos \lambda_2 + \cos \lambda_1 \cdot \sin \lambda_2}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        3. sin-sumN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right)}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        4. clear-numN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}}\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)}\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        6. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\sin \left(\lambda_1 + \lambda_2\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        7. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 + \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2\right) - \left(\cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        9. difference-of-squaresN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. Applied egg-rr95.1%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right) \cdot \sin \left(\lambda_1 - \lambda_2\right)}}} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      7. Taylor expanded in phi1 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      8. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        3. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        4. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
        5. --lowering--.f6489.5%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{+.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      9. Simplified89.5%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\frac{1}{\frac{\sin \left(\lambda_1 + \lambda_2\right)}{\sin \left(\lambda_1 + \lambda_2\right) \cdot \sin \left(\lambda_1 - \lambda_2\right)}} \cdot \cos \phi_2}{\color{blue}{1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}} \]
      10. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      11. Step-by-step derivation
        1. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{+.f64}\left(\color{blue}{1}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        2. --lowering--.f6469.3%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      12. Simplified69.3%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    13. Recombined 2 regimes into one program.
    14. Final simplification65.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \phi_1 \leq 0.918:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\lambda_1}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right) + 1}\\ \end{array} \]
    15. Add Preprocessing

    Alternative 19: 58.7% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\lambda_1}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
    (FPCore (lambda1 lambda2 phi1 phi2)
     :precision binary64
     (+
      lambda1
      (atan2 lambda1 (+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))
    double code(double lambda1, double lambda2, double phi1, double phi2) {
    	return lambda1 + atan2(lambda1, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
    }
    
    real(8) function code(lambda1, lambda2, phi1, phi2)
        real(8), intent (in) :: lambda1
        real(8), intent (in) :: lambda2
        real(8), intent (in) :: phi1
        real(8), intent (in) :: phi2
        code = lambda1 + atan2(lambda1, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))))
    end function
    
    public static double code(double lambda1, double lambda2, double phi1, double phi2) {
    	return lambda1 + Math.atan2(lambda1, (Math.cos(phi1) + (Math.cos(phi2) * Math.cos((lambda1 - lambda2)))));
    }
    
    def code(lambda1, lambda2, phi1, phi2):
    	return lambda1 + math.atan2(lambda1, (math.cos(phi1) + (math.cos(phi2) * math.cos((lambda1 - lambda2)))))
    
    function code(lambda1, lambda2, phi1, phi2)
    	return Float64(lambda1 + atan(lambda1, Float64(cos(phi1) + Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))))
    end
    
    function tmp = code(lambda1, lambda2, phi1, phi2)
    	tmp = lambda1 + atan2(lambda1, (cos(phi1) + (cos(phi2) * cos((lambda1 - lambda2)))));
    end
    
    code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[lambda1 / N[(N[Cos[phi1], $MachinePrecision] + N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \lambda_1 + \tan^{-1}_* \frac{\lambda_1}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}
    \end{array}
    
    Derivation
    1. Initial program 99.1%

      \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
      2. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      4. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
      13. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      15. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
      16. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
      17. remove-double-negN/A

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
      18. cos-lowering-cos.f6499.1%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    3. Simplified99.1%

      \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
    4. Add Preprocessing
    5. Taylor expanded in lambda2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sin-lowering-sin.f6460.3%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    7. Simplified60.3%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    8. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    9. Step-by-step derivation
      1. sin-lowering-sin.f6453.6%

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    10. Simplified53.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
    11. Taylor expanded in lambda1 around 0

      \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
    12. Step-by-step derivation
      1. Simplified52.9%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      2. Final simplification52.9%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\lambda_1}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      3. Add Preprocessing

      Alternative 20: 58.1% accurate, 1.5× speedup?

      \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (+ lambda1 (atan2 (sin lambda1) (+ (cos phi1) (cos (- lambda1 lambda2))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return lambda1 + atan2(sin(lambda1), (cos(phi1) + cos((lambda1 - lambda2))));
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          code = lambda1 + atan2(sin(lambda1), (cos(phi1) + cos((lambda1 - lambda2))))
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return lambda1 + Math.atan2(Math.sin(lambda1), (Math.cos(phi1) + Math.cos((lambda1 - lambda2))));
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	return lambda1 + math.atan2(math.sin(lambda1), (math.cos(phi1) + math.cos((lambda1 - lambda2))))
      
      function code(lambda1, lambda2, phi1, phi2)
      	return Float64(lambda1 + atan(sin(lambda1), Float64(cos(phi1) + cos(Float64(lambda1 - lambda2)))))
      end
      
      function tmp = code(lambda1, lambda2, phi1, phi2)
      	tmp = lambda1 + atan2(sin(lambda1), (cos(phi1) + cos((lambda1 - lambda2))));
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}
      \end{array}
      
      Derivation
      1. Initial program 99.1%

        \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
        2. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        4. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        6. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
        13. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
        15. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
        16. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
        17. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
        18. cos-lowering-cos.f6499.1%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. Simplified99.1%

        \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
      4. Add Preprocessing
      5. Taylor expanded in lambda2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. sin-lowering-sin.f6460.3%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. Simplified60.3%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      8. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. Step-by-step derivation
        1. sin-lowering-sin.f6453.6%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      10. Simplified53.6%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      11. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \color{blue}{\left(\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
        2. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
        3. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        4. --lowering--.f6452.5%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
      13. Simplified52.5%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}} \]
      14. Add Preprocessing

      Alternative 21: 57.7% accurate, 1.5× speedup?

      \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\cos \lambda_1 + \cos \phi_1} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (+ lambda1 (atan2 (sin lambda1) (+ (cos lambda1) (cos phi1)))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return lambda1 + atan2(sin(lambda1), (cos(lambda1) + cos(phi1)));
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          code = lambda1 + atan2(sin(lambda1), (cos(lambda1) + cos(phi1)))
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return lambda1 + Math.atan2(Math.sin(lambda1), (Math.cos(lambda1) + Math.cos(phi1)));
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	return lambda1 + math.atan2(math.sin(lambda1), (math.cos(lambda1) + math.cos(phi1)))
      
      function code(lambda1, lambda2, phi1, phi2)
      	return Float64(lambda1 + atan(sin(lambda1), Float64(cos(lambda1) + cos(phi1))))
      end
      
      function tmp = code(lambda1, lambda2, phi1, phi2)
      	tmp = lambda1 + atan2(sin(lambda1), (cos(lambda1) + cos(phi1)));
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[Sin[lambda1], $MachinePrecision] / N[(N[Cos[lambda1], $MachinePrecision] + N[Cos[phi1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\cos \lambda_1 + \cos \phi_1}
      \end{array}
      
      Derivation
      1. Initial program 99.1%

        \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
        2. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        4. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        6. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
        13. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
        15. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
        16. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
        17. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
        18. cos-lowering-cos.f6499.1%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. Simplified99.1%

        \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
      4. Add Preprocessing
      5. Taylor expanded in lambda2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. sin-lowering-sin.f6460.3%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. Simplified60.3%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      8. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. Step-by-step derivation
        1. sin-lowering-sin.f6453.6%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      10. Simplified53.6%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      11. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \color{blue}{\left(\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
        2. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
        3. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        4. --lowering--.f6452.5%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
      13. Simplified52.5%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}} \]
      14. Taylor expanded in lambda2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \color{blue}{\cos \lambda_1}\right)\right)\right) \]
      15. Step-by-step derivation
        1. cos-lowering-cos.f6452.3%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right) \]
      16. Simplified52.3%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\cos \phi_1 + \color{blue}{\cos \lambda_1}} \]
      17. Final simplification52.3%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\cos \lambda_1 + \cos \phi_1} \]
      18. Add Preprocessing

      Alternative 22: 57.8% accurate, 1.9× speedup?

      \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot -0.16666666666666666\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (+
        lambda1
        (atan2
         (* lambda1 (+ 1.0 (* (* lambda1 lambda1) -0.16666666666666666)))
         (+ (cos phi1) (cos (- lambda1 lambda2))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return lambda1 + atan2((lambda1 * (1.0 + ((lambda1 * lambda1) * -0.16666666666666666))), (cos(phi1) + cos((lambda1 - lambda2))));
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          code = lambda1 + atan2((lambda1 * (1.0d0 + ((lambda1 * lambda1) * (-0.16666666666666666d0)))), (cos(phi1) + cos((lambda1 - lambda2))))
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return lambda1 + Math.atan2((lambda1 * (1.0 + ((lambda1 * lambda1) * -0.16666666666666666))), (Math.cos(phi1) + Math.cos((lambda1 - lambda2))));
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	return lambda1 + math.atan2((lambda1 * (1.0 + ((lambda1 * lambda1) * -0.16666666666666666))), (math.cos(phi1) + math.cos((lambda1 - lambda2))))
      
      function code(lambda1, lambda2, phi1, phi2)
      	return Float64(lambda1 + atan(Float64(lambda1 * Float64(1.0 + Float64(Float64(lambda1 * lambda1) * -0.16666666666666666))), Float64(cos(phi1) + cos(Float64(lambda1 - lambda2)))))
      end
      
      function tmp = code(lambda1, lambda2, phi1, phi2)
      	tmp = lambda1 + atan2((lambda1 * (1.0 + ((lambda1 * lambda1) * -0.16666666666666666))), (cos(phi1) + cos((lambda1 - lambda2))));
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[N[(lambda1 * N[(1.0 + N[(N[(lambda1 * lambda1), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[phi1], $MachinePrecision] + N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \lambda_1 + \tan^{-1}_* \frac{\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot -0.16666666666666666\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}
      \end{array}
      
      Derivation
      1. Initial program 99.1%

        \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
        2. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        4. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        6. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
        13. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
        15. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
        16. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
        17. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
        18. cos-lowering-cos.f6499.1%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. Simplified99.1%

        \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
      4. Add Preprocessing
      5. Taylor expanded in lambda2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. sin-lowering-sin.f6460.3%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. Simplified60.3%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      8. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. Step-by-step derivation
        1. sin-lowering-sin.f6453.6%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      10. Simplified53.6%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      11. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \color{blue}{\left(\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
        2. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
        3. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        4. --lowering--.f6452.5%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
      13. Simplified52.5%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}} \]
      14. Taylor expanded in lambda1 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\left(\lambda_1 \cdot \left(1 + \frac{-1}{6} \cdot {\lambda_1}^{2}\right)\right)}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
      15. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\lambda_1, \left(1 + \frac{-1}{6} \cdot {\lambda_1}^{2}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
        2. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \left(\frac{-1}{6} \cdot {\lambda_1}^{2}\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \left({\lambda_1}^{2}\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
        4. unpow2N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \left(\lambda_1 \cdot \lambda_1\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
        5. *-lowering-*.f6452.0%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\lambda_1, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\lambda_1, \lambda_1\right)\right)\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
      16. Simplified52.0%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\lambda_1 \cdot \left(1 + -0.16666666666666666 \cdot \left(\lambda_1 \cdot \lambda_1\right)\right)}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)} \]
      17. Final simplification52.0%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\lambda_1 \cdot \left(1 + \left(\lambda_1 \cdot \lambda_1\right) \cdot -0.16666666666666666\right)}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)} \]
      18. Add Preprocessing

      Alternative 23: 57.8% accurate, 2.0× speedup?

      \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\lambda_1}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (+ lambda1 (atan2 lambda1 (+ (cos phi1) (cos (- lambda1 lambda2))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return lambda1 + atan2(lambda1, (cos(phi1) + cos((lambda1 - lambda2))));
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          code = lambda1 + atan2(lambda1, (cos(phi1) + cos((lambda1 - lambda2))))
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return lambda1 + Math.atan2(lambda1, (Math.cos(phi1) + Math.cos((lambda1 - lambda2))));
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	return lambda1 + math.atan2(lambda1, (math.cos(phi1) + math.cos((lambda1 - lambda2))))
      
      function code(lambda1, lambda2, phi1, phi2)
      	return Float64(lambda1 + atan(lambda1, Float64(cos(phi1) + cos(Float64(lambda1 - lambda2)))))
      end
      
      function tmp = code(lambda1, lambda2, phi1, phi2)
      	tmp = lambda1 + atan2(lambda1, (cos(phi1) + cos((lambda1 - lambda2))));
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := N[(lambda1 + N[ArcTan[lambda1 / N[(N[Cos[phi1], $MachinePrecision] + N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \lambda_1 + \tan^{-1}_* \frac{\lambda_1}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}
      \end{array}
      
      Derivation
      1. Initial program 99.1%

        \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
        2. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        3. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        4. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        6. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
        13. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
        15. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
        16. --lowering--.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
        17. remove-double-negN/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
        18. cos-lowering-cos.f6499.1%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      3. Simplified99.1%

        \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
      4. Add Preprocessing
      5. Taylor expanded in lambda2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. sin-lowering-sin.f6460.3%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      7. Simplified60.3%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      8. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      9. Step-by-step derivation
        1. sin-lowering-sin.f6453.6%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
      10. Simplified53.6%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2} \]
      11. Taylor expanded in phi2 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \color{blue}{\left(\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
        2. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
        3. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
        4. --lowering--.f6452.5%

          \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
      13. Simplified52.5%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin \lambda_1}{\color{blue}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)}} \]
      14. Taylor expanded in lambda1 around 0

        \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\color{blue}{\lambda_1}, \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right) \]
      15. Step-by-step derivation
        1. Simplified51.8%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\lambda_1}}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Add Preprocessing

        Alternative 24: 52.7% accurate, 614.0× speedup?

        \[\begin{array}{l} \\ \lambda_1 \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2) :precision binary64 lambda1)
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	return lambda1;
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            code = lambda1
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	return lambda1;
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	return lambda1
        
        function code(lambda1, lambda2, phi1, phi2)
        	return lambda1
        end
        
        function tmp = code(lambda1, lambda2, phi1, phi2)
        	tmp = lambda1;
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := lambda1
        
        \begin{array}{l}
        
        \\
        \lambda_1
        \end{array}
        
        Derivation
        1. Initial program 99.1%

          \[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \color{blue}{\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \]
          2. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          4. remove-double-negN/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          5. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\color{blue}{\cos \phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          6. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \color{blue}{\phi_1} + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. remove-double-negN/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 + \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\cos \phi_1, \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\color{blue}{\cos \phi_2} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\cos \phi_2}\right)\right)\right)\right) \]
          13. remove-double-negN/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\cos \phi_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
          15. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_2\right)\right)}\right)\right)\right)\right)\right)\right) \]
          16. --lowering--.f64N/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\cos \phi_2}\right)\right)\right)\right)\right)\right)\right)\right) \]
          17. remove-double-negN/A

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right)\right)\right)\right) \]
          18. cos-lowering-cos.f6499.1%

            \[\leadsto \mathsf{+.f64}\left(\lambda_1, \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right)\right)\right)\right) \]
        3. Simplified99.1%

          \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 + \cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}} \]
        4. Add Preprocessing
        5. Taylor expanded in lambda1 around inf

          \[\leadsto \color{blue}{\lambda_1} \]
        6. Step-by-step derivation
          1. Simplified47.6%

            \[\leadsto \color{blue}{\lambda_1} \]
          2. Add Preprocessing

          Reproduce

          ?
          herbie shell --seed 2024144 
          (FPCore (lambda1 lambda2 phi1 phi2)
            :name "Midpoint on a great circle"
            :precision binary64
            (+ lambda1 (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (+ (cos phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))