Destination given bearing on a great circle

Percentage Accurate: 99.8% → 99.8%
Time: 19.2s
Alternatives: 19
Speedup: N/A×

Specification

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

\\
\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\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 19 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: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), 0.5, 0.5\right), \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(\cos theta \cdot \left(-\cos \phi_1\right)\right)\right)} + \lambda_1 \end{array} \]
(FPCore (lambda1 phi1 phi2 delta theta)
 :precision binary64
 (+
  (atan2
   (* (sin theta) (* (sin delta) (cos phi1)))
   (fma
    (fma (cos (+ phi1 phi1)) 0.5 0.5)
    (cos delta)
    (* (* (sin delta) (sin phi1)) (* (cos theta) (- (cos phi1))))))
  lambda1))
double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	return atan2((sin(theta) * (sin(delta) * cos(phi1))), fma(fma(cos((phi1 + phi1)), 0.5, 0.5), cos(delta), ((sin(delta) * sin(phi1)) * (cos(theta) * -cos(phi1))))) + lambda1;
}
function code(lambda1, phi1, phi2, delta, theta)
	return Float64(atan(Float64(sin(theta) * Float64(sin(delta) * cos(phi1))), fma(fma(cos(Float64(phi1 + phi1)), 0.5, 0.5), cos(delta), Float64(Float64(sin(delta) * sin(phi1)) * Float64(cos(theta) * Float64(-cos(phi1)))))) + lambda1)
end
code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * N[(N[Sin[delta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[N[(phi1 + phi1), $MachinePrecision]], $MachinePrecision] * 0.5 + 0.5), $MachinePrecision] * N[Cos[delta], $MachinePrecision] + N[(N[(N[Sin[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[theta], $MachinePrecision] * (-N[Cos[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + lambda1), $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), 0.5, 0.5\right), \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(\cos theta \cdot \left(-\cos \phi_1\right)\right)\right)} + \lambda_1
\end{array}
Derivation
  1. Initial program 99.7%

    \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
  2. Add Preprocessing
  3. Applied egg-rr99.8%

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
  4. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(-\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right) + 1, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(-\sin \phi_1\right) \cdot \sin delta\right)\right)} + \lambda_1} \]
  5. Step-by-step derivation
    1. distribute-neg-inN/A

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\color{blue}{\left(\left(\mathsf{neg}\left(\cos \left(\phi_1 + \phi_1\right) \cdot \frac{-1}{2}\right)\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} + 1, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
    2. metadata-evalN/A

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\left(\mathsf{neg}\left(\cos \left(\phi_1 + \phi_1\right) \cdot \frac{-1}{2}\right)\right) + \color{blue}{\frac{-1}{2}}\right) + 1, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
    3. associate-+l+N/A

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\cos \left(\phi_1 + \phi_1\right) \cdot \frac{-1}{2}\right)\right) + \left(\frac{-1}{2} + 1\right)}, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
    4. distribute-rgt-neg-inN/A

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\color{blue}{\cos \left(\phi_1 + \phi_1\right) \cdot \left(\mathsf{neg}\left(\frac{-1}{2}\right)\right)} + \left(\frac{-1}{2} + 1\right), \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
    5. metadata-evalN/A

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right) \cdot \color{blue}{\frac{1}{2}} + \left(\frac{-1}{2} + 1\right), \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
    6. metadata-evalN/A

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right) \cdot \frac{1}{2} + \color{blue}{\frac{1}{2}}, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
    7. accelerator-lowering-fma.f64N/A

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{1}{2}, \frac{1}{2}\right)}, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
    8. cos-lowering-cos.f64N/A

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\cos \left(\phi_1 + \phi_1\right)}, \frac{1}{2}, \frac{1}{2}\right), \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
    9. +-lowering-+.f6499.8

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_1 + \phi_1\right)}, 0.5, 0.5\right), \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(-\sin \phi_1\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
  6. Applied egg-rr99.8%

    \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), 0.5, 0.5\right)}, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(-\sin \phi_1\right) \cdot \sin delta\right)\right)} + \lambda_1 \]
  7. Final simplification99.8%

    \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), 0.5, 0.5\right), \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(\cos theta \cdot \left(-\cos \phi_1\right)\right)\right)} + \lambda_1 \]
  8. Add Preprocessing

Alternative 2: 96.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -\sin \phi_1\\ t_2 := \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\\ t_3 := \cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)\\ t_4 := \sin delta \cdot \cos \phi_1\\ t_5 := \lambda_1 + \tan^{-1}_* \frac{t\_3}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\cos delta \cdot \sin \phi_1 + t\_4 \cdot \cos theta\right)}\\ \mathbf{if}\;t\_5 \leq 0.05:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_3}{\mathsf{fma}\left(\cos \phi_1 \cdot t\_1, \sin delta, \cos delta - \cos delta \cdot t\_2\right)}\\ \mathbf{elif}\;t\_5 \leq 3.12:\\ \;\;\;\;\tan^{-1}_* \frac{t\_3}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right), \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \left(\cos theta \cdot t\_1\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot t\_4}{\mathsf{fma}\left(1 - t\_2, \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(-\cos \phi_1\right)\right)}\\ \end{array} \end{array} \]
(FPCore (lambda1 phi1 phi2 delta theta)
 :precision binary64
 (let* ((t_1 (- (sin phi1)))
        (t_2 (fma (cos (+ phi1 phi1)) -0.5 0.5))
        (t_3 (* (cos phi1) (* (sin theta) (sin delta))))
        (t_4 (* (sin delta) (cos phi1)))
        (t_5
         (+
          lambda1
          (atan2
           t_3
           (-
            (cos delta)
            (*
             (sin phi1)
             (sin
              (asin (+ (* (cos delta) (sin phi1)) (* t_4 (cos theta)))))))))))
   (if (<= t_5 0.05)
     (+
      lambda1
      (atan2
       t_3
       (fma
        (* (cos phi1) t_1)
        (sin delta)
        (- (cos delta) (* (cos delta) t_2)))))
     (if (<= t_5 3.12)
       (atan2
        t_3
        (fma
         (fma 0.5 (cos (* phi1 -2.0)) 0.5)
         (cos delta)
         (* (cos phi1) (* (sin delta) (* (cos theta) t_1)))))
       (+
        lambda1
        (atan2
         (* (sin theta) t_4)
         (fma
          (- 1.0 t_2)
          (cos delta)
          (* (* (sin delta) (sin phi1)) (- (cos phi1))))))))))
double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	double t_1 = -sin(phi1);
	double t_2 = fma(cos((phi1 + phi1)), -0.5, 0.5);
	double t_3 = cos(phi1) * (sin(theta) * sin(delta));
	double t_4 = sin(delta) * cos(phi1);
	double t_5 = lambda1 + atan2(t_3, (cos(delta) - (sin(phi1) * sin(asin(((cos(delta) * sin(phi1)) + (t_4 * cos(theta))))))));
	double tmp;
	if (t_5 <= 0.05) {
		tmp = lambda1 + atan2(t_3, fma((cos(phi1) * t_1), sin(delta), (cos(delta) - (cos(delta) * t_2))));
	} else if (t_5 <= 3.12) {
		tmp = atan2(t_3, fma(fma(0.5, cos((phi1 * -2.0)), 0.5), cos(delta), (cos(phi1) * (sin(delta) * (cos(theta) * t_1)))));
	} else {
		tmp = lambda1 + atan2((sin(theta) * t_4), fma((1.0 - t_2), cos(delta), ((sin(delta) * sin(phi1)) * -cos(phi1))));
	}
	return tmp;
}
function code(lambda1, phi1, phi2, delta, theta)
	t_1 = Float64(-sin(phi1))
	t_2 = fma(cos(Float64(phi1 + phi1)), -0.5, 0.5)
	t_3 = Float64(cos(phi1) * Float64(sin(theta) * sin(delta)))
	t_4 = Float64(sin(delta) * cos(phi1))
	t_5 = Float64(lambda1 + atan(t_3, Float64(cos(delta) - Float64(sin(phi1) * sin(asin(Float64(Float64(cos(delta) * sin(phi1)) + Float64(t_4 * cos(theta)))))))))
	tmp = 0.0
	if (t_5 <= 0.05)
		tmp = Float64(lambda1 + atan(t_3, fma(Float64(cos(phi1) * t_1), sin(delta), Float64(cos(delta) - Float64(cos(delta) * t_2)))));
	elseif (t_5 <= 3.12)
		tmp = atan(t_3, fma(fma(0.5, cos(Float64(phi1 * -2.0)), 0.5), cos(delta), Float64(cos(phi1) * Float64(sin(delta) * Float64(cos(theta) * t_1)))));
	else
		tmp = Float64(lambda1 + atan(Float64(sin(theta) * t_4), fma(Float64(1.0 - t_2), cos(delta), Float64(Float64(sin(delta) * sin(phi1)) * Float64(-cos(phi1))))));
	end
	return tmp
