Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 12.4s
Alternatives: 7
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)\\
\left|\mathsf{fma}\left(\cos t\_1 \cdot \cos t, ew, \left(\sin t\_1 \cdot \sin t\right) \cdot eh\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. Applied rewrites99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.4% accurate, 1.6× speedup?

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

\\
\left|\mathsf{fma}\left(\cos t, ew, \left(\sin \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot \sin t\right) \cdot eh\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. Applied rewrites99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 74.2% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -1.8 \cdot 10^{-165} \lor \neg \left(ew \leq 5.6 \cdot 10^{-70}\right):\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(-\sin t\right) \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{ew} \cdot t\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (or (<= ew -1.8e-165) (not (<= ew 5.6e-70)))
   (fabs (* (cos t) ew))
   (fabs (* (* (- (sin t)) eh) (sin (atan (* (/ (- eh) ew) t)))))))
double code(double eh, double ew, double t) {
	double tmp;
	if ((ew <= -1.8e-165) || !(ew <= 5.6e-70)) {
		tmp = fabs((cos(t) * ew));
	} else {
		tmp = fabs(((-sin(t) * eh) * sin(atan(((-eh / ew) * t)))));
	}
	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 <= (-1.8d-165)) .or. (.not. (ew <= 5.6d-70))) then
        tmp = abs((cos(t) * ew))
    else
        tmp = abs(((-sin(t) * eh) * sin(atan(((-eh / ew) * t)))))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if ((ew <= -1.8e-165) || !(ew <= 5.6e-70)) {
		tmp = Math.abs((Math.cos(t) * ew));
	} else {
		tmp = Math.abs(((-Math.sin(t) * eh) * Math.sin(Math.atan(((-eh / ew) * t)))));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if (ew <= -1.8e-165) or not (ew <= 5.6e-70):
		tmp = math.fabs((math.cos(t) * ew))
	else:
		tmp = math.fabs(((-math.sin(t) * eh) * math.sin(math.atan(((-eh / ew) * t)))))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if ((ew <= -1.8e-165) || !(ew <= 5.6e-70))
		tmp = abs(Float64(cos(t) * ew));
	else
		tmp = abs(Float64(Float64(Float64(-sin(t)) * eh) * sin(atan(Float64(Float64(Float64(-eh) / ew) * t)))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if ((ew <= -1.8e-165) || ~((ew <= 5.6e-70)))
		tmp = abs((cos(t) * ew));
	else
		tmp = abs(((-sin(t) * eh) * sin(atan(((-eh / ew) * t)))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -1.8e-165], N[Not[LessEqual[ew, 5.6e-70]], $MachinePrecision]], N[Abs[N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[((-N[Sin[t], $MachinePrecision]) * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) / ew), $MachinePrecision] * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.8 \cdot 10^{-165} \lor \neg \left(ew \leq 5.6 \cdot 10^{-70}\right):\\
\;\;\;\;\left|\cos t \cdot ew\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\left(\left(-\sin t\right) \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{ew} \cdot t\right)\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.79999999999999992e-165 or 5.5999999999999998e-70 < 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 rewrites99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
      3. lower-cos.f6477.8

        \[\leadsto \left|\color{blue}{\cos t} \cdot ew\right| \]
    9. Applied rewrites77.8%

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

    if -1.79999999999999992e-165 < ew < 5.5999999999999998e-70

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\left(-\sin t\right) \cdot eh\right) \cdot \color{blue}{\sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right| \]
      11. lower-atan.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \left|\left(\left(-\sin t\right) \cdot eh\right) \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right)\right| \]
    7. Step-by-step derivation
      1. Applied rewrites76.5%

        \[\leadsto \left|\left(\left(-\sin t\right) \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{ew} \cdot t\right)\right| \]
    8. Recombined 2 regimes into one program.
    9. Final simplification77.5%

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

    Alternative 5: 63.1% accurate, 3.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -2.12 \cdot 10^{-215} \lor \neg \left(ew \leq 5.6 \cdot 10^{-192}\right):\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(-eh\right) \cdot t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{ew} \cdot t\right)\right|\\ \end{array} \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (if (or (<= ew -2.12e-215) (not (<= ew 5.6e-192)))
       (fabs (* (cos t) ew))
       (fabs (* (* (- eh) t) (sin (atan (* (/ (- eh) ew) t)))))))
    double code(double eh, double ew, double t) {
    	double tmp;
    	if ((ew <= -2.12e-215) || !(ew <= 5.6e-192)) {
    		tmp = fabs((cos(t) * ew));
    	} else {
    		tmp = fabs(((-eh * t) * sin(atan(((-eh / ew) * t)))));
    	}
    	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 <= (-2.12d-215)) .or. (.not. (ew <= 5.6d-192))) then
            tmp = abs((cos(t) * ew))
        else
            tmp = abs(((-eh * t) * sin(atan(((-eh / ew) * t)))))
        end if
        code = tmp
    end function
    
    public static double code(double eh, double ew, double t) {
    	double tmp;
    	if ((ew <= -2.12e-215) || !(ew <= 5.6e-192)) {
    		tmp = Math.abs((Math.cos(t) * ew));
    	} else {
    		tmp = Math.abs(((-eh * t) * Math.sin(Math.atan(((-eh / ew) * t)))));
    	}
    	return tmp;
    }
    
    def code(eh, ew, t):
    	tmp = 0
    	if (ew <= -2.12e-215) or not (ew <= 5.6e-192):
    		tmp = math.fabs((math.cos(t) * ew))
    	else:
    		tmp = math.fabs(((-eh * t) * math.sin(math.atan(((-eh / ew) * t)))))
    	return tmp
    
    function code(eh, ew, t)
    	tmp = 0.0
    	if ((ew <= -2.12e-215) || !(ew <= 5.6e-192))
    		tmp = abs(Float64(cos(t) * ew));
    	else
    		tmp = abs(Float64(Float64(Float64(-eh) * t) * sin(atan(Float64(Float64(Float64(-eh) / ew) * t)))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(eh, ew, t)
    	tmp = 0.0;
    	if ((ew <= -2.12e-215) || ~((ew <= 5.6e-192)))
    		tmp = abs((cos(t) * ew));
    	else
    		tmp = abs(((-eh * t) * sin(atan(((-eh / ew) * t)))));
    	end
    	tmp_2 = tmp;
    end
    
    code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.12e-215], N[Not[LessEqual[ew, 5.6e-192]], $MachinePrecision]], N[Abs[N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[((-eh) * t), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[((-eh) / ew), $MachinePrecision] * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;ew \leq -2.12 \cdot 10^{-215} \lor \neg \left(ew \leq 5.6 \cdot 10^{-192}\right):\\
    \;\;\;\;\left|\cos t \cdot ew\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;\left|\left(\left(-eh\right) \cdot t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{ew} \cdot t\right)\right|\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if ew < -2.11999999999999991e-215 or 5.60000000000000007e-192 < 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 rewrites99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
        3. lower-cos.f6471.7

          \[\leadsto \left|\color{blue}{\cos t} \cdot ew\right| \]
      9. Applied rewrites71.7%

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

      if -2.11999999999999991e-215 < ew < 5.60000000000000007e-192

      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. Taylor expanded in eh around inf

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

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

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

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

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

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

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

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

          \[\leadsto \left|\left(\left(-\sin t\right) \cdot eh\right) \cdot \color{blue}{\sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right| \]
        11. lower-atan.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\left(-\sin t\right) \cdot eh\right) \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right)\right| \]
      7. Step-by-step derivation
        1. Applied rewrites87.0%

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

          \[\leadsto \left|\left(-1 \cdot \left(eh \cdot t\right)\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{-eh}{ew} \cdot t\right)}\right| \]
        3. Step-by-step derivation
          1. Applied rewrites42.2%

            \[\leadsto \left|\left(\left(-eh\right) \cdot t\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{-eh}{ew} \cdot t\right)}\right| \]
        4. Recombined 2 regimes into one program.
        5. Final simplification66.9%

          \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -2.12 \cdot 10^{-215} \lor \neg \left(ew \leq 5.6 \cdot 10^{-192}\right):\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(-eh\right) \cdot t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{ew} \cdot t\right)\right|\\ \end{array} \]
        6. Add Preprocessing

        Alternative 6: 61.2% accurate, 8.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
          3. lower-cos.f6462.6

            \[\leadsto \left|\color{blue}{\cos t} \cdot ew\right| \]
        9. Applied rewrites62.6%

          \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
        10. Add Preprocessing

        Alternative 7: 42.0% accurate, 61.6× speedup?

        \[\begin{array}{l} \\ \left|\frac{ew}{1}\right| \end{array} \]
        (FPCore (eh ew t) :precision binary64 (fabs (/ ew 1.0)))
        double code(double eh, double ew, double t) {
        	return fabs((ew / 1.0));
        }
        
        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 / 1.0d0))
        end function
        
        public static double code(double eh, double ew, double t) {
        	return Math.abs((ew / 1.0));
        }
        
        def code(eh, ew, t):
        	return math.fabs((ew / 1.0))
        
        function code(eh, ew, t)
        	return abs(Float64(ew / 1.0))
        end
        
        function tmp = code(eh, ew, t)
        	tmp = abs((ew / 1.0));
        end
        
        code[eh_, ew_, t_] := N[Abs[N[(ew / 1.0), $MachinePrecision]], $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \left|\frac{ew}{1}\right|
        \end{array}
        
        Derivation
        1. Initial program 99.8%

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

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

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

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

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

          \[\leadsto \left|\cos \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right) \cdot ew\right| \]
        7. Step-by-step derivation
          1. Applied rewrites40.9%

            \[\leadsto \left|\cos \tan^{-1} \left(\frac{-eh}{ew} \cdot t\right) \cdot ew\right| \]
          2. Step-by-step derivation
            1. Applied rewrites40.0%

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

              \[\leadsto \left|\frac{ew}{1}\right| \]
            3. Step-by-step derivation
              1. Applied rewrites42.2%

                \[\leadsto \left|\frac{ew}{1}\right| \]
              2. Add Preprocessing

              Reproduce

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