Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 19.8s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 99.8% accurate, 1.1× speedup?

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

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

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

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

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

Alternative 3: 98.5% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

Alternative 4: 75.9% accurate, 2.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(\cos t, ew, eh \cdot t\_1\right)\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if ew < -1.59999999999999999e-89

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.59999999999999999e-89 < ew < 1.2e-36

    1. Initial program 99.7%

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

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

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

        \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
      2. lower-sin.f6472.2

        \[\leadsto \left|eh \cdot \color{blue}{\sin t}\right| \]
    6. Simplified72.2%

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

    if 1.2e-36 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -1.6 \cdot 10^{-89}:\\ \;\;\;\;\left|\mathsf{fma}\left(\left(eh \cdot 0.5\right) \cdot \left(\sin t \cdot \frac{\tan t}{ew}\right), eh, ew \cdot \cos t\right)\right|\\ \mathbf{elif}\;ew \leq 1.2 \cdot 10^{-36}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\mathsf{fma}\left(\cos t, ew, eh \cdot \left(\left(eh \cdot 0.5\right) \cdot \left(\sin t \cdot \frac{\tan t}{ew}\right)\right)\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 75.9% accurate, 2.4× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.59999999999999999e-89 or 1.2e-36 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.59999999999999999e-89 < ew < 1.2e-36

    1. Initial program 99.7%

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

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

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

        \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
      2. lower-sin.f6472.2

        \[\leadsto \left|eh \cdot \color{blue}{\sin t}\right| \]
    6. Simplified72.2%

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

Alternative 6: 75.6% accurate, 7.2× speedup?

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

\\
\begin{array}{l}
t_1 := \left|ew \cdot \cos t\right|\\
\mathbf{if}\;ew \leq -1.6 \cdot 10^{-89}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.59999999999999999e-89 or 4.19999999999999982e-36 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

    if -1.59999999999999999e-89 < ew < 4.19999999999999982e-36

    1. Initial program 99.7%

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

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

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

        \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
      2. lower-sin.f6472.2

        \[\leadsto \left|eh \cdot \color{blue}{\sin t}\right| \]
    6. Simplified72.2%

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

Alternative 7: 61.1% accurate, 7.2× speedup?

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

\\
\begin{array}{l}
t_1 := \left|eh \cdot \sin t\right|\\
\mathbf{if}\;t \leq -5 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 1.5 \cdot 10^{-43}:\\
\;\;\;\;\left|\mathsf{fma}\left(t \cdot \left(ew \cdot -0.5\right), t, ew\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.00000000000000041e-6 or 1.50000000000000002e-43 < t

    1. Initial program 99.6%

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

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

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

        \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
      2. lower-sin.f6451.8

        \[\leadsto \left|eh \cdot \color{blue}{\sin t}\right| \]
    6. Simplified51.8%

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

    if -5.00000000000000041e-6 < t < 1.50000000000000002e-43

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \frac{-1}{2} \cdot \left(ew + \frac{eh \cdot eh}{ew}\right) - \left(\mathsf{neg}\left(\frac{\color{blue}{eh \cdot eh}}{ew}\right)\right), ew\right)\right| \]
      16. lower-*.f6466.0

        \[\leadsto \left|\mathsf{fma}\left(t \cdot t, -0.5 \cdot \left(ew + \frac{eh \cdot eh}{ew}\right) - \left(-\frac{\color{blue}{eh \cdot eh}}{ew}\right), ew\right)\right| \]
    6. Simplified66.0%

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

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{\frac{-1}{2} \cdot ew}, ew\right)\right| \]
    8. Step-by-step derivation
      1. lower-*.f6476.5

        \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{-0.5 \cdot ew}, ew\right)\right| \]
    9. Simplified76.5%

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{-0.5 \cdot ew}, ew\right)\right| \]
    10. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(t \cdot t\right)} \cdot \left(\frac{-1}{2} \cdot ew\right) + ew\right| \]
      2. lift-*.f64N/A

        \[\leadsto \left|\left(t \cdot t\right) \cdot \color{blue}{\left(\frac{-1}{2} \cdot ew\right)} + ew\right| \]
      3. lift-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(t \cdot t\right)} \cdot \left(\frac{-1}{2} \cdot ew\right) + ew\right| \]
      4. associate-*l*N/A

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(t \cdot \left(\frac{-1}{2} \cdot ew\right), t, ew\right)}\right| \]
      7. lower-*.f6476.5

        \[\leadsto \left|\mathsf{fma}\left(\color{blue}{t \cdot \left(-0.5 \cdot ew\right)}, t, ew\right)\right| \]
      8. lift-*.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(t \cdot \color{blue}{\left(\frac{-1}{2} \cdot ew\right)}, t, ew\right)\right| \]
      9. *-commutativeN/A

        \[\leadsto \left|\mathsf{fma}\left(t \cdot \color{blue}{\left(ew \cdot \frac{-1}{2}\right)}, t, ew\right)\right| \]
      10. lower-*.f6476.5

        \[\leadsto \left|\mathsf{fma}\left(t \cdot \color{blue}{\left(ew \cdot -0.5\right)}, t, ew\right)\right| \]
    11. Applied egg-rr76.5%

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

