Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 18.2s
Alternatives: 10
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 10 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} \\ \begin{array}{l} t_1 := eh \cdot \tan t\\ \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{t\_1}{ew}\right)}^{2}}}, ew, eh \cdot \left(\sin \tan^{-1} \left(\frac{t\_1}{-ew}\right) \cdot \left(-\sin t\right)\right)\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* eh (tan t))))
   (fabs
    (fma
     (/ (cos t) (sqrt (+ 1.0 (pow (/ t_1 ew) 2.0))))
     ew
     (* eh (* (sin (atan (/ t_1 (- ew)))) (- (sin t))))))))
double code(double eh, double ew, double t) {
	double t_1 = eh * tan(t);
	return fabs(fma((cos(t) / sqrt((1.0 + pow((t_1 / ew), 2.0)))), ew, (eh * (sin(atan((t_1 / -ew))) * -sin(t)))));
}
function code(eh, ew, t)
	t_1 = Float64(eh * tan(t))
	return abs(fma(Float64(cos(t) / sqrt(Float64(1.0 + (Float64(t_1 / ew) ^ 2.0)))), ew, Float64(eh * Float64(sin(atan(Float64(t_1 / Float64(-ew)))) * Float64(-sin(t))))))
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[Cos[t], $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(t$95$1 / ew), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ew + N[(eh * N[(N[Sin[N[ArcTan[N[(t$95$1 / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Sin[t], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := eh \cdot \tan t\\
\left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{t\_1}{ew}\right)}^{2}}}, ew, eh \cdot \left(\sin \tan^{-1} \left(\frac{t\_1}{-ew}\right) \cdot \left(-\sin t\right)\right)\right)\right|
\end{array}
\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. sub-negN/A

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

      \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
    3. *-commutativeN/A

      \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
    4. accelerator-lowering-fma.f64N/A

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

    \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{-ew}\right)}^{2}}}, ew, \left(-eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\right)\right)}\right| \]
  5. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\color{blue}{\frac{\cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    2. cos-lowering-cos.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\color{blue}{\cos t}}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    3. rem-square-sqrtN/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{\color{blue}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}} \cdot \sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    4. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\color{blue}{\sqrt{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}} \cdot \sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    5. rem-square-sqrtN/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{\color{blue}{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    6. +-lowering-+.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{\color{blue}{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    7. unpow2N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)} \cdot \frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    8. distribute-frac-neg2N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{\left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)} \cdot \frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    9. distribute-frac-neg2N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    10. sqr-negN/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{\frac{eh \cdot \tan t}{ew} \cdot \frac{eh \cdot \tan t}{ew}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    11. pow2N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{{\left(\frac{eh \cdot \tan t}{ew}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    12. pow-lowering-pow.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{{\left(\frac{eh \cdot \tan t}{ew}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    13. /-lowering-/.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)}}^{2}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    14. *-lowering-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{\color{blue}{eh \cdot \tan t}}{ew}\right)}^{2}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    15. tan-lowering-tan.f6499.8

      \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{eh \cdot \color{blue}{\tan t}}{ew}\right)}^{2}}}, ew, \left(-eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\right)\right)\right| \]
  6. Applied egg-rr99.8%

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

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

Alternative 2: 51.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \cos t \cdot ew\\ t_2 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\ \mathbf{if}\;t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2 \leq -2 \cdot 10^{-254}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* (cos t) ew)) (t_2 (atan (/ (* eh (tan t)) (- ew)))))
   (if (<= (- (* t_1 (cos t_2)) (* (* eh (sin t)) (sin t_2))) -2e-254)
     (fabs ew)
     t_1)))
