Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 18.5s
Alternatives: 9
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 97.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\tan t}{ew}\\ t_2 := \left(-eh\right) \cdot t\_1\\ t_3 := ew \cdot \cos t\\ t_4 := \left|eh \cdot \left(\frac{t\_3}{eh} - \sin t \cdot \sin \tan^{-1} t\_2\right)\right|\\ \mathbf{if}\;eh \leq -2 \cdot 10^{-41}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;eh \leq 0.46:\\ \;\;\;\;\left|\frac{t\_3 + eh \cdot \left(\sin t \cdot \left(eh \cdot t\_1\right)\right)}{\sqrt{1 + {t\_2}^{2}}}\right|\\ \mathbf{else}:\\ \;\;\;\;t\_4\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ (tan t) ew))
        (t_2 (* (- eh) t_1))
        (t_3 (* ew (cos t)))
        (t_4 (fabs (* eh (- (/ t_3 eh) (* (sin t) (sin (atan t_2))))))))
   (if (<= eh -2e-41)
     t_4
     (if (<= eh 0.46)
       (fabs
        (/ (+ t_3 (* eh (* (sin t) (* eh t_1)))) (sqrt (+ 1.0 (pow t_2 2.0)))))
       t_4))))
double code(double eh, double ew, double t) {
	double t_1 = tan(t) / ew;
	double t_2 = -eh * t_1;
	double t_3 = ew * cos(t);
	double t_4 = fabs((eh * ((t_3 / eh) - (sin(t) * sin(atan(t_2))))));
	double tmp;
	if (eh <= -2e-41) {
		tmp = t_4;
	} else if (eh <= 0.46) {
		tmp = fabs(((t_3 + (eh * (sin(t) * (eh * t_1)))) / sqrt((1.0 + pow(t_2, 2.0)))));
	} else {
		tmp = t_4;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = tan(t) / ew
    t_2 = -eh * t_1
    t_3 = ew * cos(t)
    t_4 = abs((eh * ((t_3 / eh) - (sin(t) * sin(atan(t_2))))))
    if (eh <= (-2d-41)) then
        tmp = t_4
    else if (eh <= 0.46d0) then
        tmp = abs(((t_3 + (eh * (sin(t) * (eh * t_1)))) / sqrt((1.0d0 + (t_2 ** 2.0d0)))))
    else
        tmp = t_4
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.tan(t) / ew;
	double t_2 = -eh * t_1;
	double t_3 = ew * Math.cos(t);
	double t_4 = Math.abs((eh * ((t_3 / eh) - (Math.sin(t) * Math.sin(Math.atan(t_2))))));
	double tmp;
	if (eh <= -2e-41) {
		tmp = t_4;
	} else if (eh <= 0.46) {
		tmp = Math.abs(((t_3 + (eh * (Math.sin(t) * (eh * t_1)))) / Math.sqrt((1.0 + Math.pow(t_2, 2.0)))));
	} else {
		tmp = t_4;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.tan(t) / ew
	t_2 = -eh * t_1
	t_3 = ew * math.cos(t)
	t_4 = math.fabs((eh * ((t_3 / eh) - (math.sin(t) * math.sin(math.atan(t_2))))))
	tmp = 0
	if eh <= -2e-41:
		tmp = t_4
	elif eh <= 0.46:
		tmp = math.fabs(((t_3 + (eh * (math.sin(t) * (eh * t_1)))) / math.sqrt((1.0 + math.pow(t_2, 2.0)))))
	else:
		tmp = t_4
	return tmp
function code(eh, ew, t)
	t_1 = Float64(tan(t) / ew)
	t_2 = Float64(Float64(-eh) * t_1)
	t_3 = Float64(ew * cos(t))
	t_4 = abs(Float64(eh * Float64(Float64(t_3 / eh) - Float64(sin(t) * sin(atan(t_2))))))
	tmp = 0.0
	if (eh <= -2e-41)
		tmp = t_4;
	elseif (eh <= 0.46)
		tmp = abs(Float64(Float64(t_3 + Float64(eh * Float64(sin(t) * Float64(eh * t_1)))) / sqrt(Float64(1.0 + (t_2 ^ 2.0)))));
	else
		tmp = t_4;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = tan(t) / ew;
	t_2 = -eh * t_1;
	t_3 = ew * cos(t);
	t_4 = abs((eh * ((t_3 / eh) - (sin(t) * sin(atan(t_2))))));
	tmp = 0.0;
	if (eh <= -2e-41)
		tmp = t_4;
	elseif (eh <= 0.46)
		tmp = abs(((t_3 + (eh * (sin(t) * (eh * t_1)))) / sqrt((1.0 + (t_2 ^ 2.0)))));
	else
		tmp = t_4;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[((-eh) * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[(eh * N[(N[(t$95$3 / eh), $MachinePrecision] - N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -2e-41], t$95$4, If[LessEqual[eh, 0.46], N[Abs[N[(N[(t$95$3 + N[(eh * N[(N[Sin[t], $MachinePrecision] * N[(eh * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;eh \leq 0.46:\\
\;\;\;\;\left|\frac{t\_3 + eh \cdot \left(\sin t \cdot \left(eh \cdot t\_1\right)\right)}{\sqrt{1 + {t\_2}^{2}}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -2.00000000000000001e-41 or 0.46000000000000002 < eh

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
      9. rem-square-sqrtN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000001e-41 < eh < 0.46000000000000002

    1. Initial program 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -2 \cdot 10^{-41}:\\ \;\;\;\;\left|eh \cdot \left(\frac{ew \cdot \cos t}{eh} - \sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right|\\ \mathbf{elif}\;eh \leq 0.46:\\ \;\;\;\;\left|\frac{ew \cdot \cos t + eh \cdot \left(\sin t \cdot \left(eh \cdot \frac{\tan t}{ew}\right)\right)}{\sqrt{1 + {\left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}^{2}}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \left(\frac{ew \cdot \cos t}{eh} - \sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.3% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;ew \leq 10^{-17}:\\
\;\;\;\;\left|eh \cdot \left(\frac{ew \cdot \cos t}{eh} - t\_2\right)\right|\\

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
      9. rem-square-sqrtN/A

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

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

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

    if -8.9999999999999995e-15 < ew < 1.00000000000000007e-17

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
      9. rem-square-sqrtN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000007e-17 < ew

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
      9. rem-square-sqrtN/A

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

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

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

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

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

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

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

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

Alternative 4: 98.2% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;ew \leq 10^{-17}:\\
\;\;\;\;\left|eh \cdot \left(\frac{ew \cdot \cos t}{eh} - \sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -8.9999999999999995e-15 or 1.00000000000000007e-17 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
      9. rem-square-sqrtN/A

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

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

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

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

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

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

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

    if -8.9999999999999995e-15 < ew < 1.00000000000000007e-17

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
      9. rem-square-sqrtN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 91.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -2.6 \cdot 10^{+227}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -2.59999999999999982e227

    1. Initial program 99.8%

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

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

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

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

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

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

    if -2.59999999999999982e227 < eh

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
      9. rem-square-sqrtN/A

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

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

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

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

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

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

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

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

Alternative 6: 74.1% accurate, 7.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.29999999999999996e23 or 4.5e-11 < ew

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \left|ew \cdot \color{blue}{\cos t}\right| \]
    6. Applied rewrites88.3%

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

    if -1.29999999999999996e23 < ew < 4.5e-11

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 7: 57.6% accurate, 7.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.6 \cdot 10^{+31}:\\
\;\;\;\;\left|ew\right|\\

\mathbf{elif}\;ew \leq 2 \cdot 10^{+132}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.6e31 or 1.99999999999999998e132 < ew

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
      9. rem-square-sqrtN/A

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

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

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

      \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \color{blue}{-1}\right| \]
    9. Step-by-step derivation
      1. Applied rewrites59.3%

        \[\leadsto \left|\left(-ew\right) \cdot \color{blue}{-1}\right| \]

      if -1.6e31 < ew < 1.99999999999999998e132

      1. Initial program 99.8%

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

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

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

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

          \[\leadsto \left|eh \cdot \color{blue}{\sin t}\right| \]
      6. Applied rewrites63.3%

        \[\leadsto \left|\color{blue}{eh \cdot \sin t}\right| \]
    10. Recombined 2 regimes into one program.
    11. Final simplification61.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -1.6 \cdot 10^{+31}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{elif}\;ew \leq 2 \cdot 10^{+132}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \]
    12. Add Preprocessing

    Alternative 8: 45.5% accurate, 43.0× speedup?

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

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \left(eh \cdot \frac{\sin t \cdot \sin \tan^{-1} \left(\mathsf{neg}\left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos t\right)\right| \]
        9. rem-square-sqrtN/A

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

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

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

        \[\leadsto \left|\left(\mathsf{neg}\left(ew\right)\right) \cdot \color{blue}{-1}\right| \]
      9. Step-by-step derivation
        1. Applied rewrites46.5%

          \[\leadsto \left|\left(-ew\right) \cdot \color{blue}{-1}\right| \]

        if -6.49999999999999956e-112 < ew < 1.2800000000000001e-194

        1. Initial program 99.9%

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

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

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

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

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

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

          \[\leadsto \left|\color{blue}{eh \cdot t}\right| \]
        8. Step-by-step derivation
          1. lower-*.f6446.4

            \[\leadsto \left|\color{blue}{eh \cdot t}\right| \]
        9. Applied rewrites46.4%

          \[\leadsto \left|\color{blue}{eh \cdot t}\right| \]
      10. Recombined 2 regimes into one program.
      11. Final simplification46.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -6.5 \cdot 10^{-112}:\\ \;\;\;\;\left|ew\right|\\ \mathbf{elif}\;ew \leq 1.28 \cdot 10^{-194}:\\ \;\;\;\;\left|t \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \]
      12. Add Preprocessing

      Alternative 9: 18.8% accurate, 107.8× speedup?

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{eh \cdot t}\right| \]
      8. Step-by-step derivation
        1. lower-*.f6421.0

          \[\leadsto \left|\color{blue}{eh \cdot t}\right| \]
      9. Applied rewrites21.0%

        \[\leadsto \left|\color{blue}{eh \cdot t}\right| \]
      10. Final simplification21.0%

        \[\leadsto \left|t \cdot eh\right| \]
      11. Add Preprocessing

      Reproduce

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