Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 21.1s
Alternatives: 12
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 12 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, 0.9× speedup?

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

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

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

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

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

      \[\leadsto \left|\left(-\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right) + \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    5. distribute-rgt-neg-in99.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| \]
    6. fma-define99.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. Simplified99.8%

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{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(eh * Float64(-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{eh \cdot \left(-\tan t\right)}{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. Final simplification99.8%

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

Alternative 3: 74.5% accurate, 1.8× speedup?

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

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

        \[\leadsto \left|\left(-\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right) + \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
      5. distribute-rgt-neg-in99.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| \]
      6. fma-define99.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. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8000000000000001e88 < eh < 4.5000000000000003e121

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Applied egg-rr51.9%

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

      \[\leadsto \color{blue}{ew \cdot \cos t} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt42.2%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
      2. sqrt-unprod44.8%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      3. pow244.8%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \cos t\right)}^{2}}} \]
    6. Applied egg-rr44.8%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \cos t\right)}^{2}}} \]
    7. Step-by-step derivation
      1. unpow244.8%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      2. rem-sqrt-square81.4%

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

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

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

Alternative 4: 74.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -1.1 \cdot 10^{+88} \lor \neg \left(eh \leq 5 \cdot 10^{+121}\right):\\ \;\;\;\;\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan 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 -1.1e+88) (not (<= eh 5e+121)))
   (fabs (* eh (* (sin t) (sin (atan (* eh (/ (tan t) (- ew))))))))
   (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
	double tmp;
	if ((eh <= -1.1e+88) || !(eh <= 5e+121)) {
		tmp = fabs((eh * (sin(t) * 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 <= (-1.1d+88)) .or. (.not. (eh <= 5d+121))) then
        tmp = abs((eh * (sin(t) * 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 <= -1.1e+88) || !(eh <= 5e+121)) {
		tmp = Math.abs((eh * (Math.sin(t) * 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 <= -1.1e+88) or not (eh <= 5e+121):
		tmp = math.fabs((eh * (math.sin(t) * 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 <= -1.1e+88) || !(eh <= 5e+121))
		tmp = abs(Float64(eh * Float64(sin(t) * sin(atan(Float64(eh * Float64(tan(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 <= -1.1e+88) || ~((eh <= 5e+121)))
		tmp = abs((eh * (sin(t) * 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, -1.1e+88], N[Not[LessEqual[eh, 5e+121]], $MachinePrecision]], N[Abs[N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / (-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 -1.1 \cdot 10^{+88} \lor \neg \left(eh \leq 5 \cdot 10^{+121}\right):\\
\;\;\;\;\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan 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 < -1.10000000000000004e88 or 5.00000000000000007e121 < eh

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

        \[\leadsto \left|\left(-\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right) + \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
      5. distribute-rgt-neg-in99.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| \]
      6. fma-define99.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. Simplified99.8%

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

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

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

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

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

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

    if -1.10000000000000004e88 < eh < 5.00000000000000007e121

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Applied egg-rr51.9%

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

      \[\leadsto \color{blue}{ew \cdot \cos t} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt42.2%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
      2. sqrt-unprod44.8%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      3. pow244.8%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \cos t\right)}^{2}}} \]
    6. Applied egg-rr44.8%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \cos t\right)}^{2}}} \]
    7. Step-by-step derivation
      1. unpow244.8%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      2. rem-sqrt-square81.4%

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

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

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

Alternative 5: 73.6% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -130000 \lor \neg \left(t \leq 11000000000\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.3e5 or 1.1e10 < t

    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. Applied egg-rr51.9%

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

      \[\leadsto \color{blue}{ew \cdot \cos t} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt31.1%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
      2. sqrt-unprod28.4%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      3. pow228.4%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \cos t\right)}^{2}}} \]
    6. Applied egg-rr28.4%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \cos t\right)}^{2}}} \]
    7. Step-by-step derivation
      1. unpow228.4%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      2. rem-sqrt-square55.4%

        \[\leadsto \color{blue}{\left|ew \cdot \cos t\right|} \]
    8. Simplified55.4%

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

    if -1.3e5 < t < 1.1e10

    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. Step-by-step derivation
      1. fabs-sub100.0%

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

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

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

        \[\leadsto \left|\left(-\color{blue}{ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right) + \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
      5. distribute-rgt-neg-in100.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| \]
      6. fma-define100.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. Simplified100.0%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cbrt-cube100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 62.9% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -2.7 \cdot 10^{+188} \lor \neg \left(eh \leq 7.5 \cdot 10^{+196}\right):\\ \;\;\;\;\left|t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-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 -2.7e+188) (not (<= eh 7.5e+196)))
   (fabs (* t (* eh (sin (atan (* (tan t) (/ eh (- ew))))))))
   (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
	double tmp;
	if ((eh <= -2.7e+188) || !(eh <= 7.5e+196)) {
		tmp = fabs((t * (eh * sin(atan((tan(t) * (eh / -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 <= (-2.7d+188)) .or. (.not. (eh <= 7.5d+196))) then
        tmp = abs((t * (eh * sin(atan((tan(t) * (eh / -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 <= -2.7e+188) || !(eh <= 7.5e+196)) {
		tmp = Math.abs((t * (eh * Math.sin(Math.atan((Math.tan(t) * (eh / -ew)))))));
	} else {
		tmp = Math.abs((ew * Math.cos(t)));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if (eh <= -2.7e+188) or not (eh <= 7.5e+196):
		tmp = math.fabs((t * (eh * math.sin(math.atan((math.tan(t) * (eh / -ew)))))))
	else:
		tmp = math.fabs((ew * math.cos(t)))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if ((eh <= -2.7e+188) || !(eh <= 7.5e+196))
		tmp = abs(Float64(t * Float64(eh * sin(atan(Float64(tan(t) * Float64(eh / 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 <= -2.7e+188) || ~((eh <= 7.5e+196)))
		tmp = abs((t * (eh * sin(atan((tan(t) * (eh / -ew)))))));
	else
		tmp = abs((ew * cos(t)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[Or[LessEqual[eh, -2.7e+188], N[Not[LessEqual[eh, 7.5e+196]], $MachinePrecision]], N[Abs[N[(t * N[(eh * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[(eh / (-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 -2.7 \cdot 10^{+188} \lor \neg \left(eh \leq 7.5 \cdot 10^{+196}\right):\\
\;\;\;\;\left|t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{-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 < -2.7e188 or 7.5000000000000005e196 < 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. Step-by-step derivation
      1. fabs-sub99.7%

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

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

        \[\leadsto \left|\color{blue}{\left(-\left(ew \cdot \cos t\right) \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| \]
      4. associate-*l*99.7%

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

        \[\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| \]
      6. fma-define99.7%

        \[\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. Simplified99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.7e188 < eh < 7.5000000000000005e196

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{ew \cdot \cos t} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt38.8%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
      2. sqrt-unprod39.7%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      3. pow239.7%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \cos t\right)}^{2}}} \]
    6. Applied egg-rr39.7%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \cos t\right)}^{2}}} \]
    7. Step-by-step derivation
      1. unpow239.7%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      2. rem-sqrt-square74.1%

        \[\leadsto \color{blue}{\left|ew \cdot \cos t\right|} \]
    8. Simplified74.1%

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

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

Alternative 7: 64.5% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4 \cdot 10^{-272} \lor \neg \left(ew \leq 1.45 \cdot 10^{-149}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -3.99999999999999972e-272 or 1.45e-149 < ew

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Applied egg-rr45.2%

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

      \[\leadsto \color{blue}{ew \cdot \cos t} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt35.7%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
      2. sqrt-unprod38.7%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      3. pow238.7%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \cos t\right)}^{2}}} \]
    6. Applied egg-rr38.7%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \cos t\right)}^{2}}} \]
    7. Step-by-step derivation
      1. unpow238.7%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      2. rem-sqrt-square69.6%

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

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

    if -3.99999999999999972e-272 < ew < 1.45e-149

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Applied egg-rr71.5%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 60.4% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -5 \cdot 10^{+192}:\\ \;\;\;\;ew + eh \cdot \left(t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= eh -5e+192)
   (+ ew (* eh (* t (sin (atan (/ (* eh (tan t)) ew))))))
   (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
	double tmp;
	if (eh <= -5e+192) {
		tmp = ew + (eh * (t * 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 <= (-5d+192)) then
        tmp = ew + (eh * (t * 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 <= -5e+192) {
		tmp = ew + (eh * (t * 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 <= -5e+192:
		tmp = ew + (eh * (t * 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 <= -5e+192)
		tmp = Float64(ew + Float64(eh * Float64(t * sin(atan(Float64(Float64(eh * 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 <= -5e+192)
		tmp = ew + (eh * (t * sin(atan(((eh * tan(t)) / ew)))));
	else
		tmp = abs((ew * cos(t)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[eh, -5e+192], N[(ew + N[(eh * N[(t * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $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 -5 \cdot 10^{+192}:\\
\;\;\;\;ew + eh \cdot \left(t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \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 < -5.00000000000000033e192

    1. Initial program 99.8%

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

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

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

    if -5.00000000000000033e192 < eh

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{ew \cdot \cos t} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt35.3%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
      2. sqrt-unprod35.8%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      3. pow235.8%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \cos t\right)}^{2}}} \]
    6. Applied egg-rr35.8%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \cos t\right)}^{2}}} \]
    7. Step-by-step derivation
      1. unpow235.8%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      2. rem-sqrt-square67.9%

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

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

Alternative 9: 60.3% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -1 \cdot 10^{+243}:\\ \;\;\;\;\left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= eh -1e+243)
   (* (* eh t) (sin (atan (* eh (/ (tan t) ew)))))
   (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
	double tmp;
	if (eh <= -1e+243) {
		tmp = (eh * t) * 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 <= (-1d+243)) then
        tmp = (eh * t) * 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 <= -1e+243) {
		tmp = (eh * t) * 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 <= -1e+243:
		tmp = (eh * t) * 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 <= -1e+243)
		tmp = Float64(Float64(eh * t) * 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 <= -1e+243)
		tmp = (eh * t) * sin(atan((eh * (tan(t) / ew))));
	else
		tmp = abs((ew * cos(t)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[eh, -1e+243], N[(N[(eh * t), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[(N[Tan[t], $MachinePrecision] / ew), $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 -1 \cdot 10^{+243}:\\
\;\;\;\;\left(eh \cdot t\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{ew}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -1.0000000000000001e243

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Applied egg-rr42.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.0000000000000001e243 < eh

    1. Initial program 99.8%

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

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

      \[\leadsto \color{blue}{ew \cdot \cos t} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt35.0%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
      2. sqrt-unprod34.8%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      3. pow234.8%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \cos t\right)}^{2}}} \]
    6. Applied egg-rr34.8%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \cos t\right)}^{2}}} \]
    7. Step-by-step derivation
      1. unpow234.8%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
      2. rem-sqrt-square65.8%

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

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

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

Alternative 10: 60.2% 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. Applied egg-rr49.6%

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

    \[\leadsto \color{blue}{ew \cdot \cos t} \]
  5. Step-by-step derivation
    1. add-sqr-sqrt33.2%

      \[\leadsto \color{blue}{\sqrt{ew \cdot \cos t} \cdot \sqrt{ew \cdot \cos t}} \]
    2. sqrt-unprod33.1%

      \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
    3. pow233.1%

      \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \cos t\right)}^{2}}} \]
  6. Applied egg-rr33.1%

    \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \cos t\right)}^{2}}} \]
  7. Step-by-step derivation
    1. unpow233.1%

      \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \cos t\right) \cdot \left(ew \cdot \cos t\right)}} \]
    2. rem-sqrt-square62.4%

      \[\leadsto \color{blue}{\left|ew \cdot \cos t\right|} \]
  8. Simplified62.4%

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

Alternative 11: 31.4% accurate, 8.9× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Applied egg-rr49.6%

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

    \[\leadsto \color{blue}{ew \cdot \cos t} \]
  5. Add Preprocessing

Alternative 12: 21.6% 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. Applied egg-rr49.6%

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

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

Reproduce

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