Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 18.9s
Alternatives: 8
Speedup: 1.0×

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 8 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.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 94.2% accurate, 0.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(ew \cdot \tan t\right)}^{-2}, 1\right)}}, ew, t\_1\right)\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fabs.f64 (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))))) < 1e-165

    1. Initial program 99.7%

      \[\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. Applied egg-rr0.0%

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \left(\sin t + \frac{eh \cdot \cos t}{ew}\right)}\right| \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \left(\sin t + \frac{eh \cdot \cos t}{ew}\right)}\right| \]
      2. +-commutativeN/A

        \[\leadsto \left|ew \cdot \color{blue}{\left(\frac{eh \cdot \cos t}{ew} + \sin t\right)}\right| \]
      3. associate-/l*N/A

        \[\leadsto \left|ew \cdot \left(\color{blue}{eh \cdot \frac{\cos t}{ew}} + \sin t\right)\right| \]
      4. lower-fma.f64N/A

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

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

        \[\leadsto \left|ew \cdot \mathsf{fma}\left(eh, \frac{\color{blue}{\cos t}}{ew}, \sin t\right)\right| \]
      7. lower-sin.f6493.6

        \[\leadsto \left|ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \color{blue}{\sin t}\right)\right| \]
    9. Simplified93.6%

      \[\leadsto \left|\color{blue}{ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \sin t\right)}\right| \]

    if 1e-165 < (fabs.f64 (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))))

    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. Applied egg-rr47.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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 \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \leq 10^{-165}:\\ \;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \sin t\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(ew \cdot \tan t\right)}^{-2}, 1\right)}}, ew, eh \cdot \cos t\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot 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)) (cos (atan (/ eh (* t ew)))))
   (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
	return fabs((((ew * sin(t)) * cos(atan((eh / (t * ew))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs((((ew * sin(t)) * cos(atan((eh / (t * ew))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (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)) * math.cos(math.atan((eh / (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)) * cos(atan(Float64(eh / Float64(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)) * cos(atan((eh / (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[Cos[N[ArcTan[N[(eh / N[(t * ew), $MachinePrecision]), $MachinePrecision]], $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 \cos \tan^{-1} \left(\frac{eh}{t \cdot 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. Taylor expanded in t around 0

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

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

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

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

    \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \color{blue}{\left(\frac{eh}{t \cdot 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 4: 93.7% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|eh \cdot \cos t\right|\\ \mathbf{if}\;eh \leq -3.5 \cdot 10^{+98}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 7 \cdot 10^{+110}:\\ \;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \sin t\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* eh (cos t)))))
   (if (<= eh -3.5e+98)
     t_1
     (if (<= eh 7e+110) (fabs (* ew (fma eh (/ (cos t) ew) (sin t)))) t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((eh * cos(t)));
	double tmp;
	if (eh <= -3.5e+98) {
		tmp = t_1;
	} else if (eh <= 7e+110) {
		tmp = fabs((ew * fma(eh, (cos(t) / ew), sin(t))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = abs(Float64(eh * cos(t)))
	tmp = 0.0
	if (eh <= -3.5e+98)
		tmp = t_1;
	elseif (eh <= 7e+110)
		tmp = abs(Float64(ew * fma(eh, Float64(cos(t) / ew), sin(t))));
	else
		tmp = t_1;
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -3.5e+98], t$95$1, If[LessEqual[eh, 7e+110], N[Abs[N[(ew * N[(eh * N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] + N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|eh \cdot \cos t\right|\\
\mathbf{if}\;eh \leq -3.5 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 7 \cdot 10^{+110}:\\
\;\;\;\;\left|ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \sin t\right)\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -3.5e98 or 6.9999999999999998e110 < 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. Applied egg-rr4.5%

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

      \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
      2. lower-cos.f6494.6

        \[\leadsto \left|eh \cdot \color{blue}{\cos t}\right| \]
    6. Simplified94.6%

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

    if -3.5e98 < eh < 6.9999999999999998e110

    1. Initial program 99.7%

      \[\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. Applied egg-rr62.8%

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \left(\sin t + \frac{eh \cdot \cos t}{ew}\right)}\right| \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \left(\sin t + \frac{eh \cdot \cos t}{ew}\right)}\right| \]
      2. +-commutativeN/A

        \[\leadsto \left|ew \cdot \color{blue}{\left(\frac{eh \cdot \cos t}{ew} + \sin t\right)}\right| \]
      3. associate-/l*N/A

        \[\leadsto \left|ew \cdot \left(\color{blue}{eh \cdot \frac{\cos t}{ew}} + \sin t\right)\right| \]
      4. lower-fma.f64N/A

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

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

        \[\leadsto \left|ew \cdot \mathsf{fma}\left(eh, \frac{\color{blue}{\cos t}}{ew}, \sin t\right)\right| \]
      7. lower-sin.f6496.4

        \[\leadsto \left|ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \color{blue}{\sin t}\right)\right| \]
    9. Simplified96.4%

      \[\leadsto \left|\color{blue}{ew \cdot \mathsf{fma}\left(eh, \frac{\cos t}{ew}, \sin t\right)}\right| \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 74.2% accurate, 7.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|eh \cdot \cos t\right|\\ \mathbf{if}\;eh \leq -8.5 \cdot 10^{-35}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 2.35 \cdot 10^{-71}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* eh (cos t)))))
   (if (<= eh -8.5e-35) t_1 (if (<= eh 2.35e-71) (fabs (* ew (sin t))) t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((eh * cos(t)));
	double tmp;
	if (eh <= -8.5e-35) {
		tmp = t_1;
	} else if (eh <= 2.35e-71) {
		tmp = fabs((ew * sin(t)));
	} else {
		tmp = t_1;
	}
	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) :: tmp
    t_1 = abs((eh * cos(t)))
    if (eh <= (-8.5d-35)) then
        tmp = t_1
    else if (eh <= 2.35d-71) then
        tmp = abs((ew * sin(t)))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((eh * Math.cos(t)));
	double tmp;
	if (eh <= -8.5e-35) {
		tmp = t_1;
	} else if (eh <= 2.35e-71) {
		tmp = Math.abs((ew * Math.sin(t)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((eh * math.cos(t)))
	tmp = 0
	if eh <= -8.5e-35:
		tmp = t_1
	elif eh <= 2.35e-71:
		tmp = math.fabs((ew * math.sin(t)))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(eh * cos(t)))
	tmp = 0.0
	if (eh <= -8.5e-35)
		tmp = t_1;
	elseif (eh <= 2.35e-71)
		tmp = abs(Float64(ew * sin(t)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((eh * cos(t)));
	tmp = 0.0;
	if (eh <= -8.5e-35)
		tmp = t_1;
	elseif (eh <= 2.35e-71)
		tmp = abs((ew * sin(t)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -8.5e-35], t$95$1, If[LessEqual[eh, 2.35e-71], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|eh \cdot \cos t\right|\\
\mathbf{if}\;eh \leq -8.5 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 2.35 \cdot 10^{-71}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -8.5000000000000001e-35 or 2.34999999999999998e-71 < eh

    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. Applied egg-rr27.3%

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

      \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
      2. lower-cos.f6484.7

        \[\leadsto \left|eh \cdot \color{blue}{\cos t}\right| \]
    6. Simplified84.7%

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

    if -8.5000000000000001e-35 < eh < 2.34999999999999998e-71

    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. Applied egg-rr65.0%

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

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. lower-sin.f6475.1

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    6. Simplified75.1%

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

Alternative 6: 63.9% accurate, 7.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|eh \cdot \cos t\right|\\ \mathbf{if}\;eh \leq -6.5 \cdot 10^{-187}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 5.8 \cdot 10^{-147}:\\ \;\;\;\;\left|t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* eh (cos t)))))
   (if (<= eh -6.5e-187) t_1 (if (<= eh 5.8e-147) (fabs (* t ew)) t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((eh * cos(t)));
	double tmp;
	if (eh <= -6.5e-187) {
		tmp = t_1;
	} else if (eh <= 5.8e-147) {
		tmp = fabs((t * ew));
	} else {
		tmp = t_1;
	}
	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) :: tmp
    t_1 = abs((eh * cos(t)))
    if (eh <= (-6.5d-187)) then
        tmp = t_1
    else if (eh <= 5.8d-147) then
        tmp = abs((t * ew))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((eh * Math.cos(t)));
	double tmp;
	if (eh <= -6.5e-187) {
		tmp = t_1;
	} else if (eh <= 5.8e-147) {
		tmp = Math.abs((t * ew));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((eh * math.cos(t)))
	tmp = 0
	if eh <= -6.5e-187:
		tmp = t_1
	elif eh <= 5.8e-147:
		tmp = math.fabs((t * ew))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(eh * cos(t)))
	tmp = 0.0
	if (eh <= -6.5e-187)
		tmp = t_1;
	elseif (eh <= 5.8e-147)
		tmp = abs(Float64(t * ew));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((eh * cos(t)));
	tmp = 0.0;
	if (eh <= -6.5e-187)
		tmp = t_1;
	elseif (eh <= 5.8e-147)
		tmp = abs((t * ew));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -6.5e-187], t$95$1, If[LessEqual[eh, 5.8e-147], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|eh \cdot \cos t\right|\\
\mathbf{if}\;eh \leq -6.5 \cdot 10^{-187}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 5.8 \cdot 10^{-147}:\\
\;\;\;\;\left|t \cdot ew\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -6.49999999999999983e-187 or 5.8000000000000002e-147 < eh

    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. Applied egg-rr38.8%

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

      \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
      2. lower-cos.f6471.6

        \[\leadsto \left|eh \cdot \color{blue}{\cos t}\right| \]
    6. Simplified71.6%

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

    if -6.49999999999999983e-187 < eh < 5.8000000000000002e-147

    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. Applied egg-rr58.8%

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

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

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(\color{blue}{eh \cdot eh}, \frac{-1}{2} \cdot \frac{{\cos t}^{2}}{ew \cdot \sin t} + \frac{{\cos t}^{2}}{ew \cdot \sin t}, ew \cdot \sin t\right)\right| \]
      5. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot eh, \frac{1}{2} \cdot \frac{{\cos t}^{2}}{ew \cdot \sin t}, \color{blue}{ew \cdot \sin t}\right)\right| \]
      14. lower-sin.f6480.9

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot eh, 0.5 \cdot \frac{{\cos t}^{2}}{ew \cdot \sin t}, ew \cdot \color{blue}{\sin t}\right)\right| \]
    6. Simplified80.9%

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

      \[\leadsto \left|\color{blue}{\frac{\frac{1}{2} \cdot \frac{{eh}^{2}}{ew} + {t}^{2} \cdot \left(ew + \frac{1}{2} \cdot \left(-1 \cdot \frac{{eh}^{2}}{ew} - \frac{-1}{6} \cdot \frac{{eh}^{2}}{ew}\right)\right)}{t}}\right| \]
    8. Step-by-step derivation
      1. lower-/.f64N/A

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

      \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(0.5, \frac{eh \cdot eh}{ew} \cdot -0.8333333333333334, ew\right), \frac{0.5 \cdot \left(eh \cdot eh\right)}{ew}\right)}{t}}\right| \]
    10. Taylor expanded in eh around 0

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

        \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
      2. lower-*.f6453.2

        \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
    12. Simplified53.2%

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

Alternative 7: 45.9% accurate, 43.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -9 \cdot 10^{-187}:\\ \;\;\;\;\left|eh\right|\\ \mathbf{elif}\;eh \leq 10^{-146}:\\ \;\;\;\;\left|t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= eh -9e-187) (fabs eh) (if (<= eh 1e-146) (fabs (* t ew)) (fabs eh))))
double code(double eh, double ew, double t) {
	double tmp;
	if (eh <= -9e-187) {
		tmp = fabs(eh);
	} else if (eh <= 1e-146) {
		tmp = fabs((t * ew));
	} else {
		tmp = fabs(eh);
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: tmp
    if (eh <= (-9d-187)) then
        tmp = abs(eh)
    else if (eh <= 1d-146) then
        tmp = abs((t * ew))
    else
        tmp = abs(eh)
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if (eh <= -9e-187) {
		tmp = Math.abs(eh);
	} else if (eh <= 1e-146) {
		tmp = Math.abs((t * ew));
	} else {
		tmp = Math.abs(eh);
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if eh <= -9e-187:
		tmp = math.fabs(eh)
	elif eh <= 1e-146:
		tmp = math.fabs((t * ew))
	else:
		tmp = math.fabs(eh)
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if (eh <= -9e-187)
		tmp = abs(eh);
	elseif (eh <= 1e-146)
		tmp = abs(Float64(t * ew));
	else
		tmp = abs(eh);
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if (eh <= -9e-187)
		tmp = abs(eh);
	elseif (eh <= 1e-146)
		tmp = abs((t * ew));
	else
		tmp = abs(eh);
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[eh, -9e-187], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 1e-146], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -9 \cdot 10^{-187}:\\
\;\;\;\;\left|eh\right|\\

\mathbf{elif}\;eh \leq 10^{-146}:\\
\;\;\;\;\left|t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -8.9999999999999996e-187 or 1.00000000000000003e-146 < eh

    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. Applied egg-rr38.8%

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

      \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
      2. lower-cos.f6471.6

        \[\leadsto \left|eh \cdot \color{blue}{\cos t}\right| \]
    6. Simplified71.6%

      \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
    7. Taylor expanded in t around 0

      \[\leadsto \left|eh \cdot \color{blue}{1}\right| \]
    8. Step-by-step derivation
      1. Simplified52.8%

        \[\leadsto \left|eh \cdot \color{blue}{1}\right| \]
      2. Step-by-step derivation
        1. *-rgt-identity52.8

          \[\leadsto \left|\color{blue}{eh}\right| \]
      3. Applied egg-rr52.8%

        \[\leadsto \left|\color{blue}{eh}\right| \]

      if -8.9999999999999996e-187 < eh < 1.00000000000000003e-146

      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. Applied egg-rr58.8%

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

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

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

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

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

          \[\leadsto \left|\mathsf{fma}\left(\color{blue}{eh \cdot eh}, \frac{-1}{2} \cdot \frac{{\cos t}^{2}}{ew \cdot \sin t} + \frac{{\cos t}^{2}}{ew \cdot \sin t}, ew \cdot \sin t\right)\right| \]
        5. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

          \[\leadsto \left|\mathsf{fma}\left(eh \cdot eh, \frac{1}{2} \cdot \frac{{\cos t}^{2}}{ew \cdot \sin t}, \color{blue}{ew \cdot \sin t}\right)\right| \]
        14. lower-sin.f6480.9

          \[\leadsto \left|\mathsf{fma}\left(eh \cdot eh, 0.5 \cdot \frac{{\cos t}^{2}}{ew \cdot \sin t}, ew \cdot \color{blue}{\sin t}\right)\right| \]
      6. Simplified80.9%

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

        \[\leadsto \left|\color{blue}{\frac{\frac{1}{2} \cdot \frac{{eh}^{2}}{ew} + {t}^{2} \cdot \left(ew + \frac{1}{2} \cdot \left(-1 \cdot \frac{{eh}^{2}}{ew} - \frac{-1}{6} \cdot \frac{{eh}^{2}}{ew}\right)\right)}{t}}\right| \]
      8. Step-by-step derivation
        1. lower-/.f64N/A

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

        \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(0.5, \frac{eh \cdot eh}{ew} \cdot -0.8333333333333334, ew\right), \frac{0.5 \cdot \left(eh \cdot eh\right)}{ew}\right)}{t}}\right| \]
      10. Taylor expanded in eh around 0

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

          \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
        2. lower-*.f6453.2

          \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
      12. Simplified53.2%

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

    Alternative 8: 43.0% accurate, 290.0× speedup?

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

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

      \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
      2. lower-cos.f6461.7

        \[\leadsto \left|eh \cdot \color{blue}{\cos t}\right| \]
    6. Simplified61.7%

      \[\leadsto \left|\color{blue}{eh \cdot \cos t}\right| \]
    7. Taylor expanded in t around 0

      \[\leadsto \left|eh \cdot \color{blue}{1}\right| \]
    8. Step-by-step derivation
      1. Simplified45.1%

        \[\leadsto \left|eh \cdot \color{blue}{1}\right| \]
      2. Step-by-step derivation
        1. *-rgt-identity45.1

          \[\leadsto \left|\color{blue}{eh}\right| \]
      3. Applied egg-rr45.1%

        \[\leadsto \left|\color{blue}{eh}\right| \]
      4. Add Preprocessing

      Reproduce

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