Example 2 from Robby

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

\\
\begin{array}{l}
t_1 := \frac{eh \cdot \tan t}{0 - ew}\\
\left|\mathsf{fma}\left(\frac{\cos t}{\sqrt{1 + {t\_1}^{2}}}, ew, eh \cdot \left(\sin \tan^{-1} t\_1 \cdot \left(0 - \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}{0 - ew}\right)}^{2}}}, ew, \left(0 - eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - ew}\right)\right)\right)}\right| \]
  5. Final simplification99.8%

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

Alternative 2: 99.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{eh \cdot \tan t}{0 - ew}\\ \left|\mathsf{fma}\left(\sin t, \left(0 - eh\right) \cdot \sin \tan^{-1} t\_1, \frac{\cos t \cdot ew}{\sqrt{1 + {t\_1}^{2}}}\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ (* eh (tan t)) (- 0.0 ew))))
   (fabs
    (fma
     (sin t)
     (* (- 0.0 eh) (sin (atan t_1)))
     (/ (* (cos t) ew) (sqrt (+ 1.0 (pow t_1 2.0))))))))
double code(double eh, double ew, double t) {
	double t_1 = (eh * tan(t)) / (0.0 - ew);
	return fabs(fma(sin(t), ((0.0 - eh) * sin(atan(t_1))), ((cos(t) * ew) / sqrt((1.0 + pow(t_1, 2.0))))));
}
function code(eh, ew, t)
	t_1 = Float64(Float64(eh * tan(t)) / Float64(0.0 - ew))
	return abs(fma(sin(t), Float64(Float64(0.0 - eh) * sin(atan(t_1))), Float64(Float64(cos(t) * ew) / sqrt(Float64(1.0 + (t_1 ^ 2.0))))))
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[Sin[t], $MachinePrecision] * N[(N[(0.0 - eh), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

      \[\leadsto \left|\left(\mathsf{neg}\left(\color{blue}{\left(\sin t \cdot eh\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| \]
    4. associate-*l*N/A

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

      \[\leadsto \left|\color{blue}{\sin t \cdot \left(\mathsf{neg}\left(eh \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| \]
    6. *-commutativeN/A

      \[\leadsto \left|\sin t \cdot \left(\mathsf{neg}\left(\color{blue}{\sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right) \cdot eh}\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| \]
    7. accelerator-lowering-fma.f64N/A

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

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

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

Alternative 3: 98.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \left|\mathsf{fma}\left(\sin t, eh \cdot \left(eh \cdot \frac{-1}{eh}\right), \frac{\cos t \cdot ew}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{0 - ew}\right)}^{2}}}\right)\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (fma
   (sin t)
   (* eh (* eh (/ -1.0 eh)))
   (/ (* (cos t) ew) (sqrt (+ 1.0 (pow (/ (* eh (tan t)) (- 0.0 ew)) 2.0)))))))
double code(double eh, double ew, double t) {
	return fabs(fma(sin(t), (eh * (eh * (-1.0 / eh))), ((cos(t) * ew) / sqrt((1.0 + pow(((eh * tan(t)) / (0.0 - ew)), 2.0))))));
}
function code(eh, ew, t)
	return abs(fma(sin(t), Float64(eh * Float64(eh * Float64(-1.0 / eh))), Float64(Float64(cos(t) * ew) / sqrt(Float64(1.0 + (Float64(Float64(eh * tan(t)) / Float64(0.0 - ew)) ^ 2.0))))))
end
code[eh_, ew_, t_] := N[Abs[N[(N[Sin[t], $MachinePrecision] * N[(eh * N[(eh * N[(-1.0 / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / N[(0.0 - ew), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\mathsf{fma}\left(\sin t, eh \cdot \left(eh \cdot \frac{-1}{eh}\right), \frac{\cos t \cdot ew}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{0 - ew}\right)}^{2}}}\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. +-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. *-commutativeN/A

      \[\leadsto \left|\left(\mathsf{neg}\left(\color{blue}{\left(\sin t \cdot eh\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| \]
    4. associate-*l*N/A

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

      \[\leadsto \left|\color{blue}{\sin t \cdot \left(\mathsf{neg}\left(eh \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| \]
    6. *-commutativeN/A

      \[\leadsto \left|\sin t \cdot \left(\mathsf{neg}\left(\color{blue}{\sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right) \cdot eh}\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| \]
    7. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 89.6% accurate, 3.8× speedup?

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

\\
\left|ew \cdot \left(\cos t - eh \cdot \frac{\sin t}{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. +-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. *-commutativeN/A

      \[\leadsto \left|\left(\mathsf{neg}\left(\color{blue}{\left(\sin t \cdot eh\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| \]
    4. associate-*l*N/A

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

      \[\leadsto \left|\color{blue}{\sin t \cdot \left(\mathsf{neg}\left(eh \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| \]
    6. *-commutativeN/A

      \[\leadsto \left|\sin t \cdot \left(\mathsf{neg}\left(\color{blue}{\sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right) \cdot eh}\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| \]
    7. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t + -1 \cdot \frac{eh \cdot \sin t}{ew}\right)}\right| \]
  11. Step-by-step derivation
    1. *-lowering-*.f64N/A

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

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

      \[\leadsto \left|ew \cdot \color{blue}{\left(\cos t - \frac{eh \cdot \sin t}{ew}\right)}\right| \]
    4. --lowering--.f64N/A

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

      \[\leadsto \left|ew \cdot \left(\color{blue}{\cos t} - \frac{eh \cdot \sin t}{ew}\right)\right| \]
    6. associate-/l*N/A

      \[\leadsto \left|ew \cdot \left(\cos t - \color{blue}{eh \cdot \frac{\sin t}{ew}}\right)\right| \]
    7. *-lowering-*.f64N/A

      \[\leadsto \left|ew \cdot \left(\cos t - \color{blue}{eh \cdot \frac{\sin t}{ew}}\right)\right| \]
    8. /-lowering-/.f64N/A

      \[\leadsto \left|ew \cdot \left(\cos t - eh \cdot \color{blue}{\frac{\sin t}{ew}}\right)\right| \]
    9. sin-lowering-sin.f6490.0

      \[\leadsto \left|ew \cdot \left(\cos t - eh \cdot \frac{\color{blue}{\sin t}}{ew}\right)\right| \]
  12. Simplified90.0%

    \[\leadsto \left|\color{blue}{ew \cdot \left(\cos t - eh \cdot \frac{\sin t}{ew}\right)}\right| \]
  13. Add Preprocessing

Alternative 5: 74.5% accurate, 7.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\cos t \cdot ew\right|\\ \mathbf{if}\;ew \leq -1.62 \cdot 10^{-93}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 1.25 \cdot 10^{-101}:\\ \;\;\;\;\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 -1.62e-93)
     t_1
     (if (<= ew 1.25e-101) (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 <= -1.62e-93) {
		tmp = t_1;
	} else if (ew <= 1.25e-101) {
		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 <= (-1.62d-93)) then
        tmp = t_1
    else if (ew <= 1.25d-101) 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 <= -1.62e-93) {
		tmp = t_1;
	} else if (ew <= 1.25e-101) {
		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 <= -1.62e-93:
		tmp = t_1
	elif ew <= 1.25e-101:
		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 <= -1.62e-93)
		tmp = t_1;
	elseif (ew <= 1.25e-101)
		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 <= -1.62e-93)
		tmp = t_1;
	elseif (ew <= 1.25e-101)
		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, -1.62e-93], t$95$1, If[LessEqual[ew, 1.25e-101], 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 -1.62 \cdot 10^{-93}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;ew \leq 1.25 \cdot 10^{-101}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.6200000000000001e-93 or 1.25e-101 < 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}{0 - ew}\right)}^{2}}}, ew, \left(0 - eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - 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.f6481.6

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

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

    if -1.6200000000000001e-93 < ew < 1.25e-101

    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. neg-fabsN/A

        \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. fabs-lowering-fabs.f64N/A

        \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. sub-negN/A

        \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
      4. +-commutativeN/A

        \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
      5. distribute-neg-inN/A

        \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(\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)\right) + \left(\mathsf{neg}\left(\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)\right)}\right| \]
    4. Applied egg-rr58.0%

      \[\leadsto \color{blue}{\left|\frac{\left(0 - eh\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right) - ew \cdot \cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{0 - ew}\right)}^{2}}}\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.f6471.1

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

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

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

Alternative 6: 60.1% accurate, 7.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|eh \cdot \sin t\right|\\ \mathbf{if}\;t \leq -0.00016:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{-97}:\\ \;\;\;\;\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 -0.00016) t_1 (if (<= t 2.4e-97) (fabs ew) t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((eh * sin(t)));
	double tmp;
	if (t <= -0.00016) {
		tmp = t_1;
	} else if (t <= 2.4e-97) {
		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 <= (-0.00016d0)) then
        tmp = t_1
    else if (t <= 2.4d-97) 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 <= -0.00016) {
		tmp = t_1;
	} else if (t <= 2.4e-97) {
		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 <= -0.00016:
		tmp = t_1
	elif t <= 2.4e-97:
		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 <= -0.00016)
		tmp = t_1;
	elseif (t <= 2.4e-97)
		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 <= -0.00016)
		tmp = t_1;
	elseif (t <= 2.4e-97)
		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, -0.00016], t$95$1, If[LessEqual[t, 2.4e-97], 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 -0.00016:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 2.4 \cdot 10^{-97}:\\
\;\;\;\;\left|ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.60000000000000013e-4 or 2.4e-97 < 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. Step-by-step derivation
      1. neg-fabsN/A

        \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. fabs-lowering-fabs.f64N/A

        \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. sub-negN/A

        \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
      4. +-commutativeN/A

        \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
      5. distribute-neg-inN/A

        \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(\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)\right) + \left(\mathsf{neg}\left(\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)\right)}\right| \]
    4. Applied egg-rr76.0%

      \[\leadsto \color{blue}{\left|\frac{\left(0 - eh\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right) - ew \cdot \cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{0 - ew}\right)}^{2}}}\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.f6445.6

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

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

    if -1.60000000000000013e-4 < t < 2.4e-97

    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. 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-rr100.0%

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

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

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

    Alternative 7: 44.5% accurate, 18.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -1.08 \cdot 10^{-148}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{elif}\;ew \leq 3.4 \cdot 10^{-221}:\\ \;\;\;\;\left|eh \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, 0.008333333333333333, -0.16666666666666666\right), 1\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (if (<= ew -1.08e-148)
       (fabs ew)
       (if (<= ew 3.4e-221)
         (fabs
          (*
           eh
           (*
            t
            (fma
             (* t t)
             (fma (* t t) 0.008333333333333333 -0.16666666666666666)
             1.0))))
         (fabs ew))))
    double code(double eh, double ew, double t) {
    	double tmp;
    	if (ew <= -1.08e-148) {
    		tmp = fabs(ew);
    	} else if (ew <= 3.4e-221) {
    		tmp = fabs((eh * (t * fma((t * t), fma((t * t), 0.008333333333333333, -0.16666666666666666), 1.0))));
    	} else {
    		tmp = fabs(ew);
    	}
    	return tmp;
    }
    
    function code(eh, ew, t)
    	tmp = 0.0
    	if (ew <= -1.08e-148)
    		tmp = abs(ew);
    	elseif (ew <= 3.4e-221)
    		tmp = abs(Float64(eh * Float64(t * fma(Float64(t * t), fma(Float64(t * t), 0.008333333333333333, -0.16666666666666666), 1.0))));
    	else
    		tmp = abs(ew);
    	end
    	return tmp
    end
    
    code[eh_, ew_, t_] := If[LessEqual[ew, -1.08e-148], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 3.4e-221], N[Abs[N[(eh * N[(t * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[ew], $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;ew \leq -1.08 \cdot 10^{-148}:\\
    \;\;\;\;\left|ew\right|\\
    
    \mathbf{elif}\;ew \leq 3.4 \cdot 10^{-221}:\\
    \;\;\;\;\left|eh \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, 0.008333333333333333, -0.16666666666666666\right), 1\right)\right)\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;\left|ew\right|\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if ew < -1.08000000000000006e-148 or 3.4000000000000001e-221 < 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}{0 - ew}\right)}^{2}}}, ew, \left(0 - eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - ew}\right)\right)\right)}\right| \]
      5. Taylor expanded in t around 0

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

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

        if -1.08000000000000006e-148 < ew < 3.4000000000000001e-221

        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. neg-fabsN/A

            \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. fabs-lowering-fabs.f64N/A

            \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. sub-negN/A

            \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
          4. +-commutativeN/A

            \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
          5. distribute-neg-inN/A

            \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(\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)\right) + \left(\mathsf{neg}\left(\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)\right)}\right| \]
        4. Applied egg-rr48.1%

          \[\leadsto \color{blue}{\left|\frac{\left(0 - eh\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right) - ew \cdot \cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{0 - ew}\right)}^{2}}}\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.f6481.1

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

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

          \[\leadsto \left|eh \cdot \color{blue}{\left(t \cdot \left(1 + {t}^{2} \cdot \left(\frac{1}{120} \cdot {t}^{2} - \frac{1}{6}\right)\right)\right)}\right| \]
        9. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \left|eh \cdot \color{blue}{\left(t \cdot \left(1 + {t}^{2} \cdot \left(\frac{1}{120} \cdot {t}^{2} - \frac{1}{6}\right)\right)\right)}\right| \]
          2. +-commutativeN/A

            \[\leadsto \left|eh \cdot \left(t \cdot \color{blue}{\left({t}^{2} \cdot \left(\frac{1}{120} \cdot {t}^{2} - \frac{1}{6}\right) + 1\right)}\right)\right| \]
          3. accelerator-lowering-fma.f64N/A

            \[\leadsto \left|eh \cdot \left(t \cdot \color{blue}{\mathsf{fma}\left({t}^{2}, \frac{1}{120} \cdot {t}^{2} - \frac{1}{6}, 1\right)}\right)\right| \]
          4. unpow2N/A

            \[\leadsto \left|eh \cdot \left(t \cdot \mathsf{fma}\left(\color{blue}{t \cdot t}, \frac{1}{120} \cdot {t}^{2} - \frac{1}{6}, 1\right)\right)\right| \]
          5. *-lowering-*.f64N/A

            \[\leadsto \left|eh \cdot \left(t \cdot \mathsf{fma}\left(\color{blue}{t \cdot t}, \frac{1}{120} \cdot {t}^{2} - \frac{1}{6}, 1\right)\right)\right| \]
          6. sub-negN/A

            \[\leadsto \left|eh \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \color{blue}{\frac{1}{120} \cdot {t}^{2} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, 1\right)\right)\right| \]
          7. *-commutativeN/A

            \[\leadsto \left|eh \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \color{blue}{{t}^{2} \cdot \frac{1}{120}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), 1\right)\right)\right| \]
          8. metadata-evalN/A

            \[\leadsto \left|eh \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, {t}^{2} \cdot \frac{1}{120} + \color{blue}{\frac{-1}{6}}, 1\right)\right)\right| \]
          9. accelerator-lowering-fma.f64N/A

            \[\leadsto \left|eh \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \color{blue}{\mathsf{fma}\left({t}^{2}, \frac{1}{120}, \frac{-1}{6}\right)}, 1\right)\right)\right| \]
          10. unpow2N/A

            \[\leadsto \left|eh \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(\color{blue}{t \cdot t}, \frac{1}{120}, \frac{-1}{6}\right), 1\right)\right)\right| \]
          11. *-lowering-*.f6443.8

            \[\leadsto \left|eh \cdot \left(t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(\color{blue}{t \cdot t}, 0.008333333333333333, -0.16666666666666666\right), 1\right)\right)\right| \]
        10. Simplified43.8%

          \[\leadsto \left|eh \cdot \color{blue}{\left(t \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, 0.008333333333333333, -0.16666666666666666\right), 1\right)\right)}\right| \]
      7. Recombined 2 regimes into one program.
      8. Add Preprocessing

      Alternative 8: 44.5% accurate, 23.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -4.4 \cdot 10^{-148}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{elif}\;ew \leq 7.8 \cdot 10^{-224}:\\ \;\;\;\;\left|t \cdot \mathsf{fma}\left(-0.16666666666666666, eh \cdot \left(t \cdot t\right), eh\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \end{array} \]
      (FPCore (eh ew t)
       :precision binary64
       (if (<= ew -4.4e-148)
         (fabs ew)
         (if (<= ew 7.8e-224)
           (fabs (* t (fma -0.16666666666666666 (* eh (* t t)) eh)))
           (fabs ew))))
      double code(double eh, double ew, double t) {
      	double tmp;
      	if (ew <= -4.4e-148) {
      		tmp = fabs(ew);
      	} else if (ew <= 7.8e-224) {
      		tmp = fabs((t * fma(-0.16666666666666666, (eh * (t * t)), eh)));
      	} else {
      		tmp = fabs(ew);
      	}
      	return tmp;
      }
      
      function code(eh, ew, t)
      	tmp = 0.0
      	if (ew <= -4.4e-148)
      		tmp = abs(ew);
      	elseif (ew <= 7.8e-224)
      		tmp = abs(Float64(t * fma(-0.16666666666666666, Float64(eh * Float64(t * t)), eh)));
      	else
      		tmp = abs(ew);
      	end
      	return tmp
      end
      
      code[eh_, ew_, t_] := If[LessEqual[ew, -4.4e-148], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 7.8e-224], N[Abs[N[(t * N[(-0.16666666666666666 * N[(eh * N[(t * t), $MachinePrecision]), $MachinePrecision] + eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[ew], $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;ew \leq -4.4 \cdot 10^{-148}:\\
      \;\;\;\;\left|ew\right|\\
      
      \mathbf{elif}\;ew \leq 7.8 \cdot 10^{-224}:\\
      \;\;\;\;\left|t \cdot \mathsf{fma}\left(-0.16666666666666666, eh \cdot \left(t \cdot t\right), eh\right)\right|\\
      
      \mathbf{else}:\\
      \;\;\;\;\left|ew\right|\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if ew < -4.40000000000000034e-148 or 7.7999999999999996e-224 < 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}{0 - ew}\right)}^{2}}}, ew, \left(0 - eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - ew}\right)\right)\right)}\right| \]
        5. Taylor expanded in t around 0

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

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

          if -4.40000000000000034e-148 < ew < 7.7999999999999996e-224

          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. neg-fabsN/A

              \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. fabs-lowering-fabs.f64N/A

              \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. sub-negN/A

              \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
            4. +-commutativeN/A

              \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
            5. distribute-neg-inN/A

              \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(\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)\right) + \left(\mathsf{neg}\left(\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)\right)}\right| \]
          4. Applied egg-rr48.1%

            \[\leadsto \color{blue}{\left|\frac{\left(0 - eh\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right) - ew \cdot \cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{0 - ew}\right)}^{2}}}\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.f6481.1

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

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

            \[\leadsto \left|\color{blue}{t \cdot \left(eh + \frac{-1}{6} \cdot \left(eh \cdot {t}^{2}\right)\right)}\right| \]
          9. Step-by-step derivation
            1. *-lowering-*.f64N/A

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

              \[\leadsto \left|t \cdot \color{blue}{\left(\frac{-1}{6} \cdot \left(eh \cdot {t}^{2}\right) + eh\right)}\right| \]
            3. accelerator-lowering-fma.f64N/A

              \[\leadsto \left|t \cdot \color{blue}{\mathsf{fma}\left(\frac{-1}{6}, eh \cdot {t}^{2}, eh\right)}\right| \]
            4. *-lowering-*.f64N/A

              \[\leadsto \left|t \cdot \mathsf{fma}\left(\frac{-1}{6}, \color{blue}{eh \cdot {t}^{2}}, eh\right)\right| \]
            5. unpow2N/A

              \[\leadsto \left|t \cdot \mathsf{fma}\left(\frac{-1}{6}, eh \cdot \color{blue}{\left(t \cdot t\right)}, eh\right)\right| \]
            6. *-lowering-*.f6443.6

              \[\leadsto \left|t \cdot \mathsf{fma}\left(-0.16666666666666666, eh \cdot \color{blue}{\left(t \cdot t\right)}, eh\right)\right| \]
          10. Simplified43.6%

            \[\leadsto \left|\color{blue}{t \cdot \mathsf{fma}\left(-0.16666666666666666, eh \cdot \left(t \cdot t\right), eh\right)}\right| \]
        7. Recombined 2 regimes into one program.
        8. Add Preprocessing

        Alternative 9: 44.6% accurate, 43.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -4.8 \cdot 10^{-147}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{elif}\;ew \leq 1.15 \cdot 10^{-221}:\\ \;\;\;\;\left|t \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (if (<= ew -4.8e-147)
           (fabs ew)
           (if (<= ew 1.15e-221) (fabs (* t eh)) (fabs ew))))
        double code(double eh, double ew, double t) {
        	double tmp;
        	if (ew <= -4.8e-147) {
        		tmp = fabs(ew);
        	} else if (ew <= 1.15e-221) {
        		tmp = fabs((t * eh));
        	} else {
        		tmp = fabs(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.8d-147)) then
                tmp = abs(ew)
            else if (ew <= 1.15d-221) then
                tmp = abs((t * eh))
            else
                tmp = abs(ew)
            end if
            code = tmp
        end function
        
        public static double code(double eh, double ew, double t) {
        	double tmp;
        	if (ew <= -4.8e-147) {
        		tmp = Math.abs(ew);
        	} else if (ew <= 1.15e-221) {
        		tmp = Math.abs((t * eh));
        	} else {
        		tmp = Math.abs(ew);
        	}
        	return tmp;
        }
        
        def code(eh, ew, t):
        	tmp = 0
        	if ew <= -4.8e-147:
        		tmp = math.fabs(ew)
        	elif ew <= 1.15e-221:
        		tmp = math.fabs((t * eh))
        	else:
        		tmp = math.fabs(ew)
        	return tmp
        
        function code(eh, ew, t)
        	tmp = 0.0
        	if (ew <= -4.8e-147)
        		tmp = abs(ew);
        	elseif (ew <= 1.15e-221)
        		tmp = abs(Float64(t * eh));
        	else
        		tmp = abs(ew);
        	end
        	return tmp
        end
        
        function tmp_2 = code(eh, ew, t)
        	tmp = 0.0;
        	if (ew <= -4.8e-147)
        		tmp = abs(ew);
        	elseif (ew <= 1.15e-221)
        		tmp = abs((t * eh));
        	else
        		tmp = abs(ew);
        	end
        	tmp_2 = tmp;
        end
        
        code[eh_, ew_, t_] := If[LessEqual[ew, -4.8e-147], N[Abs[ew], $MachinePrecision], If[LessEqual[ew, 1.15e-221], N[Abs[N[(t * eh), $MachinePrecision]], $MachinePrecision], N[Abs[ew], $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;ew \leq -4.8 \cdot 10^{-147}:\\
        \;\;\;\;\left|ew\right|\\
        
        \mathbf{elif}\;ew \leq 1.15 \cdot 10^{-221}:\\
        \;\;\;\;\left|t \cdot eh\right|\\
        
        \mathbf{else}:\\
        \;\;\;\;\left|ew\right|\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if ew < -4.79999999999999997e-147 or 1.15e-221 < 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}{0 - ew}\right)}^{2}}}, ew, \left(0 - eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - ew}\right)\right)\right)}\right| \]
          5. Taylor expanded in t around 0

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

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

            if -4.79999999999999997e-147 < ew < 1.15e-221

            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. neg-fabsN/A

                \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. fabs-lowering-fabs.f64N/A

                \[\leadsto \color{blue}{\left|\mathsf{neg}\left(\left(\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(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. sub-negN/A

                \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
              4. +-commutativeN/A

                \[\leadsto \left|\mathsf{neg}\left(\color{blue}{\left(\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)}\right)\right| \]
              5. distribute-neg-inN/A

                \[\leadsto \left|\color{blue}{\left(\mathsf{neg}\left(\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)\right) + \left(\mathsf{neg}\left(\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)\right)}\right| \]
            4. Applied egg-rr48.1%

              \[\leadsto \color{blue}{\left|\frac{\left(0 - eh\right) \cdot \left(\frac{\tan t}{ew} \cdot \left(eh \cdot \sin t\right)\right) - ew \cdot \cos t}{\sqrt{1 + {\left(\frac{eh \cdot \tan t}{0 - ew}\right)}^{2}}}\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.f6481.1

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

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

              \[\leadsto \left|eh \cdot \color{blue}{t}\right| \]
            9. Step-by-step derivation
              1. Simplified43.5%

                \[\leadsto \left|eh \cdot \color{blue}{t}\right| \]
            10. Recombined 2 regimes into one program.
            11. Final simplification49.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -4.8 \cdot 10^{-147}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{elif}\;ew \leq 1.15 \cdot 10^{-221}:\\ \;\;\;\;\left|t \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \]
            12. Add Preprocessing

            Alternative 10: 41.8% 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}{0 - ew}\right)}^{2}}}, ew, \left(0 - eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{0 - ew}\right)\right)\right)}\right| \]
            5. Taylor expanded in t around 0

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

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

              Reproduce

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