Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 16.5s
Alternatives: 6
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan t \cdot \frac{eh}{ew}\\ \left|ew \cdot \frac{\cos t}{\mathsf{hypot}\left(1, t\_1\right)} + eh \cdot \left(\sin t \cdot \sin \tan^{-1} t\_1\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* (tan t) (/ eh ew))))
   (fabs
    (+
     (* 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(((ew * (cos(t) / hypot(1.0, t_1))) + (eh * (sin(t) * sin(atan(t_1))))));
}
public static double code(double eh, double ew, double t) {
	double t_1 = Math.tan(t) * (eh / ew);
	return Math.abs(((ew * (Math.cos(t) / Math.hypot(1.0, t_1))) + (eh * (Math.sin(t) * Math.sin(Math.atan(t_1))))));
}
def code(eh, ew, t):
	t_1 = math.tan(t) * (eh / ew)
	return math.fabs(((ew * (math.cos(t) / math.hypot(1.0, t_1))) + (eh * (math.sin(t) * math.sin(math.atan(t_1))))))
function code(eh, ew, t)
	t_1 = Float64(tan(t) * Float64(eh / ew))
	return abs(Float64(Float64(ew * Float64(cos(t) / hypot(1.0, t_1))) + Float64(eh * Float64(sin(t) * sin(atan(t_1))))))
end
function tmp = code(eh, ew, t)
	t_1 = tan(t) * (eh / ew);
	tmp = abs(((ew * (cos(t) / hypot(1.0, t_1))) + (eh * (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[(N[(ew * N[(N[Cos[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $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|ew \cdot \frac{\cos t}{\mathsf{hypot}\left(1, t\_1\right)} + eh \cdot \left(\sin t \cdot \sin \tan^{-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| \]
  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. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

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

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

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

      \[\leadsto \left|\frac{\cos t}{\mathsf{hypot}\left(1, \frac{\color{blue}{\tan t \cdot eh}}{ew}\right)} \cdot ew + eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)\right| \]
    8. associate-*r/99.8%

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

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

    \[\leadsto \left|ew \cdot \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| \]
  8. Add Preprocessing

Alternative 2: 98.5% accurate, 1.5× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. 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| \]
  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. Taylor expanded in ew around inf 98.3%

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

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

Alternative 3: 74.3% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+68}:\\
\;\;\;\;\left|\cos t \cdot ew\right|\\

\mathbf{elif}\;t \leq -3.75 \cdot 10^{-6} \lor \neg \left(t \leq 4.4 \cdot 10^{-18}\right):\\
\;\;\;\;\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{t \cdot eh}{ew}\right)\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -9.50000000000000069e68

    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. add-cbrt-cube29.7%

        \[\leadsto \left|\color{blue}{\sqrt[3]{\left(\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) \cdot \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)\right) \cdot \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)}}\right| \]
      2. pow329.8%

        \[\leadsto \left|\sqrt[3]{\color{blue}{{\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)}^{3}}}\right| \]
    4. Applied egg-rr29.8%

      \[\leadsto \left|\color{blue}{\sqrt[3]{{\left(\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)}^{3}}}\right| \]
    5. Taylor expanded in ew around inf 20.7%

      \[\leadsto \left|\sqrt[3]{\color{blue}{{ew}^{3} \cdot {\cos t}^{3}}}\right| \]
    6. Step-by-step derivation
      1. pow-prod-down20.8%

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

        \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
      3. *-commutative67.6%

        \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
    7. Applied egg-rr67.6%

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

    if -9.50000000000000069e68 < t < -3.7500000000000001e-6 or 4.3999999999999997e-18 < 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. add-cbrt-cube39.5%

        \[\leadsto \left|\color{blue}{\sqrt[3]{\left(\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) \cdot \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)\right) \cdot \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)}}\right| \]
      2. pow339.5%

        \[\leadsto \left|\sqrt[3]{\color{blue}{{\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)}^{3}}}\right| \]
    4. Applied egg-rr39.5%

      \[\leadsto \left|\color{blue}{\sqrt[3]{{\left(\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)}^{3}}}\right| \]
    5. Taylor expanded in ew around 0 64.0%

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

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

    if -3.7500000000000001e-6 < t < 4.3999999999999997e-18

    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. add-cbrt-cube39.8%

        \[\leadsto \left|\color{blue}{\sqrt[3]{\left(\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) \cdot \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)\right) \cdot \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)}}\right| \]
      2. pow339.9%

        \[\leadsto \left|\sqrt[3]{\color{blue}{{\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)}^{3}}}\right| \]
    4. Applied egg-rr39.9%

      \[\leadsto \left|\color{blue}{\sqrt[3]{{\left(\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)}^{3}}}\right| \]
    5. Taylor expanded in t around 0 99.1%

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

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