end
code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = (-N[Sin[phi1], $MachinePrecision])}, Block[{t$95$2 = N[(N[Cos[N[(phi1 + phi1), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[delta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(lambda1 + N[ArcTan[t$95$3 / N[(N[Cos[delta], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Sin[N[ArcSin[N[(N[(N[Cos[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 * N[Cos[theta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, 0.05], N[(lambda1 + N[ArcTan[t$95$3 / N[(N[(N[Cos[phi1], $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sin[delta], $MachinePrecision] + N[(N[Cos[delta], $MachinePrecision] - N[(N[Cos[delta], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 3.12], N[ArcTan[t$95$3 / N[(N[(0.5 * N[Cos[N[(phi1 * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision] * N[Cos[delta], $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[delta], $MachinePrecision] * N[(N[Cos[theta], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * t$95$4), $MachinePrecision] / N[(N[(1.0 - t$95$2), $MachinePrecision] * N[Cos[delta], $MachinePrecision] + N[(N[(N[Sin[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * (-N[Cos[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -\sin \phi_1\\
t_2 := \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\\
t_3 := \cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)\\
t_4 := \sin delta \cdot \cos \phi_1\\
t_5 := \lambda_1 + \tan^{-1}_* \frac{t\_3}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\cos delta \cdot \sin \phi_1 + t\_4 \cdot \cos theta\right)}\\
\mathbf{if}\;t\_5 \leq 0.05:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_3}{\mathsf{fma}\left(\cos \phi_1 \cdot t\_1, \sin delta, \cos delta - \cos delta \cdot t\_2\right)}\\

\mathbf{elif}\;t\_5 \leq 3.12:\\
\;\;\;\;\tan^{-1}_* \frac{t\_3}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right), \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \left(\cos theta \cdot t\_1\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot t\_4}{\mathsf{fma}\left(1 - t\_2, \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(-\cos \phi_1\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 lambda1 (atan2.f64 (*.f64 (*.f64 (sin.f64 theta) (sin.f64 delta)) (cos.f64 phi1)) (-.f64 (cos.f64 delta) (*.f64 (sin.f64 phi1) (sin.f64 (asin.f64 (+.f64 (*.f64 (sin.f64 phi1) (cos.f64 delta)) (*.f64 (*.f64 (cos.f64 phi1) (sin.f64 delta)) (cos.f64 theta))))))))) < 0.050000000000000003

    1. Initial program 99.7%

      \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
    2. Add Preprocessing
    3. Applied egg-rr99.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta + \left(\mathsf{neg}\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right)\right)}\right)} \]
      2. unsub-negN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta}\right)} \]
      3. --lowering--.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta}\right)} \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta}\right)} \]
      6. sub-negN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \color{blue}{\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right)\right)} \cdot \cos delta\right)} \]
      7. +-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right) + \frac{1}{2}\right)} \cdot \cos delta\right)} \]
      8. *-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \left(\left(\mathsf{neg}\left(\color{blue}{\cos \left(2 \cdot \phi_1\right) \cdot \frac{1}{2}}\right)\right) + \frac{1}{2}\right) \cdot \cos delta\right)} \]
      9. distribute-rgt-neg-inN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \left(\color{blue}{\cos \left(2 \cdot \phi_1\right) \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} + \frac{1}{2}\right) \cdot \cos delta\right)} \]
      10. accelerator-lowering-fma.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \phi_1\right), \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right)} \cdot \cos delta\right)} \]
      11. cos-2N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\color{blue}{\cos \phi_1 \cdot \cos \phi_1 - \sin \phi_1 \cdot \sin \phi_1}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \cdot \cos delta\right)} \]
      12. cos-sumN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\color{blue}{\cos \left(\phi_1 + \phi_1\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \cdot \cos delta\right)} \]
      13. cos-lowering-cos.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\color{blue}{\cos \left(\phi_1 + \phi_1\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \cdot \cos delta\right)} \]
      14. +-lowering-+.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\cos \color{blue}{\left(\phi_1 + \phi_1\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \cdot \cos delta\right)} \]
      15. metadata-evalN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \color{blue}{\frac{-1}{2}}, \frac{1}{2}\right) \cdot \cos delta\right)} \]
      16. cos-lowering-cos.f6499.8

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right) \cdot \color{blue}{\cos delta}\right)} \]
    5. Applied egg-rr99.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right) \cdot \cos delta}\right)} \]
    6. Taylor expanded in theta around 0

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \color{blue}{\cos \phi_1}, \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot \cos delta\right)} \]
    7. Step-by-step derivation
      1. cos-lowering-cos.f6495.9

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \color{blue}{\cos \phi_1}, \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right) \cdot \cos delta\right)} \]
    8. Simplified95.9%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \color{blue}{\cos \phi_1}, \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right) \cdot \cos delta\right)} \]

    if 0.050000000000000003 < (+.f64 lambda1 (atan2.f64 (*.f64 (*.f64 (sin.f64 theta) (sin.f64 delta)) (cos.f64 phi1)) (-.f64 (cos.f64 delta) (*.f64 (sin.f64 phi1) (sin.f64 (asin.f64 (+.f64 (*.f64 (sin.f64 phi1) (cos.f64 delta)) (*.f64 (*.f64 (cos.f64 phi1) (sin.f64 delta)) (cos.f64 theta))))))))) < 3.1200000000000001

    1. Initial program 98.9%

      \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
    2. Add Preprocessing
    3. Applied egg-rr99.4%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
    4. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(-\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right) + 1, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(-\sin \phi_1\right) \cdot \sin delta\right)\right)} + \lambda_1} \]
    5. Taylor expanded in lambda1 around 0

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin delta \cdot \sin theta\right)}{-1 \cdot \left(\cos \phi_1 \cdot \left(\cos theta \cdot \left(\sin delta \cdot \sin \phi_1\right)\right)\right) + \cos delta \cdot \left(\frac{1}{2} - \frac{-1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)}} \]
    6. Simplified96.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin delta \cdot \sin theta\right)}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right), \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \left(\cos theta \cdot \left(-\sin \phi_1\right)\right)\right)\right)}} \]

    if 3.1200000000000001 < (+.f64 lambda1 (atan2.f64 (*.f64 (*.f64 (sin.f64 theta) (sin.f64 delta)) (cos.f64 phi1)) (-.f64 (cos.f64 delta) (*.f64 (sin.f64 phi1) (sin.f64 (asin.f64 (+.f64 (*.f64 (sin.f64 phi1) (cos.f64 delta)) (*.f64 (*.f64 (cos.f64 phi1) (sin.f64 delta)) (cos.f64 theta)))))))))

    1. Initial program 100.0%

      \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
    2. Add Preprocessing
    3. Applied egg-rr100.0%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(-\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right) + 1, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(-\sin \phi_1\right) \cdot \sin delta\right)\right)} + \lambda_1} \]
    5. Taylor expanded in theta around 0

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{\mathsf{neg}\left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{\cos \phi_1 \cdot \left(\mathsf{neg}\left(\sin delta \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
      3. *-lowering-*.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{\cos \phi_1 \cdot \left(\mathsf{neg}\left(\sin delta \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{\cos \phi_1} \cdot \left(\mathsf{neg}\left(\sin delta \cdot \sin \phi_1\right)\right)\right)} + \lambda_1 \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \color{blue}{\left(\sin delta \cdot \left(\mathsf{neg}\left(\sin \phi_1\right)\right)\right)}\right)} + \lambda_1 \]
      6. mul-1-negN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \color{blue}{\left(-1 \cdot \sin \phi_1\right)}\right)\right)} + \lambda_1 \]
      7. *-lowering-*.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \color{blue}{\left(\sin delta \cdot \left(-1 \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
      8. sin-lowering-sin.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\color{blue}{\sin delta} \cdot \left(-1 \cdot \sin \phi_1\right)\right)\right)} + \lambda_1 \]
      9. mul-1-negN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \color{blue}{\left(\mathsf{neg}\left(\sin \phi_1\right)\right)}\right)\right)} + \lambda_1 \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \color{blue}{\left(\mathsf{neg}\left(\sin \phi_1\right)\right)}\right)\right)} + \lambda_1 \]
      11. sin-lowering-sin.f6499.7

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(-\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \left(-\color{blue}{\sin \phi_1}\right)\right)\right)} + \lambda_1 \]
    7. Simplified99.7%

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(-\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right) + 1, \cos delta, \color{blue}{\cos \phi_1 \cdot \left(\sin delta \cdot \left(-\sin \phi_1\right)\right)}\right)} + \lambda_1 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\cos delta \cdot \sin \phi_1 + \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)} \leq 0.05:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\mathsf{fma}\left(\cos \phi_1 \cdot \left(-\sin \phi_1\right), \sin delta, \cos delta - \cos delta \cdot \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right)}\\ \mathbf{elif}\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\cos delta \cdot \sin \phi_1 + \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)} \leq 3.12:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right), \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \left(\cos theta \cdot \left(-\sin \phi_1\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(1 - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right), \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(-\cos \phi_1\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sin theta \cdot \sin delta\\ t_2 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot t\_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\cos delta \cdot \sin \phi_1 + \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)}\\ \mathbf{if}\;t\_2 \leq -50:\\ \;\;\;\;\lambda_1\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-14}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \end{array} \end{array} \]
(FPCore (lambda1 phi1 phi2 delta theta)
 :precision binary64
 (let* ((t_1 (* (sin theta) (sin delta)))
        (t_2
         (+
          lambda1
          (atan2
           (* (cos phi1) t_1)
           (-
            (cos delta)
            (*
             (sin phi1)
             (sin
              (asin
               (+
                (* (cos delta) (sin phi1))
                (* (* (sin delta) (cos phi1)) (cos theta)))))))))))
   (if (<= t_2 -50.0)
     lambda1
     (if (<= t_2 -2e-14)
       (atan2 t_1 (cos delta))
       (+ lambda1 (atan2 (* (sin theta) delta) (cos delta)))))))
double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	double t_1 = sin(theta) * sin(delta);
	double t_2 = lambda1 + atan2((cos(phi1) * t_1), (cos(delta) - (sin(phi1) * sin(asin(((cos(delta) * sin(phi1)) + ((sin(delta) * cos(phi1)) * cos(theta))))))));
	double tmp;
	if (t_2 <= -50.0) {
		tmp = lambda1;
	} else if (t_2 <= -2e-14) {
		tmp = atan2(t_1, cos(delta));
	} else {
		tmp = lambda1 + atan2((sin(theta) * delta), cos(delta));
	}
	return tmp;
}
real(8) function code(lambda1, phi1, phi2, delta, theta)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8), intent (in) :: delta
    real(8), intent (in) :: theta
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = sin(theta) * sin(delta)
    t_2 = lambda1 + atan2((cos(phi1) * t_1), (cos(delta) - (sin(phi1) * sin(asin(((cos(delta) * sin(phi1)) + ((sin(delta) * cos(phi1)) * cos(theta))))))))
    if (t_2 <= (-50.0d0)) then
        tmp = lambda1
    else if (t_2 <= (-2d-14)) then
        tmp = atan2(t_1, cos(delta))
    else
        tmp = lambda1 + atan2((sin(theta) * delta), cos(delta))
    end if
    code = tmp
end function
public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	double t_1 = Math.sin(theta) * Math.sin(delta);
	double t_2 = lambda1 + Math.atan2((Math.cos(phi1) * t_1), (Math.cos(delta) - (Math.sin(phi1) * Math.sin(Math.asin(((Math.cos(delta) * Math.sin(phi1)) + ((Math.sin(delta) * Math.cos(phi1)) * Math.cos(theta))))))));
	double tmp;
	if (t_2 <= -50.0) {
		tmp = lambda1;
	} else if (t_2 <= -2e-14) {
		tmp = Math.atan2(t_1, Math.cos(delta));
	} else {
		tmp = lambda1 + Math.atan2((Math.sin(theta) * delta), Math.cos(delta));
	}
	return tmp;
}
def code(lambda1, phi1, phi2, delta, theta):
	t_1 = math.sin(theta) * math.sin(delta)
	t_2 = lambda1 + math.atan2((math.cos(phi1) * t_1), (math.cos(delta) - (math.sin(phi1) * math.sin(math.asin(((math.cos(delta) * math.sin(phi1)) + ((math.sin(delta) * math.cos(phi1)) * math.cos(theta))))))))
	tmp = 0
	if t_2 <= -50.0:
		tmp = lambda1
	elif t_2 <= -2e-14:
		tmp = math.atan2(t_1, math.cos(delta))
	else:
		tmp = lambda1 + math.atan2((math.sin(theta) * delta), math.cos(delta))
	return tmp
function code(lambda1, phi1, phi2, delta, theta)
	t_1 = Float64(sin(theta) * sin(delta))
	t_2 = Float64(lambda1 + atan(Float64(cos(phi1) * t_1), Float64(cos(delta) - Float64(sin(phi1) * sin(asin(Float64(Float64(cos(delta) * sin(phi1)) + Float64(Float64(sin(delta) * cos(phi1)) * cos(theta)))))))))
	tmp = 0.0
	if (t_2 <= -50.0)
		tmp = lambda1;
	elseif (t_2 <= -2e-14)
		tmp = atan(t_1, cos(delta));
	else
		tmp = Float64(lambda1 + atan(Float64(sin(theta) * delta), cos(delta)));
	end
	return tmp
end
function tmp_2 = code(lambda1, phi1, phi2, delta, theta)
	t_1 = sin(theta) * sin(delta);
	t_2 = lambda1 + atan2((cos(phi1) * t_1), (cos(delta) - (sin(phi1) * sin(asin(((cos(delta) * sin(phi1)) + ((sin(delta) * cos(phi1)) * cos(theta))))))));
	tmp = 0.0;
	if (t_2 <= -50.0)
		tmp = lambda1;
	elseif (t_2 <= -2e-14)
		tmp = atan2(t_1, cos(delta));
	else
		tmp = lambda1 + atan2((sin(theta) * delta), cos(delta));
	end
	tmp_2 = tmp;