Alternative 8: 38.1% accurate, 45.4× speedup?

\[\begin{array}{l} \\ \left|\mathsf{fma}\left(t \cdot \left(ew \cdot -0.5\right), t, ew\right)\right| \end{array} \]
(FPCore (eh ew t) :precision binary64 (fabs (fma (* t (* ew -0.5)) t ew)))
double code(double eh, double ew, double t) {
	return fabs(fma((t * (ew * -0.5)), t, ew));
}
function code(eh, ew, t)
	return abs(fma(Float64(t * Float64(ew * -0.5)), t, ew))
end
code[eh_, ew_, t_] := N[Abs[N[(N[(t * N[(ew * -0.5), $MachinePrecision]), $MachinePrecision] * t + ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\mathsf{fma}\left(t \cdot \left(ew \cdot -0.5\right), t, ew\right)\right|
\end{array}
Derivation
  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \frac{-1}{2} \cdot \left(ew + \frac{eh \cdot eh}{ew}\right) - \left(\mathsf{neg}\left(\frac{\color{blue}{eh \cdot eh}}{ew}\right)\right), ew\right)\right| \]
    16. lower-*.f6433.0

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, -0.5 \cdot \left(ew + \frac{eh \cdot eh}{ew}\right) - \left(-\frac{\color{blue}{eh \cdot eh}}{ew}\right), ew\right)\right| \]
  6. Simplified33.0%

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

    \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{\frac{-1}{2} \cdot ew}, ew\right)\right| \]
  8. Step-by-step derivation
    1. lower-*.f6439.1

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{-0.5 \cdot ew}, ew\right)\right| \]
  9. Simplified39.1%

    \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{-0.5 \cdot ew}, ew\right)\right| \]
  10. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left|\color{blue}{\left(t \cdot t\right)} \cdot \left(\frac{-1}{2} \cdot ew\right) + ew\right| \]
    2. lift-*.f64N/A

      \[\leadsto \left|\left(t \cdot t\right) \cdot \color{blue}{\left(\frac{-1}{2} \cdot ew\right)} + ew\right| \]
    3. lift-*.f64N/A

      \[\leadsto \left|\color{blue}{\left(t \cdot t\right)} \cdot \left(\frac{-1}{2} \cdot ew\right) + ew\right| \]
    4. associate-*l*N/A

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

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(t \cdot \left(\frac{-1}{2} \cdot ew\right), t, ew\right)}\right| \]
    7. lower-*.f6439.3

      \[\leadsto \left|\mathsf{fma}\left(\color{blue}{t \cdot \left(-0.5 \cdot ew\right)}, t, ew\right)\right| \]
    8. lift-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(t \cdot \color{blue}{\left(\frac{-1}{2} \cdot ew\right)}, t, ew\right)\right| \]
    9. *-commutativeN/A

      \[\leadsto \left|\mathsf{fma}\left(t \cdot \color{blue}{\left(ew \cdot \frac{-1}{2}\right)}, t, ew\right)\right| \]
    10. lower-*.f6439.3

      \[\leadsto \left|\mathsf{fma}\left(t \cdot \color{blue}{\left(ew \cdot -0.5\right)}, t, ew\right)\right| \]
  11. Applied egg-rr39.3%

    \[\leadsto \left|\color{blue}{\mathsf{fma}\left(t \cdot \left(ew \cdot -0.5\right), t, ew\right)}\right| \]
  12. Add Preprocessing

