Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 17.5s
Alternatives: 7
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\ \left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew))))
   (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((-eh * tan(t)) / ew));
	return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan(((-eh * tan(t)) / ew))
    code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
	return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t):
	t_1 = math.atan(((-eh * math.tan(t)) / ew))
	return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew))
	return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1))))
end
function tmp = code(eh, ew, t)
	t_1 = atan(((-eh * tan(t)) / ew));
	tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\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 7 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} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\ \left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew))))
   (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((-eh * tan(t)) / ew));
	return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan(((-eh * tan(t)) / ew))
    code = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))))
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan(((-eh * Math.tan(t)) / ew));
	return Math.abs((((ew * Math.cos(t)) * Math.cos(t_1)) - ((eh * Math.sin(t)) * Math.sin(t_1))));
}
def code(eh, ew, t):
	t_1 = math.atan(((-eh * math.tan(t)) / ew))
	return math.fabs((((ew * math.cos(t)) * math.cos(t_1)) - ((eh * math.sin(t)) * math.sin(t_1))))
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(Float64(-eh) * tan(t)) / ew))
	return abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1))))
end
function tmp = code(eh, ew, t)
	t_1 = atan(((-eh * tan(t)) / ew));
	tmp = abs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[((-eh) * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\
\left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}

Alternative 1: 99.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right) - \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (-
   (* (* eh (sin t)) (sin (atan (/ (* (tan t) eh) (- 0.0 ew)))))
   (/ (* ew (cos t)) (hypot 1.0 (* (tan t) (/ eh ew)))))))
double code(double eh, double ew, double t) {
	return fabs((((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew))))) - ((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / ew))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * eh) / (0.0 - ew))))) - ((ew * Math.cos(t)) / Math.hypot(1.0, (Math.tan(t) * (eh / ew))))));
}
def code(eh, ew, t):
	return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * eh) / (0.0 - ew))))) - ((ew * math.cos(t)) / math.hypot(1.0, (math.tan(t) * (eh / ew))))))
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(0.0 - ew))))) - Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(tan(t) * Float64(eh / ew))))))
end
function tmp = code(eh, ew, t)
	tmp = abs((((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew))))) - ((ew * cos(t)) / hypot(1.0, (tan(t) * (eh / ew))))));