end
code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * t$95$1), $MachinePrecision] / N[(N[Cos[delta], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Sin[N[ArcSin[N[(N[(N[Cos[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[delta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[theta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -50.0], lambda1, If[LessEqual[t$95$2, -2e-14], N[ArcTan[t$95$1 / N[Cos[delta], $MachinePrecision]], $MachinePrecision], N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * delta), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sin theta \cdot \sin delta\\
t_2 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot t\_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\cos delta \cdot \sin \phi_1 + \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)}\\
\mathbf{if}\;t\_2 \leq -50:\\
\;\;\;\;\lambda_1\\

\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-14}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\cos delta}\\

\mathbf{else}:\\
\;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 lambda1 (atan2.f64 (*.f64 (*.f64 (sin.f64 theta) (sin.f64 delta)) (cos.f64 phi1)) (-.f64 (cos.f64 delta) (*.f64 (sin.f64 phi1) (sin.f64 (asin.f64 (+.f64 (*.f64 (sin.f64 phi1) (cos.f64 delta)) (*.f64 (*.f64 (cos.f64 phi1) (sin.f64 delta)) (cos.f64 theta))))))))) < -50

    1. Initial program 100.0%

      \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in lambda1 around inf

      \[\leadsto \color{blue}{\lambda_1} \]
    4. Step-by-step derivation
      1. Simplified99.8%

        \[\leadsto \color{blue}{\lambda_1} \]

      if -50 < (+.f64 lambda1 (atan2.f64 (*.f64 (*.f64 (sin.f64 theta) (sin.f64 delta)) (cos.f64 phi1)) (-.f64 (cos.f64 delta) (*.f64 (sin.f64 phi1) (sin.f64 (asin.f64 (+.f64 (*.f64 (sin.f64 phi1) (cos.f64 delta)) (*.f64 (*.f64 (cos.f64 phi1) (sin.f64 delta)) (cos.f64 theta))))))))) < -2e-14

      1. Initial program 99.7%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in phi1 around 0

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        2. sin-lowering-sin.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        3. sin-lowering-sin.f6472.6

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      5. Simplified72.6%

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

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
      7. Step-by-step derivation
        1. cos-lowering-cos.f6468.0

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
      8. Simplified68.0%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
      9. Taylor expanded in lambda1 around 0

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\cos delta}} \]
      10. Step-by-step derivation
        1. atan2-lowering-atan2.f64N/A

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\cos delta}} \]
        2. *-lowering-*.f64N/A

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta} \]
        3. sin-lowering-sin.f64N/A

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta} \]
        4. sin-lowering-sin.f64N/A

          \[\leadsto \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta} \]
        5. cos-lowering-cos.f6464.4

          \[\leadsto \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
      11. Simplified64.4%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\cos delta}} \]

      if -2e-14 < (+.f64 lambda1 (atan2.f64 (*.f64 (*.f64 (sin.f64 theta) (sin.f64 delta)) (cos.f64 phi1)) (-.f64 (cos.f64 delta) (*.f64 (sin.f64 phi1) (sin.f64 (asin.f64 (+.f64 (*.f64 (sin.f64 phi1) (cos.f64 delta)) (*.f64 (*.f64 (cos.f64 phi1) (sin.f64 delta)) (cos.f64 theta)))))))))

      1. Initial program 99.6%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in phi1 around 0

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        2. sin-lowering-sin.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        3. sin-lowering-sin.f6480.2

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      5. Simplified80.2%

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

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
      7. Step-by-step derivation
        1. cos-lowering-cos.f6479.2

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
      8. Simplified79.2%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
      9. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
      10. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
        2. sin-lowering-sin.f6471.5

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{delta \cdot \color{blue}{\sin theta}}{\cos delta} \]
      11. Simplified71.5%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
    5. Recombined 3 regimes into one program.
    6. Final simplification77.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\cos delta \cdot \sin \phi_1 + \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)} \leq -50:\\ \;\;\;\;\lambda_1\\ \mathbf{elif}\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\cos delta \cdot \sin \phi_1 + \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)} \leq -2 \cdot 10^{-14}:\\ \;\;\;\;\tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \end{array} \]
    7. Add Preprocessing

    Alternative 4: 94.3% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\mathsf{fma}\left(\cos \phi_1 \cdot \left(-\sin \phi_1\right), \sin delta, \cos delta - \cos delta \cdot \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right)} \end{array} \]
    (FPCore (lambda1 phi1 phi2 delta theta)
     :precision binary64
     (+
      lambda1
      (atan2
       (* (cos phi1) (* (sin theta) (sin delta)))
       (fma
        (* (cos phi1) (- (sin phi1)))
        (sin delta)
        (- (cos delta) (* (cos delta) (fma (cos (+ phi1 phi1)) -0.5 0.5)))))))
    double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	return lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), fma((cos(phi1) * -sin(phi1)), sin(delta), (cos(delta) - (cos(delta) * fma(cos((phi1 + phi1)), -0.5, 0.5)))));
    }
    
    function code(lambda1, phi1, phi2, delta, theta)
    	return Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * sin(delta))), fma(Float64(cos(phi1) * Float64(-sin(phi1))), sin(delta), Float64(cos(delta) - Float64(cos(delta) * fma(cos(Float64(phi1 + phi1)), -0.5, 0.5))))))
    end
    
    code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision])), $MachinePrecision] * N[Sin[delta], $MachinePrecision] + N[(N[Cos[delta], $MachinePrecision] - N[(N[Cos[delta], $MachinePrecision] * N[(N[Cos[N[(phi1 + phi1), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\mathsf{fma}\left(\cos \phi_1 \cdot \left(-\sin \phi_1\right), \sin delta, \cos delta - \cos delta \cdot \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right)}
    \end{array}
    
    Derivation
    1. Initial program 99.7%

      \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
    2. Add Preprocessing
    3. Applied egg-rr99.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta + \left(\mathsf{neg}\left(\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right)\right)}\right)} \]
      2. unsub-negN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta}\right)} \]
      3. --lowering--.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta}\right)} \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta} - \left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta}\right)} \]
      6. sub-negN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \color{blue}{\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right)\right)} \cdot \cos delta\right)} \]
      7. +-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right) + \frac{1}{2}\right)} \cdot \cos delta\right)} \]
      8. *-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \left(\left(\mathsf{neg}\left(\color{blue}{\cos \left(2 \cdot \phi_1\right) \cdot \frac{1}{2}}\right)\right) + \frac{1}{2}\right) \cdot \cos delta\right)} \]
      9. distribute-rgt-neg-inN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \left(\color{blue}{\cos \left(2 \cdot \phi_1\right) \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} + \frac{1}{2}\right) \cdot \cos delta\right)} \]
      10. accelerator-lowering-fma.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \color{blue}{\mathsf{fma}\left(\cos \left(2 \cdot \phi_1\right), \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right)} \cdot \cos delta\right)} \]
      11. cos-2N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\color{blue}{\cos \phi_1 \cdot \cos \phi_1 - \sin \phi_1 \cdot \sin \phi_1}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \cdot \cos delta\right)} \]
      12. cos-sumN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\color{blue}{\cos \left(\phi_1 + \phi_1\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \cdot \cos delta\right)} \]
      13. cos-lowering-cos.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\color{blue}{\cos \left(\phi_1 + \phi_1\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \cdot \cos delta\right)} \]
      14. +-lowering-+.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\cos \color{blue}{\left(\phi_1 + \phi_1\right)}, \mathsf{neg}\left(\frac{1}{2}\right), \frac{1}{2}\right) \cdot \cos delta\right)} \]
      15. metadata-evalN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \color{blue}{\frac{-1}{2}}, \frac{1}{2}\right) \cdot \cos delta\right)} \]
      16. cos-lowering-cos.f6499.8

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right) \cdot \color{blue}{\cos delta}\right)} \]
    5. Applied egg-rr99.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right) \cdot \cos delta}\right)} \]
    6. Taylor expanded in theta around 0

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \color{blue}{\cos \phi_1}, \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right) \cdot \cos delta\right)} \]
    7. Step-by-step derivation
      1. cos-lowering-cos.f6493.4

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \color{blue}{\cos \phi_1}, \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right) \cdot \cos delta\right)} \]
    8. Simplified93.4%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \color{blue}{\cos \phi_1}, \sin delta, \cos delta - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right) \cdot \cos delta\right)} \]
    9. Final simplification93.4%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\mathsf{fma}\left(\cos \phi_1 \cdot \left(-\sin \phi_1\right), \sin delta, \cos delta - \cos delta \cdot \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right)} \]
    10. Add Preprocessing

    Alternative 5: 94.3% accurate, 1.4× speedup?

    \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(1 - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right), \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(-\cos \phi_1\right)\right)} \end{array} \]
    (FPCore (lambda1 phi1 phi2 delta theta)
     :precision binary64
     (+
      lambda1
      (atan2
       (* (sin theta) (* (sin delta) (cos phi1)))
       (fma
        (- 1.0 (fma (cos (+ phi1 phi1)) -0.5 0.5))
        (cos delta)
        (* (* (sin delta) (sin phi1)) (- (cos phi1)))))))
    double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	return lambda1 + atan2((sin(theta) * (sin(delta) * cos(phi1))), fma((1.0 - fma(cos((phi1 + phi1)), -0.5, 0.5)), cos(delta), ((sin(delta) * sin(phi1)) * -cos(phi1))));
    }
    
    function code(lambda1, phi1, phi2, delta, theta)
    	return Float64(lambda1 + atan(Float64(sin(theta) * Float64(sin(delta) * cos(phi1))), fma(Float64(1.0 - fma(cos(Float64(phi1 + phi1)), -0.5, 0.5)), cos(delta), Float64(Float64(sin(delta) * sin(phi1)) * Float64(-cos(phi1))))))
    end
    
    code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * N[(N[Sin[delta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - N[(N[Cos[N[(phi1 + phi1), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision] * N[Cos[delta], $MachinePrecision] + N[(N[(N[Sin[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * (-N[Cos[phi1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(1 - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right), \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(-\cos \phi_1\right)\right)}
    \end{array}
    
    Derivation
    1. Initial program 99.7%

      \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
    2. Add Preprocessing
    3. Applied egg-rr99.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
    4. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(-\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right) + 1, \cos delta, \left(\cos \phi_1 \cdot \cos theta\right) \cdot \left(\left(-\sin \phi_1\right) \cdot \sin delta\right)\right)} + \lambda_1} \]
    5. Taylor expanded in theta around 0

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{\mathsf{neg}\left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{\cos \phi_1 \cdot \left(\mathsf{neg}\left(\sin delta \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
      3. *-lowering-*.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{\cos \phi_1 \cdot \left(\mathsf{neg}\left(\sin delta \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \color{blue}{\cos \phi_1} \cdot \left(\mathsf{neg}\left(\sin delta \cdot \sin \phi_1\right)\right)\right)} + \lambda_1 \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \color{blue}{\left(\sin delta \cdot \left(\mathsf{neg}\left(\sin \phi_1\right)\right)\right)}\right)} + \lambda_1 \]
      6. mul-1-negN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \color{blue}{\left(-1 \cdot \sin \phi_1\right)}\right)\right)} + \lambda_1 \]
      7. *-lowering-*.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \color{blue}{\left(\sin delta \cdot \left(-1 \cdot \sin \phi_1\right)\right)}\right)} + \lambda_1 \]
      8. sin-lowering-sin.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\color{blue}{\sin delta} \cdot \left(-1 \cdot \sin \phi_1\right)\right)\right)} + \lambda_1 \]
      9. mul-1-negN/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \color{blue}{\left(\mathsf{neg}\left(\sin \phi_1\right)\right)}\right)\right)} + \lambda_1 \]
      10. neg-lowering-neg.f64N/A

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), \frac{-1}{2}, \frac{1}{2}\right)\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \color{blue}{\left(\mathsf{neg}\left(\sin \phi_1\right)\right)}\right)\right)} + \lambda_1 \]
      11. sin-lowering-sin.f6493.4

        \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(-\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right) + 1, \cos delta, \cos \phi_1 \cdot \left(\sin delta \cdot \left(-\color{blue}{\sin \phi_1}\right)\right)\right)} + \lambda_1 \]
    7. Simplified93.4%

      \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\left(-\mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right)\right) + 1, \cos delta, \color{blue}{\cos \phi_1 \cdot \left(\sin delta \cdot \left(-\sin \phi_1\right)\right)}\right)} + \lambda_1 \]
    8. Final simplification93.4%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(1 - \mathsf{fma}\left(\cos \left(\phi_1 + \phi_1\right), -0.5, 0.5\right), \cos delta, \left(\sin delta \cdot \sin \phi_1\right) \cdot \left(-\cos \phi_1\right)\right)} \]
    9. Add Preprocessing

    Alternative 6: 92.2% accurate, 1.4× speedup?

    \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{-0.5 + \mathsf{fma}\left(\sin delta \cdot \sin \phi_1, -\cos \phi_1, \mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), \cos delta\right)\right)} \end{array} \]
    (FPCore (lambda1 phi1 phi2 delta theta)
     :precision binary64
     (+
      lambda1
      (atan2
       (* (cos phi1) (* (sin theta) (sin delta)))
       (+
        -0.5
        (fma
         (* (sin delta) (sin phi1))
         (- (cos phi1))
         (fma 0.5 (cos (* phi1 -2.0)) (cos delta)))))))
    double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	return lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), (-0.5 + fma((sin(delta) * sin(phi1)), -cos(phi1), fma(0.5, cos((phi1 * -2.0)), cos(delta)))));
    }
    
    function code(lambda1, phi1, phi2, delta, theta)
    	return Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * sin(delta))), Float64(-0.5 + fma(Float64(sin(delta) * sin(phi1)), Float64(-cos(phi1)), fma(0.5, cos(Float64(phi1 * -2.0)), cos(delta))))))
    end
    
    code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-0.5 + N[(N[(N[Sin[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * (-N[Cos[phi1], $MachinePrecision]) + N[(0.5 * N[Cos[N[(phi1 * -2.0), $MachinePrecision]], $MachinePrecision] + N[Cos[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{-0.5 + \mathsf{fma}\left(\sin delta \cdot \sin \phi_1, -\cos \phi_1, \mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), \cos delta\right)\right)}
    \end{array}
    
    Derivation
    1. Initial program 99.7%

      \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
    2. Add Preprocessing
    3. Applied egg-rr99.8%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
    4. Taylor expanded in delta around 0

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) - \frac{1}{2}\right)} + \cos delta\right)} \]
    5. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} + \cos delta\right)} \]
      2. metadata-evalN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \color{blue}{\frac{-1}{2}}\right) + \cos delta\right)} \]
      3. accelerator-lowering-fma.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{-1}{2}\right)} + \cos delta\right)} \]
      4. cos-lowering-cos.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(2 \cdot \phi_1\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
      5. *-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
      6. *-lowering-*.f6491.5

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, -0.5\right) + \cos delta\right)} \]
    6. Simplified91.5%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot 2\right), -0.5\right)} + \cos delta\right)} \]
    7. Taylor expanded in theta around 0

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\left(\cos delta + \left(-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right) + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right) - \frac{1}{2}}} \]
    8. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\left(\cos delta + \left(-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right) + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
      2. metadata-evalN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\left(\cos delta + \left(-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right) + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right) + \color{blue}{\frac{-1}{2}}} \]
      3. +-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{-1}{2} + \left(\cos delta + \left(-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right) + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right)}} \]
      4. +-lowering-+.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{-1}{2} + \left(\cos delta + \left(-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right) + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)\right)}} \]
      5. +-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{-1}{2} + \color{blue}{\left(\left(-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right) + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right) + \cos delta\right)}} \]
      6. associate-+l+N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{-1}{2} + \color{blue}{\left(-1 \cdot \left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right) + \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \cos delta\right)\right)}} \]
      7. mul-1-negN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{-1}{2} + \left(\color{blue}{\left(\mathsf{neg}\left(\cos \phi_1 \cdot \left(\sin delta \cdot \sin \phi_1\right)\right)\right)} + \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \cos delta\right)\right)} \]
      8. *-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{-1}{2} + \left(\left(\mathsf{neg}\left(\color{blue}{\left(\sin delta \cdot \sin \phi_1\right) \cdot \cos \phi_1}\right)\right) + \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \cos delta\right)\right)} \]
      9. distribute-rgt-neg-inN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{-1}{2} + \left(\color{blue}{\left(\sin delta \cdot \sin \phi_1\right) \cdot \left(\mathsf{neg}\left(\cos \phi_1\right)\right)} + \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \cos delta\right)\right)} \]
      10. mul-1-negN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{-1}{2} + \left(\left(\sin delta \cdot \sin \phi_1\right) \cdot \color{blue}{\left(-1 \cdot \cos \phi_1\right)} + \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \cos delta\right)\right)} \]
      11. +-commutativeN/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{-1}{2} + \left(\left(\sin delta \cdot \sin \phi_1\right) \cdot \left(-1 \cdot \cos \phi_1\right) + \color{blue}{\left(\cos delta + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)}\right)} \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{-1}{2} + \color{blue}{\mathsf{fma}\left(\sin delta \cdot \sin \phi_1, -1 \cdot \cos \phi_1, \cos delta + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)\right)}} \]
    9. Simplified91.2%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{-0.5 + \mathsf{fma}\left(\sin delta \cdot \sin \phi_1, -\cos \phi_1, \mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), \cos delta\right)\right)}} \]
    10. Final simplification91.2%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{-0.5 + \mathsf{fma}\left(\sin delta \cdot \sin \phi_1, -\cos \phi_1, \mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), \cos delta\right)\right)} \]
    11. Add Preprocessing

    Alternative 7: 92.1% accurate, 1.9× speedup?

    \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - {\sin \phi_1}^{2}} \end{array} \]
    (FPCore (lambda1 phi1 phi2 delta theta)
     :precision binary64
     (+
      lambda1
      (atan2
       (* (cos phi1) (* (sin theta) (sin delta)))
       (- (cos delta) (pow (sin phi1) 2.0)))))
    double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	return lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), (cos(delta) - pow(sin(phi1), 2.0)));
    }
    
    real(8) function code(lambda1, phi1, phi2, delta, theta)
        real(8), intent (in) :: lambda1
        real(8), intent (in) :: phi1
        real(8), intent (in) :: phi2
        real(8), intent (in) :: delta
        real(8), intent (in) :: theta
        code = lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), (cos(delta) - (sin(phi1) ** 2.0d0)))
    end function
    
    public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	return lambda1 + Math.atan2((Math.cos(phi1) * (Math.sin(theta) * Math.sin(delta))), (Math.cos(delta) - Math.pow(Math.sin(phi1), 2.0)));
    }
    
    def code(lambda1, phi1, phi2, delta, theta):
    	return lambda1 + math.atan2((math.cos(phi1) * (math.sin(theta) * math.sin(delta))), (math.cos(delta) - math.pow(math.sin(phi1), 2.0)))
    
    function code(lambda1, phi1, phi2, delta, theta)
    	return Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * sin(delta))), Float64(cos(delta) - (sin(phi1) ^ 2.0))))
    end
    
    function tmp = code(lambda1, phi1, phi2, delta, theta)
    	tmp = lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), (cos(delta) - (sin(phi1) ^ 2.0)));
    end
    
    code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[delta], $MachinePrecision] - N[Power[N[Sin[phi1], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - {\sin \phi_1}^{2}}
    \end{array}
    
    Derivation
    1. Initial program 99.7%

      \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in delta around 0

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \color{blue}{{\sin \phi_1}^{2}}} \]
    4. Step-by-step derivation
      1. pow-lowering-pow.f64N/A

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \color{blue}{{\sin \phi_1}^{2}}} \]
      2. sin-lowering-sin.f6490.6

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - {\color{blue}{\sin \phi_1}}^{2}} \]
    5. Simplified90.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \color{blue}{{\sin \phi_1}^{2}}} \]
    6. Final simplification90.6%

      \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - {\sin \phi_1}^{2}} \]
    7. Add Preprocessing

    Alternative 8: 91.0% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (lambda1 phi1 phi2 delta theta)
     :precision binary64
     (let* ((t_1
             (+
              lambda1
              (atan2 (* (cos phi1) (* (sin theta) (sin delta))) (cos delta)))))
       (if (<= delta -4.1e+23)
         t_1
         (if (<= delta 1.25e-27)
           (+
            lambda1
            (atan2
             (* (sin theta) (* (sin delta) (cos phi1)))
             (fma 0.5 (cos (* phi1 -2.0)) 0.5)))
           t_1))))
    double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	double t_1 = lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), cos(delta));
    	double tmp;
    	if (delta <= -4.1e+23) {
    		tmp = t_1;
    	} else if (delta <= 1.25e-27) {
    		tmp = lambda1 + atan2((sin(theta) * (sin(delta) * cos(phi1))), fma(0.5, cos((phi1 * -2.0)), 0.5));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(lambda1, phi1, phi2, delta, theta)
    	t_1 = Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * sin(delta))), cos(delta)))
    	tmp = 0.0
    	if (delta <= -4.1e+23)
    		tmp = t_1;
    	elseif (delta <= 1.25e-27)
    		tmp = Float64(lambda1 + atan(Float64(sin(theta) * Float64(sin(delta) * cos(phi1))), fma(0.5, cos(Float64(phi1 * -2.0)), 0.5)));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[delta, -4.1e+23], t$95$1, If[LessEqual[delta, 1.25e-27], N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * N[(N[Sin[delta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.5 * N[Cos[N[(phi1 * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\
    \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\
    \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if delta < -4.09999999999999996e23 or 1.25e-27 < delta

      1. Initial program 99.8%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in phi1 around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\cos delta}} \]
      4. Step-by-step derivation
        1. cos-lowering-cos.f6483.5

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\cos delta}} \]
      5. Simplified83.5%

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

      if -4.09999999999999996e23 < delta < 1.25e-27

      1. Initial program 99.6%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Applied egg-rr99.7%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
      4. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) - \frac{1}{2}\right)} + \cos delta\right)} \]
      5. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} + \cos delta\right)} \]
        2. metadata-evalN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \color{blue}{\frac{-1}{2}}\right) + \cos delta\right)} \]
        3. accelerator-lowering-fma.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{-1}{2}\right)} + \cos delta\right)} \]
        4. cos-lowering-cos.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(2 \cdot \phi_1\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
        5. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
        6. *-lowering-*.f6498.0

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, -0.5\right) + \cos delta\right)} \]
      6. Simplified98.0%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot 2\right), -0.5\right)} + \cos delta\right)} \]
      7. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)}} \]
      8. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \frac{1}{2}}} \]
        2. accelerator-lowering-fma.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{1}{2}\right)}} \]
        3. metadata-evalN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot \phi_1\right), \frac{1}{2}\right)} \]
        4. distribute-lft-neg-inN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\mathsf{neg}\left(-2 \cdot \phi_1\right)\right)}, \frac{1}{2}\right)} \]
        5. cos-negN/A

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(-2 \cdot \phi_1\right)}, \frac{1}{2}\right)} \]
        7. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, \frac{1}{2}\right)} \]
        8. *-lowering-*.f6497.9

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, 0.5\right)} \]
      9. Simplified97.9%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}} \]
      10. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{1}{2} \cdot \cos \left(\phi_1 \cdot -2\right) + \frac{1}{2}} + \lambda_1} \]
        2. +-lowering-+.f64N/A

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{1}{2} \cdot \cos \left(\phi_1 \cdot -2\right) + \frac{1}{2}} + \lambda_1} \]
        3. associate-*r*N/A

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

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\frac{1}{2} \cdot \cos \left(\phi_1 \cdot -2\right) + \frac{1}{2}}} + \lambda_1 \]
        5. *-lowering-*.f64N/A

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}}{\frac{1}{2} \cdot \cos \left(\phi_1 \cdot -2\right) + \frac{1}{2}} + \lambda_1 \]
        6. sin-lowering-sin.f64N/A

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin theta} \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\frac{1}{2} \cdot \cos \left(\phi_1 \cdot -2\right) + \frac{1}{2}} + \lambda_1 \]
        7. *-lowering-*.f64N/A

          \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \color{blue}{\left(\sin delta \cdot \cos \phi_1\right)}}{\frac{1}{2} \cdot \cos \left(\phi_1 \cdot -2\right) + \frac{1}{2}} + \lambda_1 \]
        8. sin-lowering-sin.f64N/A

          \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\color{blue}{\sin delta} \cdot \cos \phi_1\right)}{\frac{1}{2} \cdot \cos \left(\phi_1 \cdot -2\right) + \frac{1}{2}} + \lambda_1 \]
        9. cos-lowering-cos.f64N/A

          \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \color{blue}{\cos \phi_1}\right)}{\frac{1}{2} \cdot \cos \left(\phi_1 \cdot -2\right) + \frac{1}{2}} + \lambda_1 \]
        10. accelerator-lowering-fma.f64N/A

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

          \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(\phi_1 \cdot -2\right)}, \frac{1}{2}\right)} + \lambda_1 \]
        12. *-lowering-*.f6497.9

          \[\leadsto \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, 0.5\right)} + \lambda_1 \]
      11. Applied egg-rr97.9%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)} + \lambda_1} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification90.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 9: 91.0% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)\\ t_2 := \lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos delta}\\ \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
    (FPCore (lambda1 phi1 phi2 delta theta)
     :precision binary64
     (let* ((t_1 (* (cos phi1) (* (sin theta) (sin delta))))
            (t_2 (+ lambda1 (atan2 t_1 (cos delta)))))
       (if (<= delta -4.1e+23)
         t_2
         (if (<= delta 1.25e-27)
           (+ lambda1 (atan2 t_1 (fma 0.5 (cos (* phi1 -2.0)) 0.5)))
           t_2))))
    double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	double t_1 = cos(phi1) * (sin(theta) * sin(delta));
    	double t_2 = lambda1 + atan2(t_1, cos(delta));
    	double tmp;
    	if (delta <= -4.1e+23) {
    		tmp = t_2;
    	} else if (delta <= 1.25e-27) {
    		tmp = lambda1 + atan2(t_1, fma(0.5, cos((phi1 * -2.0)), 0.5));
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    function code(lambda1, phi1, phi2, delta, theta)
    	t_1 = Float64(cos(phi1) * Float64(sin(theta) * sin(delta)))
    	t_2 = Float64(lambda1 + atan(t_1, cos(delta)))
    	tmp = 0.0
    	if (delta <= -4.1e+23)
    		tmp = t_2;
    	elseif (delta <= 1.25e-27)
    		tmp = Float64(lambda1 + atan(t_1, fma(0.5, cos(Float64(phi1 * -2.0)), 0.5)));
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(lambda1 + N[ArcTan[t$95$1 / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[delta, -4.1e+23], t$95$2, If[LessEqual[delta, 1.25e-27], N[(lambda1 + N[ArcTan[t$95$1 / N[(0.5 * N[Cos[N[(phi1 * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)\\
    t_2 := \lambda_1 + \tan^{-1}_* \frac{t\_1}{\cos delta}\\
    \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\
    \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if delta < -4.09999999999999996e23 or 1.25e-27 < delta

      1. Initial program 99.8%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in phi1 around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\cos delta}} \]
      4. Step-by-step derivation
        1. cos-lowering-cos.f6483.5

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\cos delta}} \]
      5. Simplified83.5%

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

      if -4.09999999999999996e23 < delta < 1.25e-27

      1. Initial program 99.6%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Applied egg-rr99.7%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
      4. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) - \frac{1}{2}\right)} + \cos delta\right)} \]
      5. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} + \cos delta\right)} \]
        2. metadata-evalN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \color{blue}{\frac{-1}{2}}\right) + \cos delta\right)} \]
        3. accelerator-lowering-fma.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{-1}{2}\right)} + \cos delta\right)} \]
        4. cos-lowering-cos.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(2 \cdot \phi_1\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
        5. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
        6. *-lowering-*.f6498.0

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, -0.5\right) + \cos delta\right)} \]
      6. Simplified98.0%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot 2\right), -0.5\right)} + \cos delta\right)} \]
      7. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)}} \]
      8. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \frac{1}{2}}} \]
        2. accelerator-lowering-fma.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{1}{2}\right)}} \]
        3. metadata-evalN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot \phi_1\right), \frac{1}{2}\right)} \]
        4. distribute-lft-neg-inN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\mathsf{neg}\left(-2 \cdot \phi_1\right)\right)}, \frac{1}{2}\right)} \]
        5. cos-negN/A

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(-2 \cdot \phi_1\right)}, \frac{1}{2}\right)} \]
        7. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, \frac{1}{2}\right)} \]
        8. *-lowering-*.f6497.9

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, 0.5\right)} \]
      9. Simplified97.9%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification90.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 10: 91.0% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\sin theta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (lambda1 phi1 phi2 delta theta)
     :precision binary64
     (let* ((t_1
             (+
              lambda1
              (atan2 (* (cos phi1) (* (sin theta) (sin delta))) (cos delta)))))
       (if (<= delta -4.1e+23)
         t_1
         (if (<= delta 1.25e-27)
           (+
            lambda1
            (atan2
             (* (sin delta) (* (sin theta) (cos phi1)))
             (fma 0.5 (cos (* phi1 -2.0)) 0.5)))
           t_1))))
    double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	double t_1 = lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), cos(delta));
    	double tmp;
    	if (delta <= -4.1e+23) {
    		tmp = t_1;
    	} else if (delta <= 1.25e-27) {
    		tmp = lambda1 + atan2((sin(delta) * (sin(theta) * cos(phi1))), fma(0.5, cos((phi1 * -2.0)), 0.5));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(lambda1, phi1, phi2, delta, theta)
    	t_1 = Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * sin(delta))), cos(delta)))
    	tmp = 0.0
    	if (delta <= -4.1e+23)
    		tmp = t_1;
    	elseif (delta <= 1.25e-27)
    		tmp = Float64(lambda1 + atan(Float64(sin(delta) * Float64(sin(theta) * cos(phi1))), fma(0.5, cos(Float64(phi1 * -2.0)), 0.5)));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[delta, -4.1e+23], t$95$1, If[LessEqual[delta, 1.25e-27], N[(lambda1 + N[ArcTan[N[(N[Sin[delta], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.5 * N[Cos[N[(phi1 * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\
    \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\
    \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\sin theta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if delta < -4.09999999999999996e23 or 1.25e-27 < delta

      1. Initial program 99.8%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in phi1 around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\cos delta}} \]
      4. Step-by-step derivation
        1. cos-lowering-cos.f6483.5

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\cos delta}} \]
      5. Simplified83.5%

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

      if -4.09999999999999996e23 < delta < 1.25e-27

      1. Initial program 99.6%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Applied egg-rr99.7%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
      4. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) - \frac{1}{2}\right)} + \cos delta\right)} \]
      5. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} + \cos delta\right)} \]
        2. metadata-evalN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \color{blue}{\frac{-1}{2}}\right) + \cos delta\right)} \]
        3. accelerator-lowering-fma.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{-1}{2}\right)} + \cos delta\right)} \]
        4. cos-lowering-cos.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(2 \cdot \phi_1\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
        5. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
        6. *-lowering-*.f6498.0

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, -0.5\right) + \cos delta\right)} \]
      6. Simplified98.0%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot 2\right), -0.5\right)} + \cos delta\right)} \]
      7. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)}} \]
      8. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \frac{1}{2}}} \]
        2. accelerator-lowering-fma.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{1}{2}\right)}} \]
        3. metadata-evalN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot \phi_1\right), \frac{1}{2}\right)} \]
        4. distribute-lft-neg-inN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\mathsf{neg}\left(-2 \cdot \phi_1\right)\right)}, \frac{1}{2}\right)} \]
        5. cos-negN/A

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(-2 \cdot \phi_1\right)}, \frac{1}{2}\right)} \]
        7. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, \frac{1}{2}\right)} \]
        8. *-lowering-*.f6497.9

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, 0.5\right)} \]
      9. Simplified97.9%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}} \]
      10. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\phi_1 \cdot -2\right), \frac{1}{2}\right)} \]
        2. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \color{blue}{\left(\cos \phi_1 \cdot \sin delta\right)}}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\phi_1 \cdot -2\right), \frac{1}{2}\right)} \]
        3. associate-*r*N/A

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

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

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

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \color{blue}{\cos \phi_1}\right) \cdot \sin delta}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\phi_1 \cdot -2\right), \frac{1}{2}\right)} \]
        8. sin-lowering-sin.f6497.9

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \cos \phi_1\right) \cdot \color{blue}{\sin delta}}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)} \]
      11. Applied egg-rr97.9%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(\sin theta \cdot \cos \phi_1\right) \cdot \sin delta}}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification90.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\sin theta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 11: 91.5% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \mathbf{if}\;delta \leq -0.000215:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;delta \leq 5 \cdot 10^{-29}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (lambda1 phi1 phi2 delta theta)
     :precision binary64
     (let* ((t_1
             (+
              lambda1
              (atan2 (* (cos phi1) (* (sin theta) (sin delta))) (cos delta)))))
       (if (<= delta -0.000215)
         t_1
         (if (<= delta 5e-29)
           (+
            lambda1
            (atan2
             (* (cos phi1) (* (sin theta) delta))
             (fma 0.5 (cos (* phi1 -2.0)) 0.5)))
           t_1))))
    double code(double lambda1, double phi1, double phi2, double delta, double theta) {
    	double t_1 = lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), cos(delta));
    	double tmp;
    	if (delta <= -0.000215) {
    		tmp = t_1;
    	} else if (delta <= 5e-29) {
    		tmp = lambda1 + atan2((cos(phi1) * (sin(theta) * delta)), fma(0.5, cos((phi1 * -2.0)), 0.5));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(lambda1, phi1, phi2, delta, theta)
    	t_1 = Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * sin(delta))), cos(delta)))
    	tmp = 0.0
    	if (delta <= -0.000215)
    		tmp = t_1;
    	elseif (delta <= 5e-29)
    		tmp = Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * delta)), fma(0.5, cos(Float64(phi1 * -2.0)), 0.5)));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[delta, -0.000215], t$95$1, If[LessEqual[delta, 5e-29], N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * delta), $MachinePrecision]), $MachinePrecision] / N[(0.5 * N[Cos[N[(phi1 * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\
    \mathbf{if}\;delta \leq -0.000215:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;delta \leq 5 \cdot 10^{-29}:\\
    \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if delta < -2.14999999999999995e-4 or 4.99999999999999986e-29 < delta

      1. Initial program 99.7%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in phi1 around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\cos delta}} \]
      4. Step-by-step derivation
        1. cos-lowering-cos.f6482.4

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\cos delta}} \]
      5. Simplified82.4%

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

      if -2.14999999999999995e-4 < delta < 4.99999999999999986e-29

      1. Initial program 99.7%

        \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
      2. Add Preprocessing
      3. Applied egg-rr99.8%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
      4. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) - \frac{1}{2}\right)} + \cos delta\right)} \]
      5. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} + \cos delta\right)} \]
        2. metadata-evalN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \color{blue}{\frac{-1}{2}}\right) + \cos delta\right)} \]
        3. accelerator-lowering-fma.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{-1}{2}\right)} + \cos delta\right)} \]
        4. cos-lowering-cos.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(2 \cdot \phi_1\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
        5. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
        6. *-lowering-*.f6499.8

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, -0.5\right) + \cos delta\right)} \]
      6. Simplified99.8%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot 2\right), -0.5\right)} + \cos delta\right)} \]
      7. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)}} \]
      8. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \frac{1}{2}}} \]
        2. accelerator-lowering-fma.f64N/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{1}{2}\right)}} \]
        3. metadata-evalN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot \phi_1\right), \frac{1}{2}\right)} \]
        4. distribute-lft-neg-inN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\mathsf{neg}\left(-2 \cdot \phi_1\right)\right)}, \frac{1}{2}\right)} \]
        5. cos-negN/A

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(-2 \cdot \phi_1\right)}, \frac{1}{2}\right)} \]
        7. *-commutativeN/A

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, \frac{1}{2}\right)} \]
        8. *-lowering-*.f6499.8

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, 0.5\right)} \]
      9. Simplified99.8%

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}} \]
      10. Taylor expanded in delta around 0

        \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \color{blue}{delta}\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\phi_1 \cdot -2\right), \frac{1}{2}\right)} \]
      11. Step-by-step derivation
        1. Simplified99.8%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \color{blue}{delta}\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)} \]
      12. Recombined 2 regimes into one program.
      13. Final simplification90.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;delta \leq -0.000215:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 5 \cdot 10^{-29}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta}\\ \end{array} \]
      14. Add Preprocessing

      Alternative 12: 88.9% accurate, 3.1× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\ \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (lambda1 phi1 phi2 delta theta)
       :precision binary64
       (let* ((t_1 (+ lambda1 (atan2 (* (sin theta) (sin delta)) (cos delta)))))
         (if (<= delta -4.1e+23)
           t_1
           (if (<= delta 1.25e-27)
             (+
              lambda1
              (atan2
               (* (cos phi1) (* (sin theta) delta))
               (fma 0.5 (cos (* phi1 -2.0)) 0.5)))
             t_1))))
      double code(double lambda1, double phi1, double phi2, double delta, double theta) {
      	double t_1 = lambda1 + atan2((sin(theta) * sin(delta)), cos(delta));
      	double tmp;
      	if (delta <= -4.1e+23) {
      		tmp = t_1;
      	} else if (delta <= 1.25e-27) {
      		tmp = lambda1 + atan2((cos(phi1) * (sin(theta) * delta)), fma(0.5, cos((phi1 * -2.0)), 0.5));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(lambda1, phi1, phi2, delta, theta)
      	t_1 = Float64(lambda1 + atan(Float64(sin(theta) * sin(delta)), cos(delta)))
      	tmp = 0.0
      	if (delta <= -4.1e+23)
      		tmp = t_1;
      	elseif (delta <= 1.25e-27)
      		tmp = Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * delta)), fma(0.5, cos(Float64(phi1 * -2.0)), 0.5)));
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[delta, -4.1e+23], t$95$1, If[LessEqual[delta, 1.25e-27], N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * delta), $MachinePrecision]), $MachinePrecision] / N[(0.5 * N[Cos[N[(phi1 * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\
      \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\
      \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if delta < -4.09999999999999996e23 or 1.25e-27 < delta

        1. Initial program 99.8%

          \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in phi1 around 0

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. sin-lowering-sin.f64N/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          3. sin-lowering-sin.f6482.2

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        5. Simplified82.2%

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
        7. Step-by-step derivation
          1. cos-lowering-cos.f6480.1

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
        8. Simplified80.1%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]

        if -4.09999999999999996e23 < delta < 1.25e-27

        1. Initial program 99.6%

          \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        2. Add Preprocessing
        3. Applied egg-rr99.7%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
        4. Taylor expanded in delta around 0

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) - \frac{1}{2}\right)} + \cos delta\right)} \]
        5. Step-by-step derivation
          1. sub-negN/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} + \cos delta\right)} \]
          2. metadata-evalN/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \color{blue}{\frac{-1}{2}}\right) + \cos delta\right)} \]
          3. accelerator-lowering-fma.f64N/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{-1}{2}\right)} + \cos delta\right)} \]
          4. cos-lowering-cos.f64N/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(2 \cdot \phi_1\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
          5. *-commutativeN/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
          6. *-lowering-*.f6498.0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, -0.5\right) + \cos delta\right)} \]
        6. Simplified98.0%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot 2\right), -0.5\right)} + \cos delta\right)} \]
        7. Taylor expanded in delta around 0

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)}} \]
        8. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \frac{1}{2}}} \]
          2. accelerator-lowering-fma.f64N/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{1}{2}\right)}} \]
          3. metadata-evalN/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot \phi_1\right), \frac{1}{2}\right)} \]
          4. distribute-lft-neg-inN/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\mathsf{neg}\left(-2 \cdot \phi_1\right)\right)}, \frac{1}{2}\right)} \]
          5. cos-negN/A

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(-2 \cdot \phi_1\right)}, \frac{1}{2}\right)} \]
          7. *-commutativeN/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, \frac{1}{2}\right)} \]
          8. *-lowering-*.f6497.9

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, 0.5\right)} \]
        9. Simplified97.9%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}} \]
        10. Taylor expanded in delta around 0

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \color{blue}{delta}\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\phi_1 \cdot -2\right), \frac{1}{2}\right)} \]
        11. Step-by-step derivation
          1. Simplified97.8%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \color{blue}{delta}\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)} \]
        12. Recombined 2 regimes into one program.
        13. Final simplification89.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;delta \leq -4.1 \cdot 10^{+23}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\ \mathbf{elif}\;delta \leq 1.25 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\ \end{array} \]
        14. Add Preprocessing

        Alternative 13: 85.3% accurate, 3.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\phi_1 \leq 1350000000000:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(theta \cdot \sin delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \end{array} \end{array} \]
        (FPCore (lambda1 phi1 phi2 delta theta)
         :precision binary64
         (if (<= phi1 1350000000000.0)
           (+ lambda1 (atan2 (* (sin theta) (sin delta)) (cos delta)))
           (+
            lambda1
            (atan2
             (* (cos phi1) (* theta (sin delta)))
             (fma 0.5 (cos (* phi1 -2.0)) 0.5)))))
        double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	double tmp;
        	if (phi1 <= 1350000000000.0) {
        		tmp = lambda1 + atan2((sin(theta) * sin(delta)), cos(delta));
        	} else {
        		tmp = lambda1 + atan2((cos(phi1) * (theta * sin(delta))), fma(0.5, cos((phi1 * -2.0)), 0.5));
        	}
        	return tmp;
        }
        
        function code(lambda1, phi1, phi2, delta, theta)
        	tmp = 0.0
        	if (phi1 <= 1350000000000.0)
        		tmp = Float64(lambda1 + atan(Float64(sin(theta) * sin(delta)), cos(delta)));
        	else
        		tmp = Float64(lambda1 + atan(Float64(cos(phi1) * Float64(theta * sin(delta))), fma(0.5, cos(Float64(phi1 * -2.0)), 0.5)));
        	end
        	return tmp
        end
        
        code[lambda1_, phi1_, phi2_, delta_, theta_] := If[LessEqual[phi1, 1350000000000.0], N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(theta * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.5 * N[Cos[N[(phi1 * -2.0), $MachinePrecision]], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\phi_1 \leq 1350000000000:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\
        
        \mathbf{else}:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(theta \cdot \sin delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi1 < 1.35e12

          1. Initial program 99.9%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6491.4

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified91.4%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6491.1

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified91.1%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]

          if 1.35e12 < phi1

          1. Initial program 99.3%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Applied egg-rr99.6%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(-\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \phi_1\right)\right) \cdot \cos delta\right) + \cos delta\right)}} \]
          4. Taylor expanded in delta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) - \frac{1}{2}\right)} + \cos delta\right)} \]
          5. Step-by-step derivation
            1. sub-negN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} + \cos delta\right)} \]
            2. metadata-evalN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \left(\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \color{blue}{\frac{-1}{2}}\right) + \cos delta\right)} \]
            3. accelerator-lowering-fma.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{-1}{2}\right)} + \cos delta\right)} \]
            4. cos-lowering-cos.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(2 \cdot \phi_1\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
            5. *-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, \frac{-1}{2}\right) + \cos delta\right)} \]
            6. *-lowering-*.f6482.9

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot 2\right)}, -0.5\right) + \cos delta\right)} \]
          6. Simplified82.9%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\left(-\sin \phi_1\right) \cdot \left(\cos theta \cdot \cos \phi_1\right), \sin delta, \color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot 2\right), -0.5\right)} + \cos delta\right)} \]
          7. Taylor expanded in delta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} + \frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right)}} \]
          8. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{1}{2} \cdot \cos \left(2 \cdot \phi_1\right) + \frac{1}{2}}} \]
            2. accelerator-lowering-fma.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(2 \cdot \phi_1\right), \frac{1}{2}\right)}} \]
            3. metadata-evalN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\color{blue}{\left(\mathsf{neg}\left(-2\right)\right)} \cdot \phi_1\right), \frac{1}{2}\right)} \]
            4. distribute-lft-neg-inN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\mathsf{neg}\left(-2 \cdot \phi_1\right)\right)}, \frac{1}{2}\right)} \]
            5. cos-negN/A

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\cos \left(-2 \cdot \phi_1\right)}, \frac{1}{2}\right)} \]
            7. *-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, \frac{1}{2}\right)} \]
            8. *-lowering-*.f6476.7

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \color{blue}{\left(\phi_1 \cdot -2\right)}, 0.5\right)} \]
          9. Simplified76.7%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}} \]
          10. Taylor expanded in theta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(theta \cdot \sin delta\right)} \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\phi_1 \cdot -2\right), \frac{1}{2}\right)} \]
          11. Step-by-step derivation
            1. *-commutativeN/A

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\left(\sin delta \cdot theta\right)} \cdot \cos \phi_1}{\mathsf{fma}\left(\frac{1}{2}, \cos \left(\phi_1 \cdot -2\right), \frac{1}{2}\right)} \]
            3. sin-lowering-sin.f6468.2

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\color{blue}{\sin delta} \cdot theta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)} \]
          12. Simplified68.2%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq 1350000000000:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(theta \cdot \sin delta\right)}{\mathsf{fma}\left(0.5, \cos \left(\phi_1 \cdot -2\right), 0.5\right)}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 14: 86.2% accurate, 3.3× speedup?

        \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta} \end{array} \]
        (FPCore (lambda1 phi1 phi2 delta theta)
         :precision binary64
         (+ lambda1 (atan2 (* (sin theta) (sin delta)) (cos delta))))
        double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	return lambda1 + atan2((sin(theta) * sin(delta)), cos(delta));
        }
        
        real(8) function code(lambda1, phi1, phi2, delta, theta)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8), intent (in) :: delta
            real(8), intent (in) :: theta
            code = lambda1 + atan2((sin(theta) * sin(delta)), cos(delta))
        end function
        
        public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	return lambda1 + Math.atan2((Math.sin(theta) * Math.sin(delta)), Math.cos(delta));
        }
        
        def code(lambda1, phi1, phi2, delta, theta):
        	return lambda1 + math.atan2((math.sin(theta) * math.sin(delta)), math.cos(delta))
        
        function code(lambda1, phi1, phi2, delta, theta)
        	return Float64(lambda1 + atan(Float64(sin(theta) * sin(delta)), cos(delta)))
        end
        
        function tmp = code(lambda1, phi1, phi2, delta, theta)
        	tmp = lambda1 + atan2((sin(theta) * sin(delta)), cos(delta));
        end
        
        code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}
        \end{array}
        
        Derivation
        1. Initial program 99.7%

          \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in phi1 around 0

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. sin-lowering-sin.f64N/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          3. sin-lowering-sin.f6484.4

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        5. Simplified84.4%

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
        7. Step-by-step derivation
          1. cos-lowering-cos.f6483.4

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
        8. Simplified83.4%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
        9. Final simplification83.4%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta} \]
        10. Add Preprocessing

        Alternative 15: 80.7% accurate, 3.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;delta \leq -9500000:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, -0.16666666666666666 \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 4.5 \cdot 10^{-22}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\mathsf{fma}\left(theta \cdot theta, 0.008333333333333333, -0.16666666666666666\right), theta \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\ \end{array} \end{array} \]
        (FPCore (lambda1 phi1 phi2 delta theta)
         :precision binary64
         (if (<= delta -9500000.0)
           (+
            lambda1
            (atan2
             (* (sin delta) (fma theta (* -0.16666666666666666 (* theta theta)) theta))
             (cos delta)))
           (if (<= delta 4.5e-22)
             (+ lambda1 (atan2 (* (sin theta) delta) (cos delta)))
             (+
              lambda1
              (atan2
               (*
                (sin delta)
                (fma
                 (fma (* theta theta) 0.008333333333333333 -0.16666666666666666)
                 (* theta (* theta theta))
                 theta))
               (cos delta))))))
        double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	double tmp;
        	if (delta <= -9500000.0) {
        		tmp = lambda1 + atan2((sin(delta) * fma(theta, (-0.16666666666666666 * (theta * theta)), theta)), cos(delta));
        	} else if (delta <= 4.5e-22) {
        		tmp = lambda1 + atan2((sin(theta) * delta), cos(delta));
        	} else {
        		tmp = lambda1 + atan2((sin(delta) * fma(fma((theta * theta), 0.008333333333333333, -0.16666666666666666), (theta * (theta * theta)), theta)), cos(delta));
        	}
        	return tmp;
        }
        
        function code(lambda1, phi1, phi2, delta, theta)
        	tmp = 0.0
        	if (delta <= -9500000.0)
        		tmp = Float64(lambda1 + atan(Float64(sin(delta) * fma(theta, Float64(-0.16666666666666666 * Float64(theta * theta)), theta)), cos(delta)));
        	elseif (delta <= 4.5e-22)
        		tmp = Float64(lambda1 + atan(Float64(sin(theta) * delta), cos(delta)));
        	else
        		tmp = Float64(lambda1 + atan(Float64(sin(delta) * fma(fma(Float64(theta * theta), 0.008333333333333333, -0.16666666666666666), Float64(theta * Float64(theta * theta)), theta)), cos(delta)));
        	end
        	return tmp
        end
        
        code[lambda1_, phi1_, phi2_, delta_, theta_] := If[LessEqual[delta, -9500000.0], N[(lambda1 + N[ArcTan[N[(N[Sin[delta], $MachinePrecision] * N[(theta * N[(-0.16666666666666666 * N[(theta * theta), $MachinePrecision]), $MachinePrecision] + theta), $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[delta, 4.5e-22], N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * delta), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[(N[Sin[delta], $MachinePrecision] * N[(N[(N[(theta * theta), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] * N[(theta * N[(theta * theta), $MachinePrecision]), $MachinePrecision] + theta), $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;delta \leq -9500000:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, -0.16666666666666666 \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\
        
        \mathbf{elif}\;delta \leq 4.5 \cdot 10^{-22}:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\
        
        \mathbf{else}:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\mathsf{fma}\left(theta \cdot theta, 0.008333333333333333, -0.16666666666666666\right), theta \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if delta < -9.5e6

          1. Initial program 99.6%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6476.3

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified76.3%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6473.9

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified73.9%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          9. Taylor expanded in theta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\left(theta \cdot \left(1 + \frac{-1}{6} \cdot {theta}^{2}\right)\right)}}{\cos delta} \]
          10. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(theta \cdot \color{blue}{\left(\frac{-1}{6} \cdot {theta}^{2} + 1\right)}\right)}{\cos delta} \]
            2. distribute-lft-inN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\left(theta \cdot \left(\frac{-1}{6} \cdot {theta}^{2}\right) + theta \cdot 1\right)}}{\cos delta} \]
            3. *-rgt-identityN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(theta \cdot \left(\frac{-1}{6} \cdot {theta}^{2}\right) + \color{blue}{theta}\right)}{\cos delta} \]
            4. accelerator-lowering-fma.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\mathsf{fma}\left(theta, \frac{-1}{6} \cdot {theta}^{2}, theta\right)}}{\cos delta} \]
            5. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, \color{blue}{\frac{-1}{6} \cdot {theta}^{2}}, theta\right)}{\cos delta} \]
            6. unpow2N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, \frac{-1}{6} \cdot \color{blue}{\left(theta \cdot theta\right)}, theta\right)}{\cos delta} \]
            7. *-lowering-*.f6461.0

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, -0.16666666666666666 \cdot \color{blue}{\left(theta \cdot theta\right)}, theta\right)}{\cos delta} \]
          11. Simplified61.0%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\mathsf{fma}\left(theta, -0.16666666666666666 \cdot \left(theta \cdot theta\right), theta\right)}}{\cos delta} \]

          if -9.5e6 < delta < 4.49999999999999987e-22

          1. Initial program 99.7%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6487.6

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified87.6%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6487.5

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified87.5%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          9. Taylor expanded in delta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
          10. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
            2. sin-lowering-sin.f6487.4

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{delta \cdot \color{blue}{\sin theta}}{\cos delta} \]
          11. Simplified87.4%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]

          if 4.49999999999999987e-22 < delta

          1. Initial program 99.8%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6484.7

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified84.7%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6482.9

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified82.9%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          9. Taylor expanded in theta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\left(theta \cdot \left(1 + {theta}^{2} \cdot \left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right)\right)\right)}}{\cos delta} \]
          10. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(theta \cdot \color{blue}{\left({theta}^{2} \cdot \left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right) + 1\right)}\right)}{\cos delta} \]
            2. distribute-rgt-inN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\left(\left({theta}^{2} \cdot \left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right)\right) \cdot theta + 1 \cdot theta\right)}}{\cos delta} \]
            3. *-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\color{blue}{\left(\left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right) \cdot {theta}^{2}\right)} \cdot theta + 1 \cdot theta\right)}{\cos delta} \]
            4. associate-*l*N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\color{blue}{\left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right) \cdot \left({theta}^{2} \cdot theta\right)} + 1 \cdot theta\right)}{\cos delta} \]
            5. pow-plusN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right) \cdot \color{blue}{{theta}^{\left(2 + 1\right)}} + 1 \cdot theta\right)}{\cos delta} \]
            6. metadata-evalN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right) \cdot {theta}^{\color{blue}{3}} + 1 \cdot theta\right)}{\cos delta} \]
            7. cube-unmultN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right) \cdot \color{blue}{\left(theta \cdot \left(theta \cdot theta\right)\right)} + 1 \cdot theta\right)}{\cos delta} \]
            8. unpow2N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right) \cdot \left(theta \cdot \color{blue}{{theta}^{2}}\right) + 1 \cdot theta\right)}{\cos delta} \]
            9. *-lft-identityN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}\right) \cdot \left(theta \cdot {theta}^{2}\right) + \color{blue}{theta}\right)}{\cos delta} \]
            10. accelerator-lowering-fma.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{120} \cdot {theta}^{2} - \frac{1}{6}, theta \cdot {theta}^{2}, theta\right)}}{\cos delta} \]
            11. sub-negN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\color{blue}{\frac{1}{120} \cdot {theta}^{2} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, theta \cdot {theta}^{2}, theta\right)}{\cos delta} \]
            12. *-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\color{blue}{{theta}^{2} \cdot \frac{1}{120}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), theta \cdot {theta}^{2}, theta\right)}{\cos delta} \]
            13. metadata-evalN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left({theta}^{2} \cdot \frac{1}{120} + \color{blue}{\frac{-1}{6}}, theta \cdot {theta}^{2}, theta\right)}{\cos delta} \]
            14. accelerator-lowering-fma.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left({theta}^{2}, \frac{1}{120}, \frac{-1}{6}\right)}, theta \cdot {theta}^{2}, theta\right)}{\cos delta} \]
            15. unpow2N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{theta \cdot theta}, \frac{1}{120}, \frac{-1}{6}\right), theta \cdot {theta}^{2}, theta\right)}{\cos delta} \]
            16. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{theta \cdot theta}, \frac{1}{120}, \frac{-1}{6}\right), theta \cdot {theta}^{2}, theta\right)}{\cos delta} \]
            17. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\mathsf{fma}\left(theta \cdot theta, \frac{1}{120}, \frac{-1}{6}\right), \color{blue}{theta \cdot {theta}^{2}}, theta\right)}{\cos delta} \]
            18. unpow2N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\mathsf{fma}\left(theta \cdot theta, \frac{1}{120}, \frac{-1}{6}\right), theta \cdot \color{blue}{\left(theta \cdot theta\right)}, theta\right)}{\cos delta} \]
            19. *-lowering-*.f6471.8

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\mathsf{fma}\left(theta \cdot theta, 0.008333333333333333, -0.16666666666666666\right), theta \cdot \color{blue}{\left(theta \cdot theta\right)}, theta\right)}{\cos delta} \]
          11. Simplified71.8%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(theta \cdot theta, 0.008333333333333333, -0.16666666666666666\right), theta \cdot \left(theta \cdot theta\right), theta\right)}}{\cos delta} \]
        3. Recombined 3 regimes into one program.
        4. Final simplification77.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;delta \leq -9500000:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, -0.16666666666666666 \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 4.5 \cdot 10^{-22}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(\mathsf{fma}\left(theta \cdot theta, 0.008333333333333333, -0.16666666666666666\right), theta \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 16: 80.7% accurate, 4.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;delta \leq -15000000:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, -0.16666666666666666 \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 4.5 \cdot 10^{-22}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\ \end{array} \end{array} \]
        (FPCore (lambda1 phi1 phi2 delta theta)
         :precision binary64
         (if (<= delta -15000000.0)
           (+
            lambda1
            (atan2
             (* (sin delta) (fma theta (* -0.16666666666666666 (* theta theta)) theta))
             (cos delta)))
           (if (<= delta 4.5e-22)
             (+ lambda1 (atan2 (* (sin theta) delta) (cos delta)))
             (+ lambda1 (atan2 (* theta (sin delta)) (cos delta))))))
        double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	double tmp;
        	if (delta <= -15000000.0) {
        		tmp = lambda1 + atan2((sin(delta) * fma(theta, (-0.16666666666666666 * (theta * theta)), theta)), cos(delta));
        	} else if (delta <= 4.5e-22) {
        		tmp = lambda1 + atan2((sin(theta) * delta), cos(delta));
        	} else {
        		tmp = lambda1 + atan2((theta * sin(delta)), cos(delta));
        	}
        	return tmp;
        }
        
        function code(lambda1, phi1, phi2, delta, theta)
        	tmp = 0.0
        	if (delta <= -15000000.0)
        		tmp = Float64(lambda1 + atan(Float64(sin(delta) * fma(theta, Float64(-0.16666666666666666 * Float64(theta * theta)), theta)), cos(delta)));
        	elseif (delta <= 4.5e-22)
        		tmp = Float64(lambda1 + atan(Float64(sin(theta) * delta), cos(delta)));
        	else
        		tmp = Float64(lambda1 + atan(Float64(theta * sin(delta)), cos(delta)));
        	end
        	return tmp
        end
        
        code[lambda1_, phi1_, phi2_, delta_, theta_] := If[LessEqual[delta, -15000000.0], N[(lambda1 + N[ArcTan[N[(N[Sin[delta], $MachinePrecision] * N[(theta * N[(-0.16666666666666666 * N[(theta * theta), $MachinePrecision]), $MachinePrecision] + theta), $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[delta, 4.5e-22], N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * delta), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[(theta * N[Sin[delta], $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;delta \leq -15000000:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, -0.16666666666666666 \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\
        
        \mathbf{elif}\;delta \leq 4.5 \cdot 10^{-22}:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\
        
        \mathbf{else}:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if delta < -1.5e7

          1. Initial program 99.6%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6476.3

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified76.3%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6473.9

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified73.9%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          9. Taylor expanded in theta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\left(theta \cdot \left(1 + \frac{-1}{6} \cdot {theta}^{2}\right)\right)}}{\cos delta} \]
          10. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(theta \cdot \color{blue}{\left(\frac{-1}{6} \cdot {theta}^{2} + 1\right)}\right)}{\cos delta} \]
            2. distribute-lft-inN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\left(theta \cdot \left(\frac{-1}{6} \cdot {theta}^{2}\right) + theta \cdot 1\right)}}{\cos delta} \]
            3. *-rgt-identityN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(theta \cdot \left(\frac{-1}{6} \cdot {theta}^{2}\right) + \color{blue}{theta}\right)}{\cos delta} \]
            4. accelerator-lowering-fma.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\mathsf{fma}\left(theta, \frac{-1}{6} \cdot {theta}^{2}, theta\right)}}{\cos delta} \]
            5. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, \color{blue}{\frac{-1}{6} \cdot {theta}^{2}}, theta\right)}{\cos delta} \]
            6. unpow2N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, \frac{-1}{6} \cdot \color{blue}{\left(theta \cdot theta\right)}, theta\right)}{\cos delta} \]
            7. *-lowering-*.f6461.0

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, -0.16666666666666666 \cdot \color{blue}{\left(theta \cdot theta\right)}, theta\right)}{\cos delta} \]
          11. Simplified61.0%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\mathsf{fma}\left(theta, -0.16666666666666666 \cdot \left(theta \cdot theta\right), theta\right)}}{\cos delta} \]

          if -1.5e7 < delta < 4.49999999999999987e-22

          1. Initial program 99.7%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6487.6

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified87.6%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6487.5

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified87.5%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          9. Taylor expanded in delta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
          10. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
            2. sin-lowering-sin.f6487.4

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{delta \cdot \color{blue}{\sin theta}}{\cos delta} \]
          11. Simplified87.4%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]

          if 4.49999999999999987e-22 < delta

          1. Initial program 99.8%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6484.7

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified84.7%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6482.9

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified82.9%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          9. Taylor expanded in theta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{theta \cdot \sin delta}}{\cos delta} \]
          10. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot theta}}{\cos delta} \]
            2. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot theta}}{\cos delta} \]
            3. sin-lowering-sin.f6471.4

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot theta}{\cos delta} \]
          11. Simplified71.4%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot theta}}{\cos delta} \]
        3. Recombined 3 regimes into one program.
        4. Final simplification77.3%

          \[\leadsto \begin{array}{l} \mathbf{if}\;delta \leq -15000000:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{fma}\left(theta, -0.16666666666666666 \cdot \left(theta \cdot theta\right), theta\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 4.5 \cdot 10^{-22}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 17: 77.9% accurate, 4.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;delta \leq 4.5 \cdot 10^{-22}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\ \end{array} \end{array} \]
        (FPCore (lambda1 phi1 phi2 delta theta)
         :precision binary64
         (if (<= delta 4.5e-22)
           (+ lambda1 (atan2 (* (sin theta) delta) (cos delta)))
           (+ lambda1 (atan2 (* theta (sin delta)) (cos delta)))))
        double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	double tmp;
        	if (delta <= 4.5e-22) {
        		tmp = lambda1 + atan2((sin(theta) * delta), cos(delta));
        	} else {
        		tmp = lambda1 + atan2((theta * sin(delta)), cos(delta));
        	}
        	return tmp;
        }
        
        real(8) function code(lambda1, phi1, phi2, delta, theta)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8), intent (in) :: delta
            real(8), intent (in) :: theta
            real(8) :: tmp
            if (delta <= 4.5d-22) then
                tmp = lambda1 + atan2((sin(theta) * delta), cos(delta))
            else
                tmp = lambda1 + atan2((theta * sin(delta)), cos(delta))
            end if
            code = tmp
        end function
        
        public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	double tmp;
        	if (delta <= 4.5e-22) {
        		tmp = lambda1 + Math.atan2((Math.sin(theta) * delta), Math.cos(delta));
        	} else {
        		tmp = lambda1 + Math.atan2((theta * Math.sin(delta)), Math.cos(delta));
        	}
        	return tmp;
        }
        
        def code(lambda1, phi1, phi2, delta, theta):
        	tmp = 0
        	if delta <= 4.5e-22:
        		tmp = lambda1 + math.atan2((math.sin(theta) * delta), math.cos(delta))
        	else:
        		tmp = lambda1 + math.atan2((theta * math.sin(delta)), math.cos(delta))
        	return tmp
        
        function code(lambda1, phi1, phi2, delta, theta)
        	tmp = 0.0
        	if (delta <= 4.5e-22)
        		tmp = Float64(lambda1 + atan(Float64(sin(theta) * delta), cos(delta)));
        	else
        		tmp = Float64(lambda1 + atan(Float64(theta * sin(delta)), cos(delta)));
        	end
        	return tmp
        end
        
        function tmp_2 = code(lambda1, phi1, phi2, delta, theta)
        	tmp = 0.0;
        	if (delta <= 4.5e-22)
        		tmp = lambda1 + atan2((sin(theta) * delta), cos(delta));
        	else
        		tmp = lambda1 + atan2((theta * sin(delta)), cos(delta));
        	end
        	tmp_2 = tmp;
        end
        
        code[lambda1_, phi1_, phi2_, delta_, theta_] := If[LessEqual[delta, 4.5e-22], N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * delta), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(lambda1 + N[ArcTan[N[(theta * N[Sin[delta], $MachinePrecision]), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;delta \leq 4.5 \cdot 10^{-22}:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\
        
        \mathbf{else}:\\
        \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if delta < 4.49999999999999987e-22

          1. Initial program 99.7%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6484.3

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified84.3%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6483.5

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified83.5%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          9. Taylor expanded in delta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
          10. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
            2. sin-lowering-sin.f6477.3

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{delta \cdot \color{blue}{\sin theta}}{\cos delta} \]
          11. Simplified77.3%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]

          if 4.49999999999999987e-22 < delta

          1. Initial program 99.8%

            \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in phi1 around 0

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

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            2. sin-lowering-sin.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
            3. sin-lowering-sin.f6484.7

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          5. Simplified84.7%

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          7. Step-by-step derivation
            1. cos-lowering-cos.f6482.9

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          8. Simplified82.9%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
          9. Taylor expanded in theta around 0

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{theta \cdot \sin delta}}{\cos delta} \]
          10. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot theta}}{\cos delta} \]
            2. *-lowering-*.f64N/A

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot theta}}{\cos delta} \]
            3. sin-lowering-sin.f6471.4

              \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot theta}{\cos delta} \]
          11. Simplified71.4%

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot theta}}{\cos delta} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification75.6%

          \[\leadsto \begin{array}{l} \mathbf{if}\;delta \leq 4.5 \cdot 10^{-22}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 18: 75.0% accurate, 4.3× speedup?

        \[\begin{array}{l} \\ \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta} \end{array} \]
        (FPCore (lambda1 phi1 phi2 delta theta)
         :precision binary64
         (+ lambda1 (atan2 (* (sin theta) delta) (cos delta))))
        double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	return lambda1 + atan2((sin(theta) * delta), cos(delta));
        }
        
        real(8) function code(lambda1, phi1, phi2, delta, theta)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8), intent (in) :: delta
            real(8), intent (in) :: theta
            code = lambda1 + atan2((sin(theta) * delta), cos(delta))
        end function
        
        public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	return lambda1 + Math.atan2((Math.sin(theta) * delta), Math.cos(delta));
        }
        
        def code(lambda1, phi1, phi2, delta, theta):
        	return lambda1 + math.atan2((math.sin(theta) * delta), math.cos(delta))
        
        function code(lambda1, phi1, phi2, delta, theta)
        	return Float64(lambda1 + atan(Float64(sin(theta) * delta), cos(delta)))
        end
        
        function tmp = code(lambda1, phi1, phi2, delta, theta)
        	tmp = lambda1 + atan2((sin(theta) * delta), cos(delta));
        end
        
        code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[(N[Sin[theta], $MachinePrecision] * delta), $MachinePrecision] / N[Cos[delta], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}
        \end{array}
        
        Derivation
        1. Initial program 99.7%

          \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in phi1 around 0

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

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta \cdot \sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          2. sin-lowering-sin.f64N/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{\sin delta} \cdot \sin theta}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
          3. sin-lowering-sin.f6484.4

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \color{blue}{\sin theta}}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        5. Simplified84.4%

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

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
        7. Step-by-step derivation
          1. cos-lowering-cos.f6483.4

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
        8. Simplified83.4%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\color{blue}{\cos delta}} \]
        9. Taylor expanded in delta around 0

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
        10. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
          2. sin-lowering-sin.f6472.9

            \[\leadsto \lambda_1 + \tan^{-1}_* \frac{delta \cdot \color{blue}{\sin theta}}{\cos delta} \]
        11. Simplified72.9%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\color{blue}{delta \cdot \sin theta}}{\cos delta} \]
        12. Final simplification72.9%

          \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta} \]
        13. Add Preprocessing

        Alternative 19: 70.5% accurate, 1341.0× speedup?

        \[\begin{array}{l} \\ \lambda_1 \end{array} \]
        (FPCore (lambda1 phi1 phi2 delta theta) :precision binary64 lambda1)
        double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	return lambda1;
        }
        
        real(8) function code(lambda1, phi1, phi2, delta, theta)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8), intent (in) :: delta
            real(8), intent (in) :: theta
            code = lambda1
        end function
        
        public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
        	return lambda1;
        }
        
        def code(lambda1, phi1, phi2, delta, theta):
        	return lambda1
        
        function code(lambda1, phi1, phi2, delta, theta)
        	return lambda1
        end
        
        function tmp = code(lambda1, phi1, phi2, delta, theta)
        	tmp = lambda1;
        end
        
        code[lambda1_, phi1_, phi2_, delta_, theta_] := lambda1
        
        \begin{array}{l}
        
        \\
        \lambda_1
        \end{array}
        
        Derivation
        1. Initial program 99.7%

          \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in lambda1 around inf

          \[\leadsto \color{blue}{\lambda_1} \]
        4. Step-by-step derivation
          1. Simplified67.6%

            \[\leadsto \color{blue}{\lambda_1} \]
          2. Add Preprocessing

          Reproduce

          ?
          herbie shell --seed 2024207 
          (FPCore (lambda1 phi1 phi2 delta theta)
            :name "Destination given bearing on a great circle"
            :precision binary64
            (+ lambda1 (atan2 (* (* (sin theta) (sin delta)) (cos phi1)) (- (cos delta) (* (sin phi1) (sin (asin (+ (* (sin phi1) (cos delta)) (* (* (cos phi1) (sin delta)) (cos theta))))))))))