Alternative 9: 38.1% accurate, 45.4× speedup?

\[\begin{array}{l} \\ \left|\mathsf{fma}\left(t \cdot t, ew \cdot -0.5, ew\right)\right| \end{array} \]
(FPCore (eh ew t) :precision binary64 (fabs (fma (* t t) (* ew -0.5) ew)))
double code(double eh, double ew, double t) {
	return fabs(fma((t * t), (ew * -0.5), ew));
}
function code(eh, ew, t)
	return abs(fma(Float64(t * t), Float64(ew * -0.5), ew))
end
code[eh_, ew_, t_] := N[Abs[N[(N[(t * t), $MachinePrecision] * N[(ew * -0.5), $MachinePrecision] + ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|\mathsf{fma}\left(t \cdot t, ew \cdot -0.5, ew\right)\right|
\end{array}
Derivation
  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \frac{-1}{2} \cdot \left(ew + \frac{eh \cdot eh}{ew}\right) - \left(\mathsf{neg}\left(\frac{\color{blue}{eh \cdot eh}}{ew}\right)\right), ew\right)\right| \]
    16. lower-*.f6433.0

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, -0.5 \cdot \left(ew + \frac{eh \cdot eh}{ew}\right) - \left(-\frac{\color{blue}{eh \cdot eh}}{ew}\right), ew\right)\right| \]
  6. Simplified33.0%

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

    \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{\frac{-1}{2} \cdot ew}, ew\right)\right| \]
  8. Step-by-step derivation
    1. lower-*.f6439.1

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{-0.5 \cdot ew}, ew\right)\right| \]
  9. Simplified39.1%

    \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{-0.5 \cdot ew}, ew\right)\right| \]
  10. Final simplification39.1%

    \[\leadsto \left|\mathsf{fma}\left(t \cdot t, ew \cdot -0.5, ew\right)\right| \]
  11. Add Preprocessing

Alternative 10: 4.8% accurate, 47.9× speedup?

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

\\
\left|ew \cdot \left(-0.5 \cdot \left(t \cdot t\right)\right)\right|
\end{array}
Derivation
  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \frac{-1}{2} \cdot \left(ew + \frac{eh \cdot eh}{ew}\right) - \left(\mathsf{neg}\left(\frac{\color{blue}{eh \cdot eh}}{ew}\right)\right), ew\right)\right| \]
    16. lower-*.f6433.0

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, -0.5 \cdot \left(ew + \frac{eh \cdot eh}{ew}\right) - \left(-\frac{\color{blue}{eh \cdot eh}}{ew}\right), ew\right)\right| \]
  6. Simplified33.0%

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

    \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{\frac{-1}{2} \cdot ew}, ew\right)\right| \]
  8. Step-by-step derivation
    1. lower-*.f6439.1

      \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \color{blue}{-0.5 \cdot ew}, ew\right)\right| \]
  9. Simplified39.1%

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

    \[\leadsto \left|\color{blue}{\frac{-1}{2} \cdot \left(ew \cdot {t}^{2}\right)}\right| \]
  11. Step-by-step derivation
    1. associate-*r*N/A

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

      \[\leadsto \left|\color{blue}{\left(ew \cdot \frac{-1}{2}\right)} \cdot {t}^{2}\right| \]
    3. associate-*r*N/A

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

      \[\leadsto \left|\color{blue}{ew \cdot \left(\frac{-1}{2} \cdot {t}^{2}\right)}\right| \]
    5. lower-*.f64N/A

      \[\leadsto \left|ew \cdot \color{blue}{\left(\frac{-1}{2} \cdot {t}^{2}\right)}\right| \]
    6. unpow2N/A

      \[\leadsto \left|ew \cdot \left(\frac{-1}{2} \cdot \color{blue}{\left(t \cdot t\right)}\right)\right| \]
    7. lower-*.f644.9

      \[\leadsto \left|ew \cdot \left(-0.5 \cdot \color{blue}{\left(t \cdot t\right)}\right)\right| \]
  12. Simplified4.9%

    \[\leadsto \left|\color{blue}{ew \cdot \left(-0.5 \cdot \left(t \cdot t\right)\right)}\right| \]
  13. Add Preprocessing

Reproduce

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