Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 18.2s
Alternatives: 11
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 11 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{\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}
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. Add Preprocessing

Alternative 2: 99.8% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
    3. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

Alternative 3: 99.8% accurate, 1.1× speedup?

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

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

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

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

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) + \color{blue}{\left(-eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right| \]
    4. add-sqr-sqrt47.1%

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

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) + \color{blue}{\sqrt{\left(-eh\right) \cdot \left(-eh\right)}} \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
    6. sqr-neg76.6%

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

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) + \color{blue}{\left(\sqrt{eh} \cdot \sqrt{eh}\right)} \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
    8. add-sqr-sqrt99.3%

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) + \color{blue}{eh} \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
    9. associate-*l*99.3%

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

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

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

Alternative 4: 98.5% accurate, 1.5× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
    3. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 74.1% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -3.8 \cdot 10^{+88} \lor \neg \left(eh \leq 5.5 \cdot 10^{-40}\right):\\
\;\;\;\;\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \frac{t}{-ew}\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -3.7999999999999997e88 or 5.50000000000000002e-40 < eh

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

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

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

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

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

      \[\leadsto \left|eh \cdot \mathsf{fma}\left(ew, \cos \tan^{-1} \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right) \cdot \frac{\cos t}{eh}, \sin t \cdot \left(-\sin \tan^{-1} \color{blue}{\left(-1 \cdot \frac{eh \cdot t}{ew}\right)}\right)\right)\right| \]
    7. Step-by-step derivation
      1. associate-*r/99.7%

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

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

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

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

      \[\leadsto \left|\color{blue}{-1 \cdot \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right)\right)\right)}\right| \]
    10. Step-by-step derivation
      1. associate-*r*77.1%

        \[\leadsto \left|\color{blue}{\left(-1 \cdot eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right)\right)}\right| \]
      2. neg-mul-177.1%

        \[\leadsto \left|\color{blue}{\left(-eh\right)} \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right)\right)\right| \]
      3. mul-1-neg77.1%

        \[\leadsto \left|\left(-eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(-\frac{eh \cdot t}{ew}\right)}\right)\right| \]
      4. associate-/l*77.1%

        \[\leadsto \left|\left(-eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-\color{blue}{eh \cdot \frac{t}{ew}}\right)\right)\right| \]
      5. distribute-lft-neg-out77.1%

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

      \[\leadsto \left|\color{blue}{\left(-eh\right) \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{t}{ew}\right)\right)}\right| \]

    if -3.7999999999999997e88 < eh < 5.50000000000000002e-40

    1. Initial program 99.9%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*99.9%

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
      3. associate-*l*99.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -3.8 \cdot 10^{+88} \lor \neg \left(eh \leq 5.5 \cdot 10^{-40}\right):\\ \;\;\;\;\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \frac{t}{-ew}\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 64.9% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.9 \cdot 10^{-200} \lor \neg \left(ew \leq 2.4 \cdot 10^{-49}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.9e-200 or 2.39999999999999992e-49 < 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. associate-*l*99.8%

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
      3. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

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

    if -2.9e-200 < ew < 2.39999999999999992e-49

    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. add-sqr-sqrt58.2%

        \[\leadsto \left|\color{blue}{\sqrt{\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)} \cdot \sqrt{\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. pow258.2%

        \[\leadsto \left|\color{blue}{{\left(\sqrt{\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}}\right| \]
    4. Applied egg-rr58.2%

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

      \[\leadsto \left|{\left(\sqrt{\color{blue}{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)}}\right)}^{2}\right| \]
    6. Step-by-step derivation
      1. associate-*r*47.7%

        \[\leadsto \left|{\left(\sqrt{\color{blue}{\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)}}\right)}^{2}\right| \]
      2. *-commutative47.7%

        \[\leadsto \left|{\left(\sqrt{\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\color{blue}{\tan t \cdot eh}}{ew}\right)}\right)}^{2}\right| \]
      3. associate-*r/47.7%

        \[\leadsto \left|{\left(\sqrt{\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\tan t \cdot \frac{eh}{ew}\right)}}\right)}^{2}\right| \]
      4. *-commutative47.7%

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

        \[\leadsto \left|{\left(\sqrt{\sin \tan^{-1} \color{blue}{\left(\frac{\tan t \cdot eh}{ew}\right)} \cdot \left(eh \cdot \sin t\right)}\right)}^{2}\right| \]
      6. *-commutative47.7%

        \[\leadsto \left|{\left(\sqrt{\sin \tan^{-1} \left(\frac{\color{blue}{eh \cdot \tan t}}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right)}^{2}\right| \]
      7. associate-/l*47.7%

        \[\leadsto \left|{\left(\sqrt{\sin \tan^{-1} \color{blue}{\left(eh \cdot \frac{\tan t}{ew}\right)} \cdot \left(eh \cdot \sin t\right)}\right)}^{2}\right| \]
    7. Simplified47.7%

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

        \[\leadsto \left|\color{blue}{\sqrt{\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)} \cdot \sqrt{\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}}\right| \]
      2. fabs-sqr47.7%

        \[\leadsto \color{blue}{\sqrt{\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)} \cdot \sqrt{\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}} \]
      3. add-sqr-sqrt48.7%

        \[\leadsto \color{blue}{\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)} \]
      4. associate-*r*48.7%

        \[\leadsto \color{blue}{\left(\sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right) \cdot eh\right) \cdot \sin t} \]
      5. clear-num48.7%

        \[\leadsto \left(\sin \tan^{-1} \left(eh \cdot \color{blue}{\frac{1}{\frac{ew}{\tan t}}}\right) \cdot eh\right) \cdot \sin t \]
      6. un-div-inv48.7%

        \[\leadsto \left(\sin \tan^{-1} \color{blue}{\left(\frac{eh}{\frac{ew}{\tan t}}\right)} \cdot eh\right) \cdot \sin t \]
    9. Applied egg-rr48.7%

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

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