end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right) - \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right|
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. cos-atanN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left(\frac{1}{\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
    2. inv-powN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left({\left(\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)}^{-1}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
    3. pow1/2N/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left({\left({\left(1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)}^{\frac{1}{2}}\right)}^{-1}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
    4. pow-powN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left({\left(1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)}^{\left(\frac{1}{2} \cdot -1\right)}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
    5. flip-+N/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left({\left(\frac{1 \cdot 1 - \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right) \cdot \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)}{1 - \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)}^{\left(\frac{1}{2} \cdot -1\right)}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
    6. div-invN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left({\left(\left(1 \cdot 1 - \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right) \cdot \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot \frac{1}{1 - \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)}^{\left(\frac{1}{2} \cdot -1\right)}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
    7. unpow-prod-downN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left({\left(1 \cdot 1 - \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right) \cdot \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)}^{\left(\frac{1}{2} \cdot -1\right)} \cdot {\left(\frac{1}{1 - \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)}^{\left(\frac{1}{2} \cdot -1\right)}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
  4. Applied egg-rr64.7%

    \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\left({\left(1 - 1 \cdot {\left(\frac{\tan t \cdot eh}{ew}\right)}^{4}\right)}^{-0.5} \cdot {\left(\frac{1}{1 - {\left(\frac{\tan t \cdot eh}{ew}\right)}^{2}}\right)}^{-0.5}\right)} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  5. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\left(\left(ew \cdot \cos t\right) \cdot \left({\left(\frac{1}{1 - {\left(\frac{\tan t \cdot eh}{ew}\right)}^{2}}\right)}^{\frac{-1}{2}} \cdot {\left(1 - 1 \cdot {\left(\frac{\tan t \cdot eh}{ew}\right)}^{4}\right)}^{\frac{-1}{2}}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
    2. pow-prod-downN/A

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\left(\left(ew \cdot \cos t\right) \cdot {\left(\frac{1}{1 - {\left(\frac{\tan t \cdot eh}{ew}\right)}^{2}} \cdot \left(1 - 1 \cdot {\left(\frac{\tan t \cdot eh}{ew}\right)}^{4}\right)\right)}^{\frac{-1}{2}}\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
  6. Applied egg-rr99.8%

    \[\leadsto \left|\color{blue}{\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  7. Final simplification99.8%

    \[\leadsto \left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right) - \frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right| \]
  8. Add Preprocessing

Alternative 2: 98.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{t \cdot \left(0 - eh\right)}{ew}\right) - \cos \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right) \cdot \left(ew \cdot \cos t\right)\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (-
   (* (* eh (sin t)) (sin (atan (/ (* t (- 0.0 eh)) ew))))
   (* (cos (atan (/ (* (tan t) eh) (- 0.0 ew)))) (* ew (cos t))))))
double code(double eh, double ew, double t) {
	return fabs((((eh * sin(t)) * sin(atan(((t * (0.0 - eh)) / ew)))) - (cos(atan(((tan(t) * eh) / (0.0 - ew)))) * (ew * cos(t)))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs((((eh * sin(t)) * sin(atan(((t * (0.0d0 - eh)) / ew)))) - (cos(atan(((tan(t) * eh) / (0.0d0 - ew)))) * (ew * cos(t)))))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((t * (0.0 - eh)) / ew)))) - (Math.cos(Math.atan(((Math.tan(t) * eh) / (0.0 - ew)))) * (ew * Math.cos(t)))));
}
def code(eh, ew, t):
	return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((t * (0.0 - eh)) / ew)))) - (math.cos(math.atan(((math.tan(t) * eh) / (0.0 - ew)))) * (ew * math.cos(t)))))
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(t * Float64(0.0 - eh)) / ew)))) - Float64(cos(atan(Float64(Float64(tan(t) * eh) / Float64(0.0 - ew)))) * Float64(ew * cos(t)))))
end
function tmp = code(eh, ew, t)
	tmp = abs((((eh * sin(t)) * sin(atan(((t * (0.0 - eh)) / ew)))) - (cos(atan(((tan(t) * eh) / (0.0 - ew)))) * (ew * cos(t)))));
