Average Error: 0.1 → 0.2
Time: 29.2s
Precision: binary64
Cost: 169408
\[\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)} \]
\[\begin{array}{l} t_1 := \cos delta - \cos \phi_1 \cdot \left(\sin delta \cdot \left(\cos theta \cdot \sin \phi_1\right)\right)\\ t_2 := \cos delta \cdot {\sin \phi_1}^{2}\\ \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\frac{t_1 \cdot t_1 - {t_2}^{2}}{t_1 + t_2}} \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))))))))))
(FPCore (lambda1 phi1 phi2 delta theta)
 :precision binary64
 (let* ((t_1
         (-
          (cos delta)
          (* (cos phi1) (* (sin delta) (* (cos theta) (sin phi1))))))
        (t_2 (* (cos delta) (pow (sin phi1) 2.0))))
   (+
    lambda1
    (atan2
     (* (cos phi1) (* (sin theta) (sin delta)))
     (/ (- (* t_1 t_1) (pow t_2 2.0)) (+ t_1 t_2))))))
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))))))));
}
double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	double t_1 = cos(delta) - (cos(phi1) * (sin(delta) * (cos(theta) * sin(phi1))));
	double t_2 = cos(delta) * pow(sin(phi1), 2.0);
	return lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), (((t_1 * t_1) - pow(t_2, 2.0)) / (t_1 + t_2)));
}
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
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
    t_1 = cos(delta) - (cos(phi1) * (sin(delta) * (cos(theta) * sin(phi1))))
    t_2 = cos(delta) * (sin(phi1) ** 2.0d0)
    code = lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), (((t_1 * t_1) - (t_2 ** 2.0d0)) / (t_1 + t_2)))
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))))))));
}
public static double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	double t_1 = Math.cos(delta) - (Math.cos(phi1) * (Math.sin(delta) * (Math.cos(theta) * Math.sin(phi1))));
	double t_2 = Math.cos(delta) * Math.pow(Math.sin(phi1), 2.0);
	return lambda1 + Math.atan2((Math.cos(phi1) * (Math.sin(theta) * Math.sin(delta))), (((t_1 * t_1) - Math.pow(t_2, 2.0)) / (t_1 + t_2)));
}
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))))))))
def code(lambda1, phi1, phi2, delta, theta):
	t_1 = math.cos(delta) - (math.cos(phi1) * (math.sin(delta) * (math.cos(theta) * math.sin(phi1))))
	t_2 = math.cos(delta) * math.pow(math.sin(phi1), 2.0)
	return lambda1 + math.atan2((math.cos(phi1) * (math.sin(theta) * math.sin(delta))), (((t_1 * t_1) - math.pow(t_2, 2.0)) / (t_1 + t_2)))
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 code(lambda1, phi1, phi2, delta, theta)
	t_1 = Float64(cos(delta) - Float64(cos(phi1) * Float64(sin(delta) * Float64(cos(theta) * sin(phi1)))))
	t_2 = Float64(cos(delta) * (sin(phi1) ^ 2.0))
	return Float64(lambda1 + atan(Float64(cos(phi1) * Float64(sin(theta) * sin(delta))), Float64(Float64(Float64(t_1 * t_1) - (t_2 ^ 2.0)) / Float64(t_1 + t_2))))
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
function tmp = code(lambda1, phi1, phi2, delta, theta)
	t_1 = cos(delta) - (cos(phi1) * (sin(delta) * (cos(theta) * sin(phi1))));
	t_2 = cos(delta) * (sin(phi1) ^ 2.0);
	tmp = lambda1 + atan2((cos(phi1) * (sin(theta) * sin(delta))), (((t_1 * t_1) - (t_2 ^ 2.0)) / (t_1 + t_2)));
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]
code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = N[(N[Cos[delta], $MachinePrecision] - N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[delta], $MachinePrecision] * N[(N[Cos[theta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[delta], $MachinePrecision] * N[Power[N[Sin[phi1], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, N[(lambda1 + N[ArcTan[N[(N[Cos[phi1], $MachinePrecision] * N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\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)}
\begin{array}{l}
t_1 := \cos delta - \cos \phi_1 \cdot \left(\sin delta \cdot \left(\cos theta \cdot \sin \phi_1\right)\right)\\
t_2 := \cos delta \cdot {\sin \phi_1}^{2}\\
\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\frac{t_1 \cdot t_1 - {t_2}^{2}}{t_1 + t_2}}
\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\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. Applied egg-rr0.1

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

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

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

Alternatives

Alternative 1
Error0.1
Cost84288
\[\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(\sin delta \cdot \cos \phi_1\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\cos \phi_1 \cdot \cos theta, \sin delta, \cos delta \cdot \sin \phi_1\right), -\sin \phi_1, \cos delta\right)} \]
Alternative 2
Error0.1
Cost78208
\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - \left(\cos \phi_1 \cdot \left(\sin \phi_1 \cdot \left(\sin delta \cdot \cos theta\right)\right) + \sin \phi_1 \cdot \left(\cos delta \cdot \sin \phi_1\right)\right)} \]
Alternative 3
Error0.1
Cost71680
\[\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\sin theta \cdot \cos \phi_1\right)}{\cos delta - \sin \phi_1 \cdot \left(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right)} \]
Alternative 4
Error3.2
Cost71616
\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - \left(\cos delta \cdot {\sin \phi_1}^{2} + \sin delta \cdot \left(\cos \phi_1 \cdot \sin \phi_1\right)\right)} \]
Alternative 5
Error3.5
Cost65352
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - {\sin \phi_1}^{2}}\\ \mathbf{if}\;theta \leq -2.3 \cdot 10^{-5}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;theta \leq 10^{-103}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(theta \cdot \sin delta\right)}{\mathsf{fma}\left(\sin delta \cdot \cos \phi_1 + \cos delta \cdot \sin \phi_1, -\sin \phi_1, \cos delta\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error3.2
Cost65152
\[\begin{array}{l} t_1 := \sin delta \cdot \cos \phi_1\\ \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot t_1}{\cos delta - \sin \phi_1 \cdot \left(t_1 + \cos delta \cdot \sin \phi_1\right)} \end{array} \]
Alternative 7
Error3.2
Cost65152
\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - \sin \phi_1 \cdot \left(\sin delta \cdot \cos \phi_1 + \cos delta \cdot \sin \phi_1\right)} \]
Alternative 8
Error3.5
Cost59016
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - {\sin \phi_1}^{2}}\\ \mathbf{if}\;theta \leq -2 \cdot 10^{-46}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;theta \leq 5 \cdot 10^{-102}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(theta \cdot \sin delta\right)}{\cos delta - \sin \phi_1 \cdot \left(\sin delta \cdot \cos \phi_1 + \cos delta \cdot \sin \phi_1\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error5.0
Cost45576
\[\begin{array}{l} t_1 := \sin theta \cdot \cos \phi_1\\ \mathbf{if}\;delta \leq -5.8 \cdot 10^{-8}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot t_1}{\cos delta}\\ \mathbf{elif}\;delta \leq 7.8 \cdot 10^{-26}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos \phi_1 \cdot \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t_1\right)\right)}{\cos delta}\\ \end{array} \]
Alternative 10
Error5.0
Cost45576
\[\begin{array}{l} t_1 := \sin theta \cdot \cos \phi_1\\ \mathbf{if}\;delta \leq -5.8 \cdot 10^{-8}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t_1\right)\right)}{\cos delta}\\ \mathbf{elif}\;delta \leq 7.8 \cdot 10^{-26}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos \phi_1 \cdot \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t_1\right)\right)}{\cos delta}\\ \end{array} \]
Alternative 11
Error4.6
Cost45504
\[\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos delta - {\sin \phi_1}^{2}} \]
Alternative 12
Error5.0
Cost39304
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\sin theta \cdot \cos \phi_1\right)}{\cos delta}\\ \mathbf{if}\;delta \leq -2.75 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;delta \leq 7.8 \cdot 10^{-26}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(\sin theta \cdot \sin delta\right)}{\cos \phi_1 \cdot \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error5.0
Cost32904
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\sin theta \cdot \cos \phi_1\right)}{\cos delta}\\ \mathbf{if}\;delta \leq -5.8 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;delta \leq 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(delta \cdot \cos \phi_1\right)}{\cos \phi_1 \cdot \cos \phi_1}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error7.0
Cost32512
\[\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\sin theta \cdot \cos \phi_1\right)}{\cos delta} \]
Alternative 15
Error7.9
Cost26376
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta}\\ \mathbf{if}\;theta \leq -8000000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;theta \leq 1.25 \cdot 10^{-129}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\cos \phi_1 \cdot \left(theta \cdot \sin delta\right)}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 16
Error8.4
Cost25984
\[\lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \sin delta}{\cos delta} \]
Alternative 17
Error11.9
Cost19976
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot \left(delta \cdot \cos \phi_1\right)}{1}\\ \mathbf{if}\;theta \leq -0.122:\\ \;\;\;\;t_1\\ \mathbf{elif}\;theta \leq 6500000:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 18
Error14.7
Cost19848
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\ \mathbf{if}\;delta \leq -3 \cdot 10^{-84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;delta \leq 4.1 \cdot 10^{-60}:\\ \;\;\;\;\lambda_1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 19
Error12.1
Cost19848
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \mathbf{if}\;theta \leq -0.35:\\ \;\;\;\;t_1\\ \mathbf{elif}\;theta \leq 2.7 \cdot 10^{+22}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot \sin delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 20
Error18.7
Cost13448
\[\begin{array}{l} \mathbf{if}\;\lambda_1 \leq -7 \cdot 10^{-213}:\\ \;\;\;\;\lambda_1\\ \mathbf{elif}\;\lambda_1 \leq 1.6 \cdot 10^{-75}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1\\ \end{array} \]
Alternative 21
Error18.8
Cost64
\[\lambda_1 \]

Error

Reproduce

herbie shell --seed 2022335 
(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))))))))))