Alternative 7: 64.7% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -7.5 \cdot 10^{+178} \lor \neg \left(eh \leq 4 \cdot 10^{+198}\right):\\
\;\;\;\;\left|\left(t \cdot eh\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\right|\\

\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -7.4999999999999995e178 or 4.00000000000000007e198 < eh

    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. add-sqr-sqrt56.7%

        \[\leadsto \left|\color{blue}{\sqrt{\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)} \cdot \sqrt{\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. pow256.7%

        \[\leadsto \left|\color{blue}{{\left(\sqrt{\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}}\right| \]
    4. Applied egg-rr56.7%

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

      \[\leadsto \left|{\left(\sqrt{\color{blue}{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)}}\right)}^{2}\right| \]
    6. Step-by-step derivation
      1. associate-*r*49.9%

        \[\leadsto \left|{\left(\sqrt{\color{blue}{\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)}}\right)}^{2}\right| \]
      2. *-commutative49.9%

        \[\leadsto \left|{\left(\sqrt{\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\color{blue}{\tan t \cdot eh}}{ew}\right)}\right)}^{2}\right| \]
      3. associate-*r/49.9%

        \[\leadsto \left|{\left(\sqrt{\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\tan t \cdot \frac{eh}{ew}\right)}}\right)}^{2}\right| \]
      4. *-commutative49.9%

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

        \[\leadsto \left|{\left(\sqrt{\sin \tan^{-1} \color{blue}{\left(\frac{\tan t \cdot eh}{ew}\right)} \cdot \left(eh \cdot \sin t\right)}\right)}^{2}\right| \]
      6. *-commutative49.9%

        \[\leadsto \left|{\left(\sqrt{\sin \tan^{-1} \left(\frac{\color{blue}{eh \cdot \tan t}}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right)}^{2}\right| \]
      7. associate-/l*49.9%

        \[\leadsto \left|{\left(\sqrt{\sin \tan^{-1} \color{blue}{\left(eh \cdot \frac{\tan t}{ew}\right)} \cdot \left(eh \cdot \sin t\right)}\right)}^{2}\right| \]
    7. Simplified49.9%

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

      \[\leadsto \left|\color{blue}{eh \cdot \left(t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)}\right| \]
    9. Step-by-step derivation
      1. associate-*r*38.6%

        \[\leadsto \left|\color{blue}{\left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)}\right| \]
      2. associate-/l*38.6%

        \[\leadsto \left|\left(eh \cdot t\right) \cdot \sin \tan^{-1} \color{blue}{\left(eh \cdot \frac{\tan t}{ew}\right)}\right| \]
    10. Simplified38.6%

      \[\leadsto \left|\color{blue}{\left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)}\right| \]

    if -7.4999999999999995e178 < eh < 4.00000000000000007e198

    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. associate-*l*99.8%

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
      3. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -7.5 \cdot 10^{+178} \lor \neg \left(eh \leq 4 \cdot 10^{+198}\right):\\ \;\;\;\;\left|\left(t \cdot eh\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 62.3% accurate, 4.5× speedup?

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

\\
\left|ew \cdot \cos t\right|
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
    3. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 49.6% accurate, 8.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.035 \lor \neg \left(t \leq 4.2 \cdot 10^{-7}\right):\\
\;\;\;\;ew \cdot \cos t\\

\mathbf{else}:\\
\;\;\;\;\left|ew\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -0.035000000000000003 or 4.2e-7 < 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. associate-*l*99.6%

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
      3. associate-*l*99.6%

        \[\leadsto \left|\mathsf{fma}\left(ew, \cos t \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right), -\color{blue}{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right)\right| \]
      4. distribute-lft-neg-in99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
    6. Step-by-step derivation
      1. add-sqr-sqrt25.7%

        \[\leadsto \left|\color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}}\right| \]
      2. fabs-sqr25.7%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
      3. add-sqr-sqrt26.7%

        \[\leadsto \color{blue}{ew \cdot \cos t} \]
      4. *-commutative26.7%

        \[\leadsto \color{blue}{\cos t \cdot ew} \]
    7. Applied egg-rr26.7%

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

    if -0.035000000000000003 < t < 4.2e-7

    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. associate-*l*100.0%

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
      3. associate-*l*100.0%

        \[\leadsto \left|\mathsf{fma}\left(ew, \cos t \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right), -\color{blue}{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right)\right| \]
      4. distribute-lft-neg-in100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{ew}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -0.035 \lor \neg \left(t \leq 4.2 \cdot 10^{-7}\right):\\ \;\;\;\;ew \cdot \cos t\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 42.8% accurate, 9.1× speedup?

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