Alternative 4: 74.5% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -3.6 \cdot 10^{-53} \lor \neg \left(ew \leq 3.1 \cdot 10^{-103}\right):\\
\;\;\;\;\left|\cos t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -3.5999999999999999e-53 or 3.1000000000000001e-103 < 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. add-cbrt-cube38.3%

        \[\leadsto \left|\color{blue}{\sqrt[3]{\left(\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) \cdot \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)\right) \cdot \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)}}\right| \]
      2. pow338.3%

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

      \[\leadsto \left|\color{blue}{\sqrt[3]{{\left(\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)}^{3}}}\right| \]
    5. Taylor expanded in ew around inf 31.8%

      \[\leadsto \left|\sqrt[3]{\color{blue}{{ew}^{3} \cdot {\cos t}^{3}}}\right| \]
    6. Step-by-step derivation
      1. pow-prod-down31.8%

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

        \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
      3. *-commutative80.6%

        \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
    7. Applied egg-rr80.6%

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

    if -3.5999999999999999e-53 < ew < 3.1000000000000001e-103

    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-cbrt-cube37.6%

        \[\leadsto \left|\color{blue}{\sqrt[3]{\left(\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) \cdot \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)\right) \cdot \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)}}\right| \]
      2. pow337.6%

        \[\leadsto \left|\sqrt[3]{\color{blue}{{\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)}^{3}}}\right| \]
    4. Applied egg-rr37.6%

      \[\leadsto \left|\color{blue}{\sqrt[3]{{\left(\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)}^{3}}}\right| \]
    5. Taylor expanded in ew around 0 73.4%

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

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

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

Alternative 5: 61.8% accurate, 4.5× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube38.0%

      \[\leadsto \left|\color{blue}{\sqrt[3]{\left(\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) \cdot \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)\right) \cdot \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)}}\right| \]
    2. pow338.0%

      \[\leadsto \left|\sqrt[3]{\color{blue}{{\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)}^{3}}}\right| \]
  4. Applied egg-rr38.0%

    \[\leadsto \left|\color{blue}{\sqrt[3]{{\left(\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)}^{3}}}\right| \]
  5. Taylor expanded in ew around inf 22.1%

    \[\leadsto \left|\sqrt[3]{\color{blue}{{ew}^{3} \cdot {\cos t}^{3}}}\right| \]
  6. Step-by-step derivation
    1. pow-prod-down22.1%

      \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \cos t\right)}^{3}}}\right| \]
    2. rem-cbrt-cube60.8%

      \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
    3. *-commutative60.8%

      \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
  7. Applied egg-rr60.8%

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

Alternative 6: 42.4% 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. add-cbrt-cube38.0%

      \[\leadsto \left|\color{blue}{\sqrt[3]{\left(\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) \cdot \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)\right) \cdot \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)}}\right| \]
    2. pow338.0%

      \[\leadsto \left|\sqrt[3]{\color{blue}{{\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)}^{3}}}\right| \]
  4. Applied egg-rr38.0%

    \[\leadsto \left|\color{blue}{\sqrt[3]{{\left(\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)}^{3}}}\right| \]
  5. Taylor expanded in t around 0 17.5%

    \[\leadsto \left|\sqrt[3]{\color{blue}{{ew}^{3}}}\right| \]
  6. Taylor expanded in ew around 0 43.7%

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

Reproduce

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