Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 23.2s
Alternatives: 12
Speedup: N/A×

Specification

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

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

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

Alternative 1: 99.8% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

Alternative 2: 99.0% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 3: 85.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ t_2 := ew \cdot \sin t\\ \mathbf{if}\;ew \leq -8.5 \cdot 10^{-43} \lor \neg \left(ew \leq 1.65 \cdot 10^{-85}\right):\\ \;\;\;\;\left|t\_2 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot t\_1\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_1 + t\_2 \cdot \frac{ew \cdot t}{eh}\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (sin (atan (/ (/ eh ew) (tan t))))) (t_2 (* ew (sin t))))
   (if (or (<= ew -8.5e-43) (not (<= ew 1.65e-85)))
     (fabs (+ (* t_2 (/ 1.0 (hypot 1.0 (/ (/ eh t) ew)))) (* eh t_1)))
     (fabs (+ (* (* eh (cos t)) t_1) (* t_2 (/ (* ew t) eh)))))))
double code(double eh, double ew, double t) {
	double t_1 = sin(atan(((eh / ew) / tan(t))));
	double t_2 = ew * sin(t);
	double tmp;
	if ((ew <= -8.5e-43) || !(ew <= 1.65e-85)) {
		tmp = fabs(((t_2 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * t_1)));
	} else {
		tmp = fabs((((eh * cos(t)) * t_1) + (t_2 * ((ew * t) / eh))));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double t_1 = Math.sin(Math.atan(((eh / ew) / Math.tan(t))));
	double t_2 = ew * Math.sin(t);
	double tmp;
	if ((ew <= -8.5e-43) || !(ew <= 1.65e-85)) {
		tmp = Math.abs(((t_2 * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + (eh * t_1)));
	} else {
		tmp = Math.abs((((eh * Math.cos(t)) * t_1) + (t_2 * ((ew * t) / eh))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.sin(math.atan(((eh / ew) / math.tan(t))))
	t_2 = ew * math.sin(t)
	tmp = 0
	if (ew <= -8.5e-43) or not (ew <= 1.65e-85):
		tmp = math.fabs(((t_2 * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + (eh * t_1)))
	else:
		tmp = math.fabs((((eh * math.cos(t)) * t_1) + (t_2 * ((ew * t) / eh))))
	return tmp
function code(eh, ew, t)
	t_1 = sin(atan(Float64(Float64(eh / ew) / tan(t))))
	t_2 = Float64(ew * sin(t))
	tmp = 0.0
	if ((ew <= -8.5e-43) || !(ew <= 1.65e-85))
		tmp = abs(Float64(Float64(t_2 * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(eh * t_1)));
	else
		tmp = abs(Float64(Float64(Float64(eh * cos(t)) * t_1) + Float64(t_2 * Float64(Float64(ew * t) / eh))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = sin(atan(((eh / ew) / tan(t))));
	t_2 = ew * sin(t);
	tmp = 0.0;
	if ((ew <= -8.5e-43) || ~((ew <= 1.65e-85)))
		tmp = abs(((t_2 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * t_1)));
	else
		tmp = abs((((eh * cos(t)) * t_1) + (t_2 * ((ew * t) / eh))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -8.5e-43], N[Not[LessEqual[ew, 1.65e-85]], $MachinePrecision]], N[Abs[N[(N[(t$95$2 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(t$95$2 * N[(N[(ew * t), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
t_2 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq -8.5 \cdot 10^{-43} \lor \neg \left(ew \leq 1.65 \cdot 10^{-85}\right):\\
\;\;\;\;\left|t\_2 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot t\_1\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_1 + t\_2 \cdot \frac{ew \cdot t}{eh}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -8.50000000000000056e-43 or 1.64999999999999986e-85 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

    if -8.50000000000000056e-43 < ew < 1.64999999999999986e-85

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

Alternative 4: 83.9% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := ew \cdot \sin t\\ \mathbf{if}\;ew \leq -3.2 \cdot 10^{-43} \lor \neg \left(ew \leq 7.2 \cdot 10^{-86}\right):\\ \;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t\_1 \cdot \left(ew \cdot \frac{t}{eh}\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* ew (sin t))))
   (if (or (<= ew -3.2e-43) (not (<= ew 7.2e-86)))
     (fabs
      (+
       (* t_1 (/ 1.0 (hypot 1.0 (/ (/ eh t) ew))))
       (* eh (sin (atan (/ eh (* ew t)))))))
     (fabs
      (+
       (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t)))))
       (* t_1 (* ew (/ t eh))))))))
double code(double eh, double ew, double t) {
	double t_1 = ew * sin(t);
	double tmp;
	if ((ew <= -3.2e-43) || !(ew <= 7.2e-86)) {
		tmp = fabs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * sin(atan((eh / (ew * t)))))));
	} else {
		tmp = fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (t_1 * (ew * (t / eh)))));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double t_1 = ew * Math.sin(t);
	double tmp;
	if ((ew <= -3.2e-43) || !(ew <= 7.2e-86)) {
		tmp = Math.abs(((t_1 * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + (eh * Math.sin(Math.atan((eh / (ew * t)))))));
	} else {
		tmp = Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (t_1 * (ew * (t / eh)))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = ew * math.sin(t)
	tmp = 0
	if (ew <= -3.2e-43) or not (ew <= 7.2e-86):
		tmp = math.fabs(((t_1 * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + (eh * math.sin(math.atan((eh / (ew * t)))))))
	else:
		tmp = math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (t_1 * (ew * (t / eh)))))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(ew * sin(t))
	tmp = 0.0
	if ((ew <= -3.2e-43) || !(ew <= 7.2e-86))
		tmp = abs(Float64(Float64(t_1 * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(eh * sin(atan(Float64(eh / Float64(ew * t)))))));
	else
		tmp = abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(t_1 * Float64(ew * Float64(t / eh)))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = ew * sin(t);
	tmp = 0.0;
	if ((ew <= -3.2e-43) || ~((ew <= 7.2e-86)))
		tmp = abs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * sin(atan((eh / (ew * t)))))));
	else
		tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (t_1 * (ew * (t / eh)))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -3.2e-43], N[Not[LessEqual[ew, 7.2e-86]], $MachinePrecision]], N[Abs[N[(N[(t$95$1 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(ew * N[(t / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq -3.2 \cdot 10^{-43} \lor \neg \left(ew \leq 7.2 \cdot 10^{-86}\right):\\
\;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -3.19999999999999985e-43 or 7.19999999999999932e-86 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -3.19999999999999985e-43 < ew < 7.19999999999999932e-86

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 84.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := ew \cdot \sin t\\ \mathbf{if}\;ew \leq -1.4 \cdot 10^{-43} \lor \neg \left(ew \leq 1.65 \cdot 10^{-87}\right):\\ \;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + t\_1 \cdot \frac{ew \cdot t}{eh}\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* ew (sin t))))
   (if (or (<= ew -1.4e-43) (not (<= ew 1.65e-87)))
     (fabs
      (+
       (* t_1 (/ 1.0 (hypot 1.0 (/ (/ eh t) ew))))
       (* eh (sin (atan (/ eh (* ew t)))))))
     (fabs
      (+
       (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t)))))
       (* t_1 (/ (* ew t) eh)))))))
double code(double eh, double ew, double t) {
	double t_1 = ew * sin(t);
	double tmp;
	if ((ew <= -1.4e-43) || !(ew <= 1.65e-87)) {
		tmp = fabs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * sin(atan((eh / (ew * t)))))));
	} else {
		tmp = fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (t_1 * ((ew * t) / eh))));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double t_1 = ew * Math.sin(t);
	double tmp;
	if ((ew <= -1.4e-43) || !(ew <= 1.65e-87)) {
		tmp = Math.abs(((t_1 * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + (eh * Math.sin(Math.atan((eh / (ew * t)))))));
	} else {
		tmp = Math.abs((((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / Math.tan(t))))) + (t_1 * ((ew * t) / eh))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = ew * math.sin(t)
	tmp = 0
	if (ew <= -1.4e-43) or not (ew <= 1.65e-87):
		tmp = math.fabs(((t_1 * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + (eh * math.sin(math.atan((eh / (ew * t)))))))
	else:
		tmp = math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (t_1 * ((ew * t) / eh))))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(ew * sin(t))
	tmp = 0.0
	if ((ew <= -1.4e-43) || !(ew <= 1.65e-87))
		tmp = abs(Float64(Float64(t_1 * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(eh * sin(atan(Float64(eh / Float64(ew * t)))))));
	else
		tmp = abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(t_1 * Float64(Float64(ew * t) / eh))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = ew * sin(t);
	tmp = 0.0;
	if ((ew <= -1.4e-43) || ~((ew <= 1.65e-87)))
		tmp = abs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * sin(atan((eh / (ew * t)))))));
	else
		tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (t_1 * ((ew * t) / eh))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -1.4e-43], N[Not[LessEqual[ew, 1.65e-87]], $MachinePrecision]], N[Abs[N[(N[(t$95$1 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(N[(ew * t), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq -1.4 \cdot 10^{-43} \lor \neg \left(ew \leq 1.65 \cdot 10^{-87}\right):\\
\;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.3999999999999999e-43 or 1.65e-87 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999e-43 < ew < 1.65e-87

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

Alternative 6: 89.5% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 81.7% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := ew \cdot \sin t\\ t_2 := \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\ t_3 := \left(eh \cdot \cos t\right) \cdot t\_2\\ \mathbf{if}\;eh \leq -2.4 \cdot 10^{+237}:\\ \;\;\;\;\left|t\_3 + t\_1 \cdot \frac{ew \cdot t}{eh}\right|\\ \mathbf{elif}\;eh \leq 5 \cdot 10^{+119}:\\ \;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot t\_2\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t\_3 + t\_1 \cdot \left(ew \cdot \frac{t}{eh}\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* ew (sin t)))
        (t_2 (sin (atan (/ eh (* ew t)))))
        (t_3 (* (* eh (cos t)) t_2)))
   (if (<= eh -2.4e+237)
     (fabs (+ t_3 (* t_1 (/ (* ew t) eh))))
     (if (<= eh 5e+119)
       (fabs (+ (* t_1 (/ 1.0 (hypot 1.0 (/ (/ eh t) ew)))) (* eh t_2)))
       (fabs (+ t_3 (* t_1 (* ew (/ t eh)))))))))
double code(double eh, double ew, double t) {
	double t_1 = ew * sin(t);
	double t_2 = sin(atan((eh / (ew * t))));
	double t_3 = (eh * cos(t)) * t_2;
	double tmp;
	if (eh <= -2.4e+237) {
		tmp = fabs((t_3 + (t_1 * ((ew * t) / eh))));
	} else if (eh <= 5e+119) {
		tmp = fabs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * t_2)));
	} else {
		tmp = fabs((t_3 + (t_1 * (ew * (t / eh)))));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double t_1 = ew * Math.sin(t);
	double t_2 = Math.sin(Math.atan((eh / (ew * t))));
	double t_3 = (eh * Math.cos(t)) * t_2;
	double tmp;
	if (eh <= -2.4e+237) {
		tmp = Math.abs((t_3 + (t_1 * ((ew * t) / eh))));
	} else if (eh <= 5e+119) {
		tmp = Math.abs(((t_1 * (1.0 / Math.hypot(1.0, ((eh / t) / ew)))) + (eh * t_2)));
	} else {
		tmp = Math.abs((t_3 + (t_1 * (ew * (t / eh)))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = ew * math.sin(t)
	t_2 = math.sin(math.atan((eh / (ew * t))))
	t_3 = (eh * math.cos(t)) * t_2
	tmp = 0
	if eh <= -2.4e+237:
		tmp = math.fabs((t_3 + (t_1 * ((ew * t) / eh))))
	elif eh <= 5e+119:
		tmp = math.fabs(((t_1 * (1.0 / math.hypot(1.0, ((eh / t) / ew)))) + (eh * t_2)))
	else:
		tmp = math.fabs((t_3 + (t_1 * (ew * (t / eh)))))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(ew * sin(t))
	t_2 = sin(atan(Float64(eh / Float64(ew * t))))
	t_3 = Float64(Float64(eh * cos(t)) * t_2)
	tmp = 0.0
	if (eh <= -2.4e+237)
		tmp = abs(Float64(t_3 + Float64(t_1 * Float64(Float64(ew * t) / eh))));
	elseif (eh <= 5e+119)
		tmp = abs(Float64(Float64(t_1 * Float64(1.0 / hypot(1.0, Float64(Float64(eh / t) / ew)))) + Float64(eh * t_2)));
	else
		tmp = abs(Float64(t_3 + Float64(t_1 * Float64(ew * Float64(t / eh)))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = ew * sin(t);
	t_2 = sin(atan((eh / (ew * t))));
	t_3 = (eh * cos(t)) * t_2;
	tmp = 0.0;
	if (eh <= -2.4e+237)
		tmp = abs((t_3 + (t_1 * ((ew * t) / eh))));
	elseif (eh <= 5e+119)
		tmp = abs(((t_1 * (1.0 / hypot(1.0, ((eh / t) / ew)))) + (eh * t_2)));
	else
		tmp = abs((t_3 + (t_1 * (ew * (t / eh)))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[eh, -2.4e+237], N[Abs[N[(t$95$3 + N[(t$95$1 * N[(N[(ew * t), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[eh, 5e+119], N[Abs[N[(N[(t$95$1 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(eh / t), $MachinePrecision] / ew), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(t$95$3 + N[(t$95$1 * N[(ew * N[(t / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
t_2 := \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
t_3 := \left(eh \cdot \cos t\right) \cdot t\_2\\
\mathbf{if}\;eh \leq -2.4 \cdot 10^{+237}:\\
\;\;\;\;\left|t\_3 + t\_1 \cdot \frac{ew \cdot t}{eh}\right|\\

\mathbf{elif}\;eh \leq 5 \cdot 10^{+119}:\\
\;\;\;\;\left|t\_1 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{\frac{eh}{t}}{ew}\right)} + eh \cdot t\_2\right|\\

\mathbf{else}:\\
\;\;\;\;\left|t\_3 + t\_1 \cdot \left(ew \cdot \frac{t}{eh}\right)\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if eh < -2.3999999999999999e237

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

    if -2.3999999999999999e237 < eh < 4.9999999999999999e119

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999999e119 < eh

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 65.0% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\ t_2 := \sin t\_1\\ \mathbf{if}\;t \leq -70 \lor \neg \left(t \leq 31000\right):\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_2 + \left(ew \cdot \sin t\right) \cdot \left(ew \cdot \frac{t}{eh}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \left(t \cdot \cos t\_1\right) + eh \cdot t\_2\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ eh (* ew t)))) (t_2 (sin t_1)))
   (if (or (<= t -70.0) (not (<= t 31000.0)))
     (fabs (+ (* (* eh (cos t)) t_2) (* (* ew (sin t)) (* ew (/ t eh)))))
     (fabs (+ (* ew (* t (cos t_1))) (* eh t_2))))))
double code(double eh, double ew, double t) {
	double t_1 = atan((eh / (ew * t)));
	double t_2 = sin(t_1);
	double tmp;
	if ((t <= -70.0) || !(t <= 31000.0)) {
		tmp = fabs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * (ew * (t / eh)))));
	} else {
		tmp = fabs(((ew * (t * cos(t_1))) + (eh * t_2)));
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = atan((eh / (ew * t)))
    t_2 = sin(t_1)
    if ((t <= (-70.0d0)) .or. (.not. (t <= 31000.0d0))) then
        tmp = abs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * (ew * (t / eh)))))
    else
        tmp = abs(((ew * (t * cos(t_1))) + (eh * t_2)))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan((eh / (ew * t)));
	double t_2 = Math.sin(t_1);
	double tmp;
	if ((t <= -70.0) || !(t <= 31000.0)) {
		tmp = Math.abs((((eh * Math.cos(t)) * t_2) + ((ew * Math.sin(t)) * (ew * (t / eh)))));
	} else {
		tmp = Math.abs(((ew * (t * Math.cos(t_1))) + (eh * t_2)));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.atan((eh / (ew * t)))
	t_2 = math.sin(t_1)
	tmp = 0
	if (t <= -70.0) or not (t <= 31000.0):
		tmp = math.fabs((((eh * math.cos(t)) * t_2) + ((ew * math.sin(t)) * (ew * (t / eh)))))
	else:
		tmp = math.fabs(((ew * (t * math.cos(t_1))) + (eh * t_2)))
	return tmp
function code(eh, ew, t)
	t_1 = atan(Float64(eh / Float64(ew * t)))
	t_2 = sin(t_1)
	tmp = 0.0
	if ((t <= -70.0) || !(t <= 31000.0))
		tmp = abs(Float64(Float64(Float64(eh * cos(t)) * t_2) + Float64(Float64(ew * sin(t)) * Float64(ew * Float64(t / eh)))));
	else
		tmp = abs(Float64(Float64(ew * Float64(t * cos(t_1))) + Float64(eh * t_2)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = atan((eh / (ew * t)));
	t_2 = sin(t_1);
	tmp = 0.0;
	if ((t <= -70.0) || ~((t <= 31000.0)))
		tmp = abs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * (ew * (t / eh)))));
	else
		tmp = abs(((ew * (t * cos(t_1))) + (eh * t_2)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$1], $MachinePrecision]}, If[Or[LessEqual[t, -70.0], N[Not[LessEqual[t, 31000.0]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(ew * N[(t / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[(t * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
t_2 := \sin t\_1\\
\mathbf{if}\;t \leq -70 \lor \neg \left(t \leq 31000\right):\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_2 + \left(ew \cdot \sin t\right) \cdot \left(ew \cdot \frac{t}{eh}\right)\right|\\

\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \cos t\_1\right) + eh \cdot t\_2\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -70 or 31000 < t

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

    if -70 < t < 31000

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 9: 65.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\ t_2 := \sin t\_1\\ \mathbf{if}\;t \leq -70 \lor \neg \left(t \leq 31000\right):\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_2 + \left(ew \cdot \sin t\right) \cdot \frac{ew \cdot t}{eh}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \left(t \cdot \cos t\_1\right) + eh \cdot t\_2\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ eh (* ew t)))) (t_2 (sin t_1)))
   (if (or (<= t -70.0) (not (<= t 31000.0)))
     (fabs (+ (* (* eh (cos t)) t_2) (* (* ew (sin t)) (/ (* ew t) eh))))
     (fabs (+ (* ew (* t (cos t_1))) (* eh t_2))))))
double code(double eh, double ew, double t) {
	double t_1 = atan((eh / (ew * t)));
	double t_2 = sin(t_1);
	double tmp;
	if ((t <= -70.0) || !(t <= 31000.0)) {
		tmp = fabs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * ((ew * t) / eh))));
	} else {
		tmp = fabs(((ew * (t * cos(t_1))) + (eh * t_2)));
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = atan((eh / (ew * t)))
    t_2 = sin(t_1)
    if ((t <= (-70.0d0)) .or. (.not. (t <= 31000.0d0))) then
        tmp = abs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * ((ew * t) / eh))))
    else
        tmp = abs(((ew * (t * cos(t_1))) + (eh * t_2)))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan((eh / (ew * t)));
	double t_2 = Math.sin(t_1);
	double tmp;
	if ((t <= -70.0) || !(t <= 31000.0)) {
		tmp = Math.abs((((eh * Math.cos(t)) * t_2) + ((ew * Math.sin(t)) * ((ew * t) / eh))));
	} else {
		tmp = Math.abs(((ew * (t * Math.cos(t_1))) + (eh * t_2)));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.atan((eh / (ew * t)))
	t_2 = math.sin(t_1)
	tmp = 0
	if (t <= -70.0) or not (t <= 31000.0):
		tmp = math.fabs((((eh * math.cos(t)) * t_2) + ((ew * math.sin(t)) * ((ew * t) / eh))))
	else:
		tmp = math.fabs(((ew * (t * math.cos(t_1))) + (eh * t_2)))
	return tmp
function code(eh, ew, t)
	t_1 = atan(Float64(eh / Float64(ew * t)))
	t_2 = sin(t_1)
	tmp = 0.0
	if ((t <= -70.0) || !(t <= 31000.0))
		tmp = abs(Float64(Float64(Float64(eh * cos(t)) * t_2) + Float64(Float64(ew * sin(t)) * Float64(Float64(ew * t) / eh))));
	else
		tmp = abs(Float64(Float64(ew * Float64(t * cos(t_1))) + Float64(eh * t_2)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = atan((eh / (ew * t)));
	t_2 = sin(t_1);
	tmp = 0.0;
	if ((t <= -70.0) || ~((t <= 31000.0)))
		tmp = abs((((eh * cos(t)) * t_2) + ((ew * sin(t)) * ((ew * t) / eh))));
	else
		tmp = abs(((ew * (t * cos(t_1))) + (eh * t_2)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$1], $MachinePrecision]}, If[Or[LessEqual[t, -70.0], N[Not[LessEqual[t, 31000.0]], $MachinePrecision]], N[Abs[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(N[(ew * t), $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(ew * N[(t * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
t_2 := \sin t\_1\\
\mathbf{if}\;t \leq -70 \lor \neg \left(t \leq 31000\right):\\
\;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot t\_2 + \left(ew \cdot \sin t\right) \cdot \frac{ew \cdot t}{eh}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|ew \cdot \left(t \cdot \cos t\_1\right) + eh \cdot t\_2\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -70 or 31000 < t

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

    if -70 < t < 31000

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 10: 54.4% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\left(ew \cdot t\right) \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{\tan t}}{ew}\right)}} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]
    5. un-div-inv57.2%

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

      \[\leadsto \left|\frac{\color{blue}{t \cdot ew}}{\mathsf{hypot}\left(1, \frac{\frac{eh}{\tan t}}{ew}\right)} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]
    7. associate-/l/57.2%

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

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

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

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

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

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

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

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

Alternative 11: 54.4% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\left(ew \cdot t\right) \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{\tan t}}{ew}\right)}} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]
    5. un-div-inv57.2%

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

      \[\leadsto \left|\frac{\color{blue}{t \cdot ew}}{\mathsf{hypot}\left(1, \frac{\frac{eh}{\tan t}}{ew}\right)} + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right| \]
    7. associate-/l/57.2%

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

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

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

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

Alternative 12: 54.3% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

Reproduce

?
herbie shell --seed 2024077 
(FPCore (eh ew t)
  :name "Example from Robby"
  :precision binary64
  (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))