Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 13.8s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

Alternative 3: 74.5% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_1 := eh \cdot \frac{\tan t}{ew}\\
\mathbf{if}\;eh \leq -4.3 \cdot 10^{-17} \lor \neg \left(eh \leq 2.9 \cdot 10^{+94}\right):\\
\;\;\;\;\left|\left(\sin t \cdot \left(-eh\right)\right) \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\sin t}{\cos t \cdot ew}\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -4.30000000000000023e-17 or 2.8999999999999998e94 < eh

    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. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.30000000000000023e-17 < eh < 2.8999999999999998e94

    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 rewrites84.3%

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

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

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

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

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

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

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

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

Alternative 4: 73.5% accurate, 1.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left|t\_1 \cdot \cos t\_2\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -4.30000000000000023e-17 or 2.8999999999999998e94 < eh

    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. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.30000000000000023e-17 < eh < 2.8999999999999998e94

    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. Taylor expanded in t around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 62.9% accurate, 1.6× speedup?

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

\\
\left|\frac{\left(-ew\right) \cdot \cos t}{{\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)}^{-1}}\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 rewrites60.4%

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

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

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

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

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

      \[\leadsto \left|\frac{\color{blue}{\left(-ew\right)} \cdot \cos t}{\frac{1}{\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)}}\right| \]
    5. lower-cos.f6457.8

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

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

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

Alternative 6: 62.9% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 44.7% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-15}:\\
\;\;\;\;\left|\frac{\cos t \cdot ew - \mathsf{fma}\left(\mathsf{fma}\left(\left(eh \cdot eh\right) \cdot \frac{t \cdot t}{ew}, -0.08611111111111111, \frac{eh \cdot eh}{ew} \cdot -0.16666666666666666\right), t \cdot t, \frac{\left(-eh\right) \cdot eh}{ew}\right) \cdot \left(t \cdot t\right)}{\frac{-1}{\cos \tan^{-1} \left(\frac{t}{ew} \cdot eh\right)}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.90000000000000019e-15

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \left|\frac{\color{blue}{\left(-1 \cdot \frac{{eh}^{2}}{ew} + {t}^{2} \cdot \left(\frac{-1}{6} \cdot \frac{{eh}^{2}}{ew} + \frac{-31}{360} \cdot \frac{{eh}^{2} \cdot {t}^{2}}{ew}\right)\right) \cdot {t}^{2}} - \cos t \cdot ew}{\frac{1}{\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)}}\right| \]
    6. Applied rewrites19.9%

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

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

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

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

    if -2.90000000000000019e-15 < t

    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. Taylor expanded in t around 0

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

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

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

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

      \[\leadsto \left|\cos \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right) \cdot ew\right| \]
    7. Step-by-step derivation
      1. Applied rewrites48.7%

        \[\leadsto \left|\cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{t}{ew}\right) \cdot ew\right| \]
      2. Step-by-step derivation
        1. Applied rewrites47.9%

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

          \[\leadsto \left|\frac{ew}{1}\right| \]
        3. Step-by-step derivation
          1. Applied rewrites49.8%

            \[\leadsto \left|\frac{ew}{1}\right| \]
        4. Recombined 2 regimes into one program.
        5. Final simplification40.6%

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

        Alternative 8: 43.6% accurate, 61.6× speedup?

        \[\begin{array}{l} \\ \left|\frac{ew}{1}\right| \end{array} \]
        (FPCore (eh ew t) :precision binary64 (fabs (/ ew 1.0)))
        double code(double eh, double ew, double t) {
        	return fabs((ew / 1.0));
        }
        
        real(8) function code(eh, ew, t)
            real(8), intent (in) :: eh
            real(8), intent (in) :: ew
            real(8), intent (in) :: t
            code = abs((ew / 1.0d0))
        end function
        
        public static double code(double eh, double ew, double t) {
        	return Math.abs((ew / 1.0));
        }
        
        def code(eh, ew, t):
        	return math.fabs((ew / 1.0))
        
        function code(eh, ew, t)
        	return abs(Float64(ew / 1.0))
        end
        
        function tmp = code(eh, ew, t)
        	tmp = abs((ew / 1.0));
        end
        
        code[eh_, ew_, t_] := N[Abs[N[(ew / 1.0), $MachinePrecision]], $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \left|\frac{ew}{1}\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. Taylor expanded in t around 0

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

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

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

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

          \[\leadsto \left|\cos \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right) \cdot ew\right| \]
        7. Step-by-step derivation
          1. Applied rewrites36.9%

            \[\leadsto \left|\cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{t}{ew}\right) \cdot ew\right| \]
          2. Step-by-step derivation
            1. Applied rewrites35.8%

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

              \[\leadsto \left|\frac{ew}{1}\right| \]
            3. Step-by-step derivation
              1. Applied rewrites38.3%

                \[\leadsto \left|\frac{ew}{1}\right| \]
              2. Add Preprocessing

              Reproduce

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