\\
\left|ew\right|
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
    3. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

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

Alternative 11: 22.3% accurate, 921.0× speedup?

\[\begin{array}{l} \\ ew \end{array} \]
(FPCore (eh ew t) :precision binary64 ew)
double code(double eh, double ew, double t) {
	return ew;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = ew
end function
public static double code(double eh, double ew, double t) {
	return ew;
}
def code(eh, ew, t):
	return ew
function code(eh, ew, t)
	return ew
end
function tmp = code(eh, ew, t)
	tmp = ew;
end
code[eh_, ew_, t_] := ew
\begin{array}{l}

\\
ew
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, \cos t \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)}\right| \]
    3. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left|ew\right| \cdot \left|ew\right|\right) \cdot \left|ew\right|}} \]
    2. pow1/316.4%

      \[\leadsto \color{blue}{{\left(\left(\left|ew\right| \cdot \left|ew\right|\right) \cdot \left|ew\right|\right)}^{0.3333333333333333}} \]
    3. pow316.4%

      \[\leadsto {\color{blue}{\left({\left(\left|ew\right|\right)}^{3}\right)}}^{0.3333333333333333} \]
  7. Applied egg-rr16.4%

    \[\leadsto \color{blue}{{\left({\left(\left|ew\right|\right)}^{3}\right)}^{0.3333333333333333}} \]
  8. Step-by-step derivation
    1. unpow1/317.2%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\left|ew\right|\right)}^{3}}} \]
    2. rem-cbrt-cube43.6%

      \[\leadsto \color{blue}{\left|ew\right|} \]
    3. add-sqr-sqrt22.7%

      \[\leadsto \left|\color{blue}{\sqrt{ew} \cdot \sqrt{ew}}\right| \]
    4. fabs-sqr22.7%

      \[\leadsto \color{blue}{\sqrt{ew} \cdot \sqrt{ew}} \]
    5. *-un-lft-identity22.7%

      \[\leadsto \color{blue}{1 \cdot \left(\sqrt{ew} \cdot \sqrt{ew}\right)} \]
    6. add-sqr-sqrt23.5%

      \[\leadsto 1 \cdot \color{blue}{ew} \]
  9. Applied egg-rr23.5%

    \[\leadsto \color{blue}{1 \cdot ew} \]
  10. Final simplification23.5%

    \[\leadsto ew \]
  11. Add Preprocessing

Reproduce

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