end
code[eh_, ew_, t_] := N[Abs[N[(N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(t * N[(0.0 - eh), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{t \cdot \left(0 - eh\right)}{ew}\right) - \cos \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right) \cdot \left(ew \cdot \cos t\right)\right|
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Taylor expanded in t around 0

    \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \color{blue}{t}\right), ew\right)\right)\right)\right)\right)\right) \]
  4. Step-by-step derivation
    1. Simplified99.5%

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \color{blue}{t}}{ew}\right)\right| \]
    2. Final simplification99.5%

      \[\leadsto \left|\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{t \cdot \left(0 - eh\right)}{ew}\right) - \cos \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right) \cdot \left(ew \cdot \cos t\right)\right| \]
    3. Add Preprocessing

    Alternative 3: 98.4% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right)\right| \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (fabs
      (-
       (* ew (cos t))
       (* (* eh (sin t)) (sin (atan (/ (* (tan t) eh) (- 0.0 ew))))))))
    double code(double eh, double ew, double t) {
    	return fabs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew)))))));
    }
    
    real(8) function code(eh, ew, t)
        real(8), intent (in) :: eh
        real(8), intent (in) :: ew
        real(8), intent (in) :: t
        code = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0d0 - ew)))))))
    end function
    
    public static double code(double eh, double ew, double t) {
    	return Math.abs(((ew * Math.cos(t)) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((Math.tan(t) * eh) / (0.0 - ew)))))));
    }
    
    def code(eh, ew, t):
    	return math.fabs(((ew * math.cos(t)) - ((eh * math.sin(t)) * math.sin(math.atan(((math.tan(t) * eh) / (0.0 - ew)))))))
    
    function code(eh, ew, t)
    	return abs(Float64(Float64(ew * cos(t)) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(tan(t) * eh) / Float64(0.0 - ew)))))))
    end
    
    function tmp = code(eh, ew, t)
    	tmp = abs(((ew * cos(t)) - ((eh * sin(t)) * sin(atan(((tan(t) * eh) / (0.0 - ew)))))));
    end
    
    code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right)\right|
    \end{array}
    
    Derivation
    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left(\frac{1}{\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      3. frac-2negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{\mathsf{neg}\left(ew\right)} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      4. distribute-frac-neg2N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      5. frac-2negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{\mathsf{neg}\left(ew\right)}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      6. distribute-frac-neg2N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      7. sqr-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew} \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      8. hypot-1-defN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\mathsf{hypot}\left(1, \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      9. hypot-lowering-hypot.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \mathsf{hypot.f64}\left(1, \left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \mathsf{hypot.f64}\left(1, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
    4. Applied egg-rr99.8%

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    5. Taylor expanded in eh around 0

      \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(-1 \cdot \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right) + ew \cdot \cos t\right)}\right) \]
    6. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(\left(\mathsf{neg}\left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right) + ew \cdot \cos t\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(ew \cdot \cos t + \left(\mathsf{neg}\left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\left(ew \cdot \cos t - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\left(ew \cdot \cos t\right), \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\left(\cos t \cdot ew\right), \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos t, ew\right), \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right)\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\left(eh \cdot \sin t\right), \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\left(\sin t \cdot eh\right), \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\sin t, eh\right), \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right) \]
      12. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(t\right), eh\right), \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right) \]
      13. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(t\right), eh\right), \mathsf{sin.f64}\left(\tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right)\right) \]
      14. atan-lowering-atan.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(t\right), eh\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)\right)\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(t\right), eh\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)\right)\right)\right)\right)\right) \]
      16. distribute-neg-frac2N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(t\right), eh\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right)\right)\right) \]
      17. mul-1-negN/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(t\right), eh\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\left(\frac{eh \cdot \tan t}{-1 \cdot ew}\right)\right)\right)\right)\right)\right) \]
      18. /-lowering-/.f64N/A

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(t\right), eh\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\left(eh \cdot \tan t\right), \left(-1 \cdot ew\right)\right)\right)\right)\right)\right)\right) \]
    7. Simplified99.1%

      \[\leadsto \left|\color{blue}{\cos t \cdot ew - \left(\sin t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)}\right| \]
    8. Final simplification99.1%

      \[\leadsto \left|ew \cdot \cos t - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\tan t \cdot eh}{0 - ew}\right)\right| \]
    9. Add Preprocessing

    Alternative 4: 98.3% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)} + \frac{eh}{\frac{1}{\sin t}}\right| \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (fabs
      (+
       (/ (* ew (cos t)) (hypot 1.0 (/ (* (tan t) eh) ew)))
       (/ eh (/ 1.0 (sin t))))))
    double code(double eh, double ew, double t) {
    	return fabs((((ew * cos(t)) / hypot(1.0, ((tan(t) * eh) / ew))) + (eh / (1.0 / sin(t)))));
    }
    
    public static double code(double eh, double ew, double t) {
    	return Math.abs((((ew * Math.cos(t)) / Math.hypot(1.0, ((Math.tan(t) * eh) / ew))) + (eh / (1.0 / Math.sin(t)))));
    }
    
    def code(eh, ew, t):
    	return math.fabs((((ew * math.cos(t)) / math.hypot(1.0, ((math.tan(t) * eh) / ew))) + (eh / (1.0 / math.sin(t)))))
    
    function code(eh, ew, t)
    	return abs(Float64(Float64(Float64(ew * cos(t)) / hypot(1.0, Float64(Float64(tan(t) * eh) / ew))) + Float64(eh / Float64(1.0 / sin(t)))))
    end
    
    function tmp = code(eh, ew, t)
    	tmp = abs((((ew * cos(t)) / hypot(1.0, ((tan(t) * eh) / ew))) + (eh / (1.0 / sin(t)))));
    end
    
    code[eh_, ew_, t_] := N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] + N[(eh / N[(1.0 / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)} + \frac{eh}{\frac{1}{\sin t}}\right|
    \end{array}
    
    Derivation
    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0

      \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \color{blue}{t}\right), ew\right)\right)\right)\right)\right)\right) \]
    4. Step-by-step derivation
      1. Simplified99.5%

        \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \color{blue}{t}}{ew}\right)\right| \]
      2. Step-by-step derivation
        1. associate-*l*N/A

          \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right)\right)\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \left(\left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right) \cdot eh\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right), eh\right)\right)\right) \]
      3. Applied egg-rr81.8%

        \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \color{blue}{\frac{\sin t \cdot \left(-eh \cdot \frac{t}{ew}\right)}{\mathsf{hypot}\left(1, -eh \cdot \frac{t}{ew}\right)} \cdot eh}\right| \]
      4. Applied egg-rr82.7%

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)} - \frac{eh}{-\frac{\mathsf{hypot}\left(1, \frac{eh}{\frac{ew}{t}}\right)}{\sin t \cdot \frac{eh}{\frac{ew}{t}}}}}\right| \]
      5. Taylor expanded in eh around inf

        \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{hypot.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{tan.f64}\left(t\right), eh\right), ew\right)\right)\right), \mathsf{/.f64}\left(eh, \mathsf{neg.f64}\left(\color{blue}{\left(\frac{1}{\sin t}\right)}\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{hypot.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{tan.f64}\left(t\right), eh\right), ew\right)\right)\right), \mathsf{/.f64}\left(eh, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(1, \sin t\right)\right)\right)\right)\right) \]
        2. sin-lowering-sin.f6498.6%

          \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{hypot.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{tan.f64}\left(t\right), eh\right), ew\right)\right)\right), \mathsf{/.f64}\left(eh, \mathsf{neg.f64}\left(\mathsf{/.f64}\left(1, \mathsf{sin.f64}\left(t\right)\right)\right)\right)\right)\right) \]
      7. Simplified98.6%

        \[\leadsto \left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)} - \frac{eh}{-\color{blue}{\frac{1}{\sin t}}}\right| \]
      8. Final simplification98.6%

        \[\leadsto \left|\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)} + \frac{eh}{\frac{1}{\sin t}}\right| \]
      9. Add Preprocessing

      Alternative 5: 74.8% accurate, 4.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \cos t\right|\\ \mathbf{if}\;ew \leq -5 \cdot 10^{-124}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 4.6 \cdot 10^{-97}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (eh ew t)
       :precision binary64
       (let* ((t_1 (fabs (* ew (cos t)))))
         (if (<= ew -5e-124) t_1 (if (<= ew 4.6e-97) (fabs (* eh (sin t))) t_1))))
      double code(double eh, double ew, double t) {
      	double t_1 = fabs((ew * cos(t)));
      	double tmp;
      	if (ew <= -5e-124) {
      		tmp = t_1;
      	} else if (ew <= 4.6e-97) {
      		tmp = fabs((eh * sin(t)));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      real(8) function code(eh, ew, t)
          real(8), intent (in) :: eh
          real(8), intent (in) :: ew
          real(8), intent (in) :: t
          real(8) :: t_1
          real(8) :: tmp
          t_1 = abs((ew * cos(t)))
          if (ew <= (-5d-124)) then
              tmp = t_1
          else if (ew <= 4.6d-97) then
              tmp = abs((eh * sin(t)))
          else
              tmp = t_1
          end if
          code = tmp
      end function
      
      public static double code(double eh, double ew, double t) {
      	double t_1 = Math.abs((ew * Math.cos(t)));
      	double tmp;
      	if (ew <= -5e-124) {
      		tmp = t_1;
      	} else if (ew <= 4.6e-97) {
      		tmp = Math.abs((eh * Math.sin(t)));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(eh, ew, t):
      	t_1 = math.fabs((ew * math.cos(t)))
      	tmp = 0
      	if ew <= -5e-124:
      		tmp = t_1
      	elif ew <= 4.6e-97:
      		tmp = math.fabs((eh * math.sin(t)))
      	else:
      		tmp = t_1
      	return tmp
      
      function code(eh, ew, t)
      	t_1 = abs(Float64(ew * cos(t)))
      	tmp = 0.0
      	if (ew <= -5e-124)
      		tmp = t_1;
      	elseif (ew <= 4.6e-97)
      		tmp = abs(Float64(eh * sin(t)));
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(eh, ew, t)
      	t_1 = abs((ew * cos(t)));
      	tmp = 0.0;
      	if (ew <= -5e-124)
      		tmp = t_1;
      	elseif (ew <= 4.6e-97)
      		tmp = abs((eh * sin(t)));
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -5e-124], t$95$1, If[LessEqual[ew, 4.6e-97], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left|ew \cdot \cos t\right|\\
      \mathbf{if}\;ew \leq -5 \cdot 10^{-124}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;ew \leq 4.6 \cdot 10^{-97}:\\
      \;\;\;\;\left|eh \cdot \sin t\right|\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if ew < -5.0000000000000003e-124 or 4.59999999999999988e-97 < ew

        1. Initial program 99.8%

          \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. cos-atanN/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left(\frac{1}{\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          2. /-lowering-/.f64N/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          3. frac-2negN/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{\mathsf{neg}\left(ew\right)} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          4. distribute-frac-neg2N/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          5. frac-2negN/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{\mathsf{neg}\left(ew\right)}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          6. distribute-frac-neg2N/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          7. sqr-negN/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew} \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          8. hypot-1-defN/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\mathsf{hypot}\left(1, \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          9. hypot-lowering-hypot.f64N/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \mathsf{hypot.f64}\left(1, \left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \mathsf{hypot.f64}\left(1, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
        4. Applied egg-rr99.8%

          \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
        5. Taylor expanded in ew around inf

          \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(ew \cdot \cos t\right)}\right) \]
        6. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{fabs.f64}\left(\left(\cos t \cdot ew\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(\cos t, ew\right)\right) \]
          3. cos-lowering-cos.f6481.4%

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(t\right), ew\right)\right) \]
        7. Simplified81.4%

          \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]

        if -5.0000000000000003e-124 < ew < 4.59999999999999988e-97

        1. Initial program 99.8%

          \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
        2. Add Preprocessing
        3. Taylor expanded in t around 0

          \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \color{blue}{t}\right), ew\right)\right)\right)\right)\right)\right) \]
        4. Step-by-step derivation
          1. Simplified98.9%

            \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \color{blue}{t}}{ew}\right)\right| \]
          2. Step-by-step derivation
            1. associate-*l*N/A

              \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right)\right)\right)\right) \]
            2. *-commutativeN/A

              \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \left(\left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right) \cdot eh\right)\right)\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right), eh\right)\right)\right) \]
          3. Applied egg-rr56.3%

            \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \color{blue}{\frac{\sin t \cdot \left(-eh \cdot \frac{t}{ew}\right)}{\mathsf{hypot}\left(1, -eh \cdot \frac{t}{ew}\right)} \cdot eh}\right| \]
          4. Taylor expanded in ew around 0

            \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(eh \cdot \sin t\right)}\right) \]
          5. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(eh, \sin t\right)\right) \]
            2. sin-lowering-sin.f6479.0%

              \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right)\right) \]
          6. Simplified79.0%

            \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
        5. Recombined 2 regimes into one program.
        6. Final simplification80.7%

          \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -5 \cdot 10^{-124}:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \mathbf{elif}\;ew \leq 4.6 \cdot 10^{-97}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \end{array} \]
        7. Add Preprocessing

        Alternative 6: 62.5% accurate, 4.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|eh \cdot \sin t\right|\\ \mathbf{if}\;t \leq -3.7 \cdot 10^{-17}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 7.2 \cdot 10^{-25}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (let* ((t_1 (fabs (* eh (sin t)))))
           (if (<= t -3.7e-17) t_1 (if (<= t 7.2e-25) (fabs ew) t_1))))
        double code(double eh, double ew, double t) {
        	double t_1 = fabs((eh * sin(t)));
        	double tmp;
        	if (t <= -3.7e-17) {
        		tmp = t_1;
        	} else if (t <= 7.2e-25) {
        		tmp = fabs(ew);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        real(8) function code(eh, ew, t)
            real(8), intent (in) :: eh
            real(8), intent (in) :: ew
            real(8), intent (in) :: t
            real(8) :: t_1
            real(8) :: tmp
            t_1 = abs((eh * sin(t)))
            if (t <= (-3.7d-17)) then
                tmp = t_1
            else if (t <= 7.2d-25) then
                tmp = abs(ew)
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double eh, double ew, double t) {
        	double t_1 = Math.abs((eh * Math.sin(t)));
        	double tmp;
        	if (t <= -3.7e-17) {
        		tmp = t_1;
        	} else if (t <= 7.2e-25) {
        		tmp = Math.abs(ew);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(eh, ew, t):
        	t_1 = math.fabs((eh * math.sin(t)))
        	tmp = 0
        	if t <= -3.7e-17:
        		tmp = t_1
        	elif t <= 7.2e-25:
        		tmp = math.fabs(ew)
        	else:
        		tmp = t_1
        	return tmp
        
        function code(eh, ew, t)
        	t_1 = abs(Float64(eh * sin(t)))
        	tmp = 0.0
        	if (t <= -3.7e-17)
        		tmp = t_1;
        	elseif (t <= 7.2e-25)
        		tmp = abs(ew);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(eh, ew, t)
        	t_1 = abs((eh * sin(t)));
        	tmp = 0.0;
        	if (t <= -3.7e-17)
        		tmp = t_1;
        	elseif (t <= 7.2e-25)
        		tmp = abs(ew);
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3.7e-17], t$95$1, If[LessEqual[t, 7.2e-25], N[Abs[ew], $MachinePrecision], t$95$1]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left|eh \cdot \sin t\right|\\
        \mathbf{if}\;t \leq -3.7 \cdot 10^{-17}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;t \leq 7.2 \cdot 10^{-25}:\\
        \;\;\;\;\left|ew\right|\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if t < -3.6999999999999997e-17 or 7.1999999999999998e-25 < t

          1. Initial program 99.6%

            \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
          2. Add Preprocessing
          3. Taylor expanded in t around 0

            \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \color{blue}{t}\right), ew\right)\right)\right)\right)\right)\right) \]
          4. Step-by-step derivation
            1. Simplified99.1%

              \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \color{blue}{t}}{ew}\right)\right| \]
            2. Step-by-step derivation
              1. associate-*l*N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right)\right)\right)\right) \]
              2. *-commutativeN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \left(\left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right) \cdot eh\right)\right)\right) \]
              3. *-lowering-*.f64N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{cos.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot t}{ew}\right)\right), eh\right)\right)\right) \]
            3. Applied egg-rr67.6%

              \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \color{blue}{\frac{\sin t \cdot \left(-eh \cdot \frac{t}{ew}\right)}{\mathsf{hypot}\left(1, -eh \cdot \frac{t}{ew}\right)} \cdot eh}\right| \]
            4. Taylor expanded in ew around 0

              \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{\left(eh \cdot \sin t\right)}\right) \]
            5. Step-by-step derivation
              1. *-lowering-*.f64N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(eh, \sin t\right)\right) \]
              2. sin-lowering-sin.f6451.1%

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right)\right) \]
            6. Simplified51.1%

              \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]

            if -3.6999999999999997e-17 < t < 7.1999999999999998e-25

            1. Initial program 100.0%

              \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. cos-atanN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left(\frac{1}{\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              2. /-lowering-/.f64N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              3. frac-2negN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{\mathsf{neg}\left(ew\right)} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              4. distribute-frac-neg2N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              5. frac-2negN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{\mathsf{neg}\left(ew\right)}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              6. distribute-frac-neg2N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              7. sqr-negN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew} \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              8. hypot-1-defN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\mathsf{hypot}\left(1, \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              9. hypot-lowering-hypot.f64N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \mathsf{hypot.f64}\left(1, \left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              10. /-lowering-/.f64N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \mathsf{hypot.f64}\left(1, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
            4. Applied egg-rr100.0%

              \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
            5. Taylor expanded in t around 0

              \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{ew}\right) \]
            6. Step-by-step derivation
              1. Simplified80.7%

                \[\leadsto \left|\color{blue}{ew}\right| \]
            7. Recombined 2 regimes into one program.
            8. Add Preprocessing

            Alternative 7: 41.4% accurate, 9.1× speedup?

            \[\begin{array}{l} \\ \left|ew\right| \end{array} \]
            (FPCore (eh ew t) :precision binary64 (fabs ew))
            double code(double eh, double ew, double t) {
            	return fabs(ew);
            }
            
            real(8) function code(eh, ew, t)
                real(8), intent (in) :: eh
                real(8), intent (in) :: ew
                real(8), intent (in) :: t
                code = abs(ew)
            end function
            
            public static double code(double eh, double ew, double t) {
            	return Math.abs(ew);
            }
            
            def code(eh, ew, t):
            	return math.fabs(ew)
            
            function code(eh, ew, t)
            	return abs(ew)
            end
            
            function tmp = code(eh, ew, t)
            	tmp = abs(ew);
            end
            
            code[eh_, ew_, t_] := N[Abs[ew], $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \left|ew\right|
            \end{array}
            
            Derivation
            1. Initial program 99.8%

              \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. cos-atanN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \left(\frac{1}{\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}}\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              2. /-lowering-/.f64N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              3. frac-2negN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{\mathsf{neg}\left(ew\right)} \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              4. distribute-frac-neg2N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              5. frac-2negN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{\mathsf{neg}\left(ew\right)}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              6. distribute-frac-neg2N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right) \cdot \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              7. sqr-negN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\sqrt{1 + \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew} \cdot \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}}\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              8. hypot-1-defN/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \left(\mathsf{hypot}\left(1, \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              9. hypot-lowering-hypot.f64N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \mathsf{hypot.f64}\left(1, \left(\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)}{ew}\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
              10. /-lowering-/.f64N/A

                \[\leadsto \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(ew, \mathsf{cos.f64}\left(t\right)\right), \mathsf{/.f64}\left(1, \mathsf{hypot.f64}\left(1, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)\right), ew\right)\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(eh, \mathsf{sin.f64}\left(t\right)\right), \mathsf{sin.f64}\left(\mathsf{atan.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{neg.f64}\left(eh\right), \mathsf{tan.f64}\left(t\right)\right), ew\right)\right)\right)\right)\right)\right) \]
            4. Applied egg-rr99.8%

              \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(1, \frac{\tan t \cdot eh}{ew}\right)}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
            5. Taylor expanded in t around 0

              \[\leadsto \mathsf{fabs.f64}\left(\color{blue}{ew}\right) \]
            6. Step-by-step derivation
              1. Simplified45.1%

                \[\leadsto \left|\color{blue}{ew}\right| \]
              2. Add Preprocessing

              Reproduce

              ?
              herbie shell --seed 2024139 
              (FPCore (eh ew t)
                :name "Example 2 from Robby"
                :precision binary64
                (fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))