double code(double eh, double ew, double t) {
	double t_1 = cos(t) * ew;
	double t_2 = atan(((eh * tan(t)) / -ew));
	double tmp;
	if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= -2e-254) {
		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) :: t_2
    real(8) :: tmp
    t_1 = cos(t) * ew
    t_2 = atan(((eh * tan(t)) / -ew))
    if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= (-2d-254)) 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.cos(t) * ew;
	double t_2 = Math.atan(((eh * Math.tan(t)) / -ew));
	double tmp;
	if (((t_1 * Math.cos(t_2)) - ((eh * Math.sin(t)) * Math.sin(t_2))) <= -2e-254) {
		tmp = Math.abs(ew);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.cos(t) * ew
	t_2 = math.atan(((eh * math.tan(t)) / -ew))
	tmp = 0
	if ((t_1 * math.cos(t_2)) - ((eh * math.sin(t)) * math.sin(t_2))) <= -2e-254:
		tmp = math.fabs(ew)
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = Float64(cos(t) * ew)
	t_2 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))
	tmp = 0.0
	if (Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) <= -2e-254)
		tmp = abs(ew);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = cos(t) * ew;
	t_2 = atan(((eh * tan(t)) / -ew));
	tmp = 0.0;
	if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= -2e-254)
		tmp = abs(ew);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-254], N[Abs[ew], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \cos t \cdot ew\\
t_2 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\
\mathbf{if}\;t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2 \leq -2 \cdot 10^{-254}:\\
\;\;\;\;\left|ew\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))) < -1.9999999999999998e-254

    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. sub-negN/A

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

        \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
      3. *-commutativeN/A

        \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
      4. accelerator-lowering-fma.f64N/A

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

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

      \[\leadsto \left|\color{blue}{ew}\right| \]
    6. Step-by-step derivation
      1. Simplified39.0%

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

      if -1.9999999999999998e-254 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))))

      1. Initial program 99.9%

        \[\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. Applied egg-rr72.8%

        \[\leadsto \color{blue}{\frac{1}{\left|\frac{1}{\frac{ew \cdot \cos t - \left(-eh\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{-ew}\right)}^{2}}}}\right|}} \]
      4. Taylor expanded in ew around inf

        \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew \cdot \cos t}}\right|} \]
      5. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew \cdot \cos t}}\right|} \]
        2. *-lowering-*.f64N/A

          \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{ew \cdot \cos t}}\right|} \]
        3. cos-lowering-cos.f6463.2

          \[\leadsto \frac{1}{\left|\frac{1}{ew \cdot \color{blue}{\cos t}}\right|} \]
      6. Simplified63.2%

        \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew \cdot \cos t}}\right|} \]
      7. Step-by-step derivation
        1. inv-powN/A

          \[\leadsto \frac{1}{\left|\color{blue}{{\left(ew \cdot \cos t\right)}^{-1}}\right|} \]
        2. *-commutativeN/A

          \[\leadsto \frac{1}{\left|{\color{blue}{\left(\cos t \cdot ew\right)}}^{-1}\right|} \]
        3. sqr-powN/A

          \[\leadsto \frac{1}{\left|\color{blue}{{\left(\cos t \cdot ew\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\cos t \cdot ew\right)}^{\left(\frac{-1}{2}\right)}}\right|} \]
        4. fabs-sqrN/A

          \[\leadsto \frac{1}{\color{blue}{{\left(\cos t \cdot ew\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\cos t \cdot ew\right)}^{\left(\frac{-1}{2}\right)}}} \]
        5. sqr-powN/A

          \[\leadsto \frac{1}{\color{blue}{{\left(\cos t \cdot ew\right)}^{-1}}} \]
        6. inv-powN/A

          \[\leadsto \frac{1}{\color{blue}{\frac{1}{\cos t \cdot ew}}} \]
        7. clear-numN/A

          \[\leadsto \color{blue}{\frac{\cos t \cdot ew}{1}} \]
        8. /-rgt-identityN/A

          \[\leadsto \color{blue}{\cos t \cdot ew} \]
        9. *-lowering-*.f64N/A

          \[\leadsto \color{blue}{\cos t \cdot ew} \]
        10. cos-lowering-cos.f6463.3

          \[\leadsto \color{blue}{\cos t} \cdot ew \]
      8. Applied egg-rr63.3%

        \[\leadsto \color{blue}{\cos t \cdot ew} \]
    7. Recombined 2 regimes into one program.
    8. Final simplification51.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\cos t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) \leq -2 \cdot 10^{-254}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{else}:\\ \;\;\;\;\cos t \cdot ew\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 98.5% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \left|\mathsf{fma}\left(\left(-eh\right) \cdot \sin t, \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right), \cos t \cdot ew\right)\right| \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (fabs
      (fma
       (* (- eh) (sin t))
       (sin (atan (/ (* eh (tan t)) (- ew))))
       (* (cos t) ew))))
    double code(double eh, double ew, double t) {
    	return fabs(fma((-eh * sin(t)), sin(atan(((eh * tan(t)) / -ew))), (cos(t) * ew)));
    }
    
    function code(eh, ew, t)
    	return abs(fma(Float64(Float64(-eh) * sin(t)), sin(atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))), Float64(cos(t) * ew)))
    end
    
    code[eh_, ew_, t_] := N[Abs[N[(N[((-eh) * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \left|\mathsf{fma}\left(\left(-eh\right) \cdot \sin t, \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right), \cos t \cdot 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. sub-negN/A

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

        \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
      3. *-commutativeN/A

        \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
      4. accelerator-lowering-fma.f64N/A

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{-ew}\right)}^{2}}}, ew, \left(-eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\right)\right)}\right| \]
    5. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(\color{blue}{\frac{\cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      2. cos-lowering-cos.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\color{blue}{\cos t}}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      3. rem-square-sqrtN/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{\color{blue}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}} \cdot \sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      4. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\color{blue}{\sqrt{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}} \cdot \sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      5. rem-square-sqrtN/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{\color{blue}{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      6. +-lowering-+.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{\color{blue}{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      7. unpow2N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)} \cdot \frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      8. distribute-frac-neg2N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{\left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)} \cdot \frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      9. distribute-frac-neg2N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      10. sqr-negN/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{\frac{eh \cdot \tan t}{ew} \cdot \frac{eh \cdot \tan t}{ew}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      11. pow2N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{{\left(\frac{eh \cdot \tan t}{ew}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      12. pow-lowering-pow.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + \color{blue}{{\left(\frac{eh \cdot \tan t}{ew}\right)}^{2}}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      13. /-lowering-/.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)}}^{2}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      14. *-lowering-*.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{\color{blue}{eh \cdot \tan t}}{ew}\right)}^{2}}}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
      15. tan-lowering-tan.f6499.8

        \[\leadsto \left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {\left(\frac{eh \cdot \color{blue}{\tan t}}{ew}\right)}^{2}}}, ew, \left(-eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\right)\right)\right| \]
    6. Applied egg-rr99.8%

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

      \[\leadsto \left|\color{blue}{-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| \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left|\color{blue}{\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| \]
      2. associate-*r*N/A

        \[\leadsto \left|\left(\mathsf{neg}\left(\color{blue}{\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)}\right)\right) + ew \cdot \cos t\right| \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)} + ew \cdot \cos t\right| \]
      4. mul-1-negN/A

        \[\leadsto \left|\color{blue}{\left(-1 \cdot \left(eh \cdot \sin t\right)\right)} \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right) + ew \cdot \cos t\right| \]
      5. accelerator-lowering-fma.f64N/A

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(-1 \cdot \left(eh \cdot \sin t\right), \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right), ew \cdot \cos t\right)}\right| \]
    9. Simplified99.1%

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

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

    Alternative 4: 98.5% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \left|\mathsf{fma}\left(\cos t, ew, eh \cdot \left(\sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) \cdot \left(-\sin t\right)\right)\right)\right| \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (fabs
      (fma
       (cos t)
       ew
       (* eh (* (sin (atan (/ (* eh (tan t)) (- ew)))) (- (sin t)))))))
    double code(double eh, double ew, double t) {
    	return fabs(fma(cos(t), ew, (eh * (sin(atan(((eh * tan(t)) / -ew))) * -sin(t)))));
    }
    
    function code(eh, ew, t)
    	return abs(fma(cos(t), ew, Float64(eh * Float64(sin(atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))) * Float64(-sin(t))))))
    end
    
    code[eh_, ew_, t_] := N[Abs[N[(N[Cos[t], $MachinePrecision] * ew + N[(eh * N[(N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Sin[t], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \left|\mathsf{fma}\left(\cos t, ew, eh \cdot \left(\sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) \cdot \left(-\sin t\right)\right)\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. sub-negN/A

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

        \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
      3. *-commutativeN/A

        \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
      4. accelerator-lowering-fma.f64N/A

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

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

      \[\leadsto \left|\mathsf{fma}\left(\color{blue}{\cos t}, ew, \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)\right)\right)\right| \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6499.1

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

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

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

    Alternative 5: 75.4% accurate, 7.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\cos t \cdot ew\right|\\ \mathbf{if}\;ew \leq -3.8 \cdot 10^{-100}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 4.2 \cdot 10^{-21}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (let* ((t_1 (fabs (* (cos t) ew))))
       (if (<= ew -3.8e-100) t_1 (if (<= ew 4.2e-21) (fabs (* eh (sin t))) t_1))))
    double code(double eh, double ew, double t) {
    	double t_1 = fabs((cos(t) * ew));
    	double tmp;
    	if (ew <= -3.8e-100) {
    		tmp = t_1;
    	} else if (ew <= 4.2e-21) {
    		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((cos(t) * ew))
        if (ew <= (-3.8d-100)) then
            tmp = t_1
        else if (ew <= 4.2d-21) 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((Math.cos(t) * ew));
    	double tmp;
    	if (ew <= -3.8e-100) {
    		tmp = t_1;
    	} else if (ew <= 4.2e-21) {
    		tmp = Math.abs((eh * Math.sin(t)));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(eh, ew, t):
    	t_1 = math.fabs((math.cos(t) * ew))
    	tmp = 0
    	if ew <= -3.8e-100:
    		tmp = t_1
    	elif ew <= 4.2e-21:
    		tmp = math.fabs((eh * math.sin(t)))
    	else:
    		tmp = t_1
    	return tmp
    
    function code(eh, ew, t)
    	t_1 = abs(Float64(cos(t) * ew))
    	tmp = 0.0
    	if (ew <= -3.8e-100)
    		tmp = t_1;
    	elseif (ew <= 4.2e-21)
    		tmp = abs(Float64(eh * sin(t)));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(eh, ew, t)
    	t_1 = abs((cos(t) * ew));
    	tmp = 0.0;
    	if (ew <= -3.8e-100)
    		tmp = t_1;
    	elseif (ew <= 4.2e-21)
    		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[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.8e-100], t$95$1, If[LessEqual[ew, 4.2e-21], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \left|\cos t \cdot ew\right|\\
    \mathbf{if}\;ew \leq -3.8 \cdot 10^{-100}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;ew \leq 4.2 \cdot 10^{-21}:\\
    \;\;\;\;\left|eh \cdot \sin t\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if ew < -3.79999999999999997e-100 or 4.20000000000000025e-21 < 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. sub-negN/A

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

          \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
        3. *-commutativeN/A

          \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
        4. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
      6. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
        2. cos-lowering-cos.f6486.3

          \[\leadsto \left|ew \cdot \color{blue}{\cos t}\right| \]
      7. Simplified86.3%

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

      if -3.79999999999999997e-100 < ew < 4.20000000000000025e-21

      1. Initial program 99.9%

        \[\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. sub-negN/A

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

          \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right) + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)}\right| \]
        3. distribute-lft-neg-inN/A

          \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
        4. sin-atanN/A

          \[\leadsto \left|\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \color{blue}{\frac{\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}{\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}}}} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
        5. div-invN/A

          \[\leadsto \left|\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \frac{\color{blue}{\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right) \cdot \frac{1}{ew}}}{\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}}} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
        6. associate-/l*N/A

          \[\leadsto \left|\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right) \cdot \frac{\frac{1}{ew}}{\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)} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
        7. associate-*r*N/A

          \[\leadsto \left|\color{blue}{\left(\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)\right) \cdot \frac{\frac{1}{ew}}{\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}}}} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
      4. Applied egg-rr41.5%

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

        \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
      6. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
        2. sin-lowering-sin.f6474.7

          \[\leadsto \left|eh \cdot \color{blue}{\sin t}\right| \]
      7. Simplified74.7%

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

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

    Alternative 6: 62.2% accurate, 7.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -4.5 \cdot 10^{-100}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{elif}\;ew \leq 5.7 \cdot 10^{-21}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\cos t \cdot ew\\ \end{array} \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (if (<= ew -4.5e-100)
       (fabs ew)
       (if (<= ew 5.7e-21) (fabs (* eh (sin t))) (* (cos t) ew))))
    double code(double eh, double ew, double t) {
    	double tmp;
    	if (ew <= -4.5e-100) {
    		tmp = fabs(ew);
    	} else if (ew <= 5.7e-21) {
    		tmp = fabs((eh * sin(t)));
    	} else {
    		tmp = cos(t) * ew;
    	}
    	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) :: tmp
        if (ew <= (-4.5d-100)) then
            tmp = abs(ew)
        else if (ew <= 5.7d-21) then
            tmp = abs((eh * sin(t)))
        else
            tmp = cos(t) * ew
        end if
        code = tmp
    end function
    
    public static double code(double eh, double ew, double t) {
    	double tmp;
    	if (ew <= -4.5e-100) {
    		tmp = Math.abs(ew);
    	} else if (ew <= 5.7e-21) {
    		tmp = Math.abs((eh * Math.sin(t)));
    	} else {
    		tmp = Math.cos(t) * ew;
    	}
    	return tmp;
    }
    
    def code(eh, ew, t):
    	tmp = 0
    	if ew <= -4.5e-100:
    		tmp = math.fabs(ew)
    	elif ew <= 5.7e-21:
    		tmp = math.fabs((eh * math.sin(t)))
    	else:
    		tmp = math.cos(t) * ew
    	return tmp
    
    function code(eh, ew, t)
    	tmp = 0.0
    	if (ew <= -4.5e-100)
    		tmp = abs(ew);
    	elseif (ew <= 5.7e-21)
    		tmp = abs(Float64(eh * sin(t)));
    	else
    		tmp = Float64(cos(t) * ew);
    	end
    	return tmp
    end
    
    function tmp_2 = code(eh, ew, t)
    	tmp = 0.0;
    	if (ew <= -4.5e-100)
    		tmp = abs(ew);
    	elseif (ew <= 5.7e-21)
    		tmp = abs((eh * sin(t)));
    	else
    		tmp = cos(t) * ew;
    	end
    	tmp_2 = tmp;
    end
    
    code[eh_, ew_, t_] := If[LessEqual[ew, -4.5e-100], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 5.7e-21], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;ew \leq -4.5 \cdot 10^{-100}:\\
    \;\;\;\;\left|ew\right|\\
    
    \mathbf{elif}\;ew \leq 5.7 \cdot 10^{-21}:\\
    \;\;\;\;\left|eh \cdot \sin t\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;\cos t \cdot ew\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if ew < -4.5000000000000001e-100

      1. Initial program 99.7%

        \[\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. sub-negN/A

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

          \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
        3. *-commutativeN/A

          \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
        4. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \left|\color{blue}{ew}\right| \]
      6. Step-by-step derivation
        1. Simplified49.1%

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

        if -4.5000000000000001e-100 < ew < 5.6999999999999996e-21

        1. Initial program 99.9%

          \[\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. sub-negN/A

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

            \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right) + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)}\right| \]
          3. distribute-lft-neg-inN/A

            \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
          4. sin-atanN/A

            \[\leadsto \left|\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \color{blue}{\frac{\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}}{\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}}}} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
          5. div-invN/A

            \[\leadsto \left|\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \frac{\color{blue}{\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right) \cdot \frac{1}{ew}}}{\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}}} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
          6. associate-/l*N/A

            \[\leadsto \left|\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right) \cdot \frac{\frac{1}{ew}}{\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)} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
          7. associate-*r*N/A

            \[\leadsto \left|\color{blue}{\left(\left(\mathsf{neg}\left(eh \cdot \sin t\right)\right) \cdot \left(\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t\right)\right) \cdot \frac{\frac{1}{ew}}{\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}}}} + \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
        4. Applied egg-rr41.5%

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

          \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
        6. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
          2. sin-lowering-sin.f6474.7

            \[\leadsto \left|eh \cdot \color{blue}{\sin t}\right| \]
        7. Simplified74.7%

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

        if 5.6999999999999996e-21 < ew

        1. Initial program 99.9%

          \[\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. Applied egg-rr92.8%

          \[\leadsto \color{blue}{\frac{1}{\left|\frac{1}{\frac{ew \cdot \cos t - \left(-eh\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{-ew}\right)}^{2}}}}\right|}} \]
        4. Taylor expanded in ew around inf

          \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew \cdot \cos t}}\right|} \]
        5. Step-by-step derivation
          1. /-lowering-/.f64N/A

            \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew \cdot \cos t}}\right|} \]
          2. *-lowering-*.f64N/A

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{ew \cdot \cos t}}\right|} \]
          3. cos-lowering-cos.f6489.5

            \[\leadsto \frac{1}{\left|\frac{1}{ew \cdot \color{blue}{\cos t}}\right|} \]
        6. Simplified89.5%

          \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew \cdot \cos t}}\right|} \]
        7. Step-by-step derivation
          1. inv-powN/A

            \[\leadsto \frac{1}{\left|\color{blue}{{\left(ew \cdot \cos t\right)}^{-1}}\right|} \]
          2. *-commutativeN/A

            \[\leadsto \frac{1}{\left|{\color{blue}{\left(\cos t \cdot ew\right)}}^{-1}\right|} \]
          3. sqr-powN/A

            \[\leadsto \frac{1}{\left|\color{blue}{{\left(\cos t \cdot ew\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\cos t \cdot ew\right)}^{\left(\frac{-1}{2}\right)}}\right|} \]
          4. fabs-sqrN/A

            \[\leadsto \frac{1}{\color{blue}{{\left(\cos t \cdot ew\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\cos t \cdot ew\right)}^{\left(\frac{-1}{2}\right)}}} \]
          5. sqr-powN/A

            \[\leadsto \frac{1}{\color{blue}{{\left(\cos t \cdot ew\right)}^{-1}}} \]
          6. inv-powN/A

            \[\leadsto \frac{1}{\color{blue}{\frac{1}{\cos t \cdot ew}}} \]
          7. clear-numN/A

            \[\leadsto \color{blue}{\frac{\cos t \cdot ew}{1}} \]
          8. /-rgt-identityN/A

            \[\leadsto \color{blue}{\cos t \cdot ew} \]
          9. *-lowering-*.f64N/A

            \[\leadsto \color{blue}{\cos t \cdot ew} \]
          10. cos-lowering-cos.f6461.9

            \[\leadsto \color{blue}{\cos t} \cdot ew \]
        8. Applied egg-rr61.9%

          \[\leadsto \color{blue}{\cos t \cdot ew} \]
      7. Recombined 3 regimes into one program.
      8. Add Preprocessing

      Alternative 7: 46.3% accurate, 7.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := eh \cdot \sin t\\ \mathbf{if}\;eh \leq -1.05 \cdot 10^{+98}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 6.3 \cdot 10^{+180}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (eh ew t)
       :precision binary64
       (let* ((t_1 (* eh (sin t))))
         (if (<= eh -1.05e+98) t_1 (if (<= eh 6.3e+180) (fabs ew) t_1))))
      double code(double eh, double ew, double t) {
      	double t_1 = eh * sin(t);
      	double tmp;
      	if (eh <= -1.05e+98) {
      		tmp = t_1;
      	} else if (eh <= 6.3e+180) {
      		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 = eh * sin(t)
          if (eh <= (-1.05d+98)) then
              tmp = t_1
          else if (eh <= 6.3d+180) 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 = eh * Math.sin(t);
      	double tmp;
      	if (eh <= -1.05e+98) {
      		tmp = t_1;
      	} else if (eh <= 6.3e+180) {
      		tmp = Math.abs(ew);
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(eh, ew, t):
      	t_1 = eh * math.sin(t)
      	tmp = 0
      	if eh <= -1.05e+98:
      		tmp = t_1
      	elif eh <= 6.3e+180:
      		tmp = math.fabs(ew)
      	else:
      		tmp = t_1
      	return tmp
      
      function code(eh, ew, t)
      	t_1 = Float64(eh * sin(t))
      	tmp = 0.0
      	if (eh <= -1.05e+98)
      		tmp = t_1;
      	elseif (eh <= 6.3e+180)
      		tmp = abs(ew);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(eh, ew, t)
      	t_1 = eh * sin(t);
      	tmp = 0.0;
      	if (eh <= -1.05e+98)
      		tmp = t_1;
      	elseif (eh <= 6.3e+180)
      		tmp = abs(ew);
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -1.05e+98], t$95$1, If[LessEqual[eh, 6.3e+180], N[Abs[ew], $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := eh \cdot \sin t\\
      \mathbf{if}\;eh \leq -1.05 \cdot 10^{+98}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;eh \leq 6.3 \cdot 10^{+180}:\\
      \;\;\;\;\left|ew\right|\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if eh < -1.05000000000000002e98 or 6.2999999999999999e180 < eh

        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. Applied egg-rr40.6%

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

            \[\leadsto \frac{1}{\left|\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{-1}}\right|} \]
          2. sqr-powN/A

            \[\leadsto \frac{1}{\left|\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)}}\right|} \]
          3. fabs-sqrN/A

            \[\leadsto \frac{1}{\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)}}} \]
          4. sqr-powN/A

            \[\leadsto \frac{1}{\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{-1}}} \]
        5. Applied egg-rr18.2%

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(eh, \sin t \cdot \frac{eh \cdot \tan t}{ew}, \cos t \cdot ew\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{ew}\right)}^{2}}}} \]
        6. Taylor expanded in eh around inf

          \[\leadsto \color{blue}{eh \cdot \sin t} \]
        7. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \color{blue}{eh \cdot \sin t} \]
          2. sin-lowering-sin.f6449.2

            \[\leadsto eh \cdot \color{blue}{\sin t} \]
        8. Simplified49.2%

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

        if -1.05000000000000002e98 < eh < 6.2999999999999999e180

        1. Initial program 99.9%

          \[\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. sub-negN/A

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

            \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
          3. *-commutativeN/A

            \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
          4. accelerator-lowering-fma.f64N/A

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

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

          \[\leadsto \left|\color{blue}{ew}\right| \]
        6. Step-by-step derivation
          1. Simplified47.9%

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

        Alternative 8: 45.6% accurate, 20.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -4.9 \cdot 10^{-114}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{elif}\;ew \leq 1.6 \cdot 10^{-218}:\\ \;\;\;\;\frac{1}{\left|\frac{1}{t \cdot eh}\right|}\\ \mathbf{else}:\\ \;\;\;\;ew\\ \end{array} \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (if (<= ew -4.9e-114)
           (fabs ew)
           (if (<= ew 1.6e-218) (/ 1.0 (fabs (/ 1.0 (* t eh)))) ew)))
        double code(double eh, double ew, double t) {
        	double tmp;
        	if (ew <= -4.9e-114) {
        		tmp = fabs(ew);
        	} else if (ew <= 1.6e-218) {
        		tmp = 1.0 / fabs((1.0 / (t * eh)));
        	} else {
        		tmp = ew;
        	}
        	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) :: tmp
            if (ew <= (-4.9d-114)) then
                tmp = abs(ew)
            else if (ew <= 1.6d-218) then
                tmp = 1.0d0 / abs((1.0d0 / (t * eh)))
            else
                tmp = ew
            end if
            code = tmp
        end function
        
        public static double code(double eh, double ew, double t) {
        	double tmp;
        	if (ew <= -4.9e-114) {
        		tmp = Math.abs(ew);
        	} else if (ew <= 1.6e-218) {
        		tmp = 1.0 / Math.abs((1.0 / (t * eh)));
        	} else {
        		tmp = ew;
        	}
        	return tmp;
        }
        
        def code(eh, ew, t):
        	tmp = 0
        	if ew <= -4.9e-114:
        		tmp = math.fabs(ew)
        	elif ew <= 1.6e-218:
        		tmp = 1.0 / math.fabs((1.0 / (t * eh)))
        	else:
        		tmp = ew
        	return tmp
        
        function code(eh, ew, t)
        	tmp = 0.0
        	if (ew <= -4.9e-114)
        		tmp = abs(ew);
        	elseif (ew <= 1.6e-218)
        		tmp = Float64(1.0 / abs(Float64(1.0 / Float64(t * eh))));
        	else
        		tmp = ew;
        	end
        	return tmp
        end
        
        function tmp_2 = code(eh, ew, t)
        	tmp = 0.0;
        	if (ew <= -4.9e-114)
        		tmp = abs(ew);
        	elseif (ew <= 1.6e-218)
        		tmp = 1.0 / abs((1.0 / (t * eh)));
        	else
        		tmp = ew;
        	end
        	tmp_2 = tmp;
        end
        
        code[eh_, ew_, t_] := If[LessEqual[ew, -4.9e-114], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 1.6e-218], N[(1.0 / N[Abs[N[(1.0 / N[(t * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], ew]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;ew \leq -4.9 \cdot 10^{-114}:\\
        \;\;\;\;\left|ew\right|\\
        
        \mathbf{elif}\;ew \leq 1.6 \cdot 10^{-218}:\\
        \;\;\;\;\frac{1}{\left|\frac{1}{t \cdot eh}\right|}\\
        
        \mathbf{else}:\\
        \;\;\;\;ew\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if ew < -4.8999999999999997e-114

          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. sub-negN/A

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

              \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
            3. *-commutativeN/A

              \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
            4. accelerator-lowering-fma.f64N/A

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

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

            \[\leadsto \left|\color{blue}{ew}\right| \]
          6. Step-by-step derivation
            1. Simplified48.7%

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

            if -4.8999999999999997e-114 < ew < 1.6000000000000001e-218

            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. Applied egg-rr35.1%

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

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{eh \cdot \sin t}}\right|} \]
            5. Step-by-step derivation
              1. /-lowering-/.f64N/A

                \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{eh \cdot \sin t}}\right|} \]
              2. *-lowering-*.f64N/A

                \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{eh \cdot \sin t}}\right|} \]
              3. sin-lowering-sin.f6479.4

                \[\leadsto \frac{1}{\left|\frac{1}{eh \cdot \color{blue}{\sin t}}\right|} \]
            6. Simplified79.4%

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{eh \cdot \sin t}}\right|} \]
            7. Taylor expanded in t around 0

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{eh \cdot t}}\right|} \]
            8. Step-by-step derivation
              1. /-lowering-/.f64N/A

                \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{eh \cdot t}}\right|} \]
              2. *-commutativeN/A

                \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{t \cdot eh}}\right|} \]
              3. *-lowering-*.f6447.2

                \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{t \cdot eh}}\right|} \]
            9. Simplified47.2%

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

            if 1.6000000000000001e-218 < 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. Applied egg-rr85.0%

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

                \[\leadsto \frac{1}{\left|\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{-1}}\right|} \]
              2. sqr-powN/A

                \[\leadsto \frac{1}{\left|\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)}}\right|} \]
              3. fabs-sqrN/A

                \[\leadsto \frac{1}{\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)}}} \]
              4. sqr-powN/A

                \[\leadsto \frac{1}{\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{-1}}} \]
            5. Applied egg-rr58.3%

              \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(eh, \sin t \cdot \frac{eh \cdot \tan t}{ew}, \cos t \cdot ew\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{ew}\right)}^{2}}}} \]
            6. Taylor expanded in t around 0

              \[\leadsto \color{blue}{ew} \]
            7. Step-by-step derivation
              1. Simplified47.3%

                \[\leadsto \color{blue}{ew} \]
            8. Recombined 3 regimes into one program.
            9. Add Preprocessing

            Alternative 9: 42.5% accurate, 287.3× 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. sub-negN/A

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

                \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
              3. *-commutativeN/A

                \[\leadsto \left|\color{blue}{\left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right) \cdot ew} + \left(\mathsf{neg}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right)\right)\right| \]
              4. accelerator-lowering-fma.f64N/A

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

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

              \[\leadsto \left|\color{blue}{ew}\right| \]
            6. Step-by-step derivation
              1. Simplified40.6%

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

              Alternative 10: 22.0% accurate, 862.0× speedup?

              \[\begin{array}{l} \\ ew \end{array} \]
              (FPCore (eh ew t) :precision binary64 ew)
              double code(double eh, double ew, double t) {
              	return ew;
              }
              
              real(8) function code(eh, ew, t)
                  real(8), intent (in) :: eh
                  real(8), intent (in) :: ew
                  real(8), intent (in) :: t
                  code = ew
              end function
              
              public static double code(double eh, double ew, double t) {
              	return ew;
              }
              
              def code(eh, ew, t):
              	return ew
              
              function code(eh, ew, t)
              	return ew
              end
              
              function tmp = code(eh, ew, t)
              	tmp = ew;
              end
              
              code[eh_, ew_, t_] := ew
              
              \begin{array}{l}
              
              \\
              ew
              \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. Applied egg-rr75.4%

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

                  \[\leadsto \frac{1}{\left|\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{-1}}\right|} \]
                2. sqr-powN/A

                  \[\leadsto \frac{1}{\left|\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)}}\right|} \]
                3. fabs-sqrN/A

                  \[\leadsto \frac{1}{\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{\left(\frac{-1}{2}\right)}}} \]
                4. sqr-powN/A

                  \[\leadsto \frac{1}{\color{blue}{{\left(\frac{ew \cdot \cos t - \left(\mathsf{neg}\left(eh\right)\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{\mathsf{neg}\left(ew\right)}\right)}^{2}}}\right)}^{-1}}} \]
              5. Applied egg-rr37.2%

                \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(eh, \sin t \cdot \frac{eh \cdot \tan t}{ew}, \cos t \cdot ew\right)}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{ew}\right)}^{2}}}} \]
              6. Taylor expanded in t around 0

                \[\leadsto \color{blue}{ew} \]
              7. Step-by-step derivation
                1. Simplified22.9%

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

                Reproduce

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