Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 20.4s
Alternatives: 11
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 11 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.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. 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. Applied rewrites99.7%

    \[\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: 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.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. 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. Applied rewrites99.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 3: 98.1% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if ew < -9.99999999999999945e65

    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 rewrites86.9%

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999945e65 < ew < 3.00000000000000017e43

    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 rewrites88.7%

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.00000000000000017e43 < ew

    1. Initial program 99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.0% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.4000000000000002e66 or 3.00000000000000017e43 < ew

    1. Initial program 99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.4000000000000002e66 < ew < 3.00000000000000017e43

    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 rewrites88.7%

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 97.9% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;ew \leq 2.8 \cdot 10^{+57}:\\
\;\;\;\;\left|eh \cdot \mathsf{fma}\left(\cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), \frac{ew \cdot \sin t}{eh}\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.4000000000000002e66 or 2.8e57 < ew

    1. Initial program 99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.4000000000000002e66 < ew < 2.8e57

    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 rewrites88.9%

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 94.1% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;ew \leq 7.2 \cdot 10^{-112}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot ew, \frac{0.5 \cdot {\sin t}^{2}}{t\_1}, t\_1\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.1e-92 or 7.2000000000000002e-112 < ew

    1. Initial program 99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1e-92 < ew < 7.2000000000000002e-112

    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 rewrites4.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 ew around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 88.7% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;ew \leq 9 \cdot 10^{-112}:\\
\;\;\;\;\left|\mathsf{fma}\left(ew \cdot ew, \frac{0.5 \cdot {\sin t}^{2}}{t\_2}, t\_2\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.6000000000000001e-82 or 9.00000000000000024e-112 < ew

    1. Initial program 99.8%

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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 ew around inf

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

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

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

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

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

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

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

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

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

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

    if -1.6000000000000001e-82 < ew < 9.00000000000000024e-112

    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 rewrites5.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 ew around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 74.6% 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^{-90}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 4.4 \cdot 10^{-116}:\\ \;\;\;\;\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-90) t_1 (if (<= eh 4.4e-116) (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-90) {
		tmp = t_1;
	} else if (eh <= 4.4e-116) {
		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-90)) then
        tmp = t_1
    else if (eh <= 4.4d-116) 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-90) {
		tmp = t_1;
	} else if (eh <= 4.4e-116) {
		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-90:
		tmp = t_1
	elif eh <= 4.4e-116:
		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-90)
		tmp = t_1;
	elseif (eh <= 4.4e-116)
		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-90)
		tmp = t_1;
	elseif (eh <= 4.4e-116)
		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-90], t$95$1, If[LessEqual[eh, 4.4e-116], 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^{-90}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 4.4 \cdot 10^{-116}:\\
\;\;\;\;\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-90 or 4.4000000000000002e-116 < eh

    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 rewrites31.2%

      \[\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.f6480.4

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

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

    if -8.5000000000000001e-90 < eh < 4.4000000000000002e-116

    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 rewrites79.4%

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh, \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.f6480.5

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    6. Applied rewrites80.5%

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

Alternative 9: 62.3% accurate, 7.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|eh \cdot \cos t\right|\\ \mathbf{if}\;eh \leq -2 \cdot 10^{-179}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 7 \cdot 10^{-233}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(t, t \cdot \mathsf{fma}\left(\frac{eh \cdot eh}{ew}, -0.4166666666666667, ew\right), \frac{0.5 \cdot \left(eh \cdot eh\right)}{ew}\right)}{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 -2e-179)
     t_1
     (if (<= eh 7e-233)
       (fabs
        (/
         (fma
          t
          (* t (fma (/ (* eh eh) ew) -0.4166666666666667 ew))
          (/ (* 0.5 (* eh eh)) ew))
         t))
       t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((eh * cos(t)));
	double tmp;
	if (eh <= -2e-179) {
		tmp = t_1;
	} else if (eh <= 7e-233) {
		tmp = fabs((fma(t, (t * fma(((eh * eh) / ew), -0.4166666666666667, ew)), ((0.5 * (eh * eh)) / ew)) / t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = abs(Float64(eh * cos(t)))
	tmp = 0.0
	if (eh <= -2e-179)
		tmp = t_1;
	elseif (eh <= 7e-233)
		tmp = abs(Float64(fma(t, Float64(t * fma(Float64(Float64(eh * eh) / ew), -0.4166666666666667, ew)), Float64(Float64(0.5 * Float64(eh * eh)) / ew)) / 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, -2e-179], t$95$1, If[LessEqual[eh, 7e-233], N[Abs[N[(N[(t * N[(t * N[(N[(N[(eh * eh), $MachinePrecision] / ew), $MachinePrecision] * -0.4166666666666667 + ew), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[(eh * eh), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

\mathbf{elif}\;eh \leq 7 \cdot 10^{-233}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(t, t \cdot \mathsf{fma}\left(\frac{eh \cdot eh}{ew}, -0.4166666666666667, ew\right), \frac{0.5 \cdot \left(eh \cdot eh\right)}{ew}\right)}{t}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -2e-179 or 6.99999999999999982e-233 < eh

    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 rewrites38.9%

      \[\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.f6469.5

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

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

    if -2e-179 < eh < 6.99999999999999982e-233

    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 rewrites80.4%

      \[\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.f6494.3

        \[\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. Applied rewrites94.3%

      \[\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. Applied rewrites34.4%

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

Alternative 10: 43.2% accurate, 10.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -2.1 \cdot 10^{-179}:\\ \;\;\;\;\left|eh\right|\\ \mathbf{elif}\;eh \leq 8 \cdot 10^{-233}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(t, t \cdot \mathsf{fma}\left(\frac{eh \cdot eh}{ew}, -0.4166666666666667, ew\right), \frac{0.5 \cdot \left(eh \cdot eh\right)}{ew}\right)}{t}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= eh -2.1e-179)
   (fabs eh)
   (if (<= eh 8e-233)
     (fabs
      (/
       (fma
        t
        (* t (fma (/ (* eh eh) ew) -0.4166666666666667 ew))
        (/ (* 0.5 (* eh eh)) ew))
       t))
     (fabs eh))))
double code(double eh, double ew, double t) {
	double tmp;
	if (eh <= -2.1e-179) {
		tmp = fabs(eh);
	} else if (eh <= 8e-233) {
		tmp = fabs((fma(t, (t * fma(((eh * eh) / ew), -0.4166666666666667, ew)), ((0.5 * (eh * eh)) / ew)) / t));
	} else {
		tmp = fabs(eh);
	}
	return tmp;
}
function code(eh, ew, t)
	tmp = 0.0
	if (eh <= -2.1e-179)
		tmp = abs(eh);
	elseif (eh <= 8e-233)
		tmp = abs(Float64(fma(t, Float64(t * fma(Float64(Float64(eh * eh) / ew), -0.4166666666666667, ew)), Float64(Float64(0.5 * Float64(eh * eh)) / ew)) / t));
	else
		tmp = abs(eh);
	end
	return tmp
end
code[eh_, ew_, t_] := If[LessEqual[eh, -2.1e-179], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 8e-233], N[Abs[N[(N[(t * N[(t * N[(N[(N[(eh * eh), $MachinePrecision] / ew), $MachinePrecision] * -0.4166666666666667 + ew), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 * N[(eh * eh), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;eh \leq 8 \cdot 10^{-233}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(t, t \cdot \mathsf{fma}\left(\frac{eh \cdot eh}{ew}, -0.4166666666666667, ew\right), \frac{0.5 \cdot \left(eh \cdot eh\right)}{ew}\right)}{t}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -2.0999999999999999e-179 or 7.99999999999999966e-233 < eh

    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 rewrites38.9%

      \[\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.f6469.5

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

      \[\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. Applied rewrites48.2%

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

          \[\leadsto \left|\color{blue}{eh}\right| \]
      3. Applied rewrites48.2%

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

      if -2.0999999999999999e-179 < eh < 7.99999999999999966e-233

      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 rewrites80.4%

        \[\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.f6494.3

          \[\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. Applied rewrites94.3%

        \[\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. Applied rewrites34.4%

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

    Alternative 11: 41.6% 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.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 rewrites44.7%

      \[\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.0

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

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

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

          \[\leadsto \left|\color{blue}{eh}\right| \]
      3. Applied rewrites42.7%

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

      Reproduce

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