Example 2 from Robby

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

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\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, 0.9× speedup?

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
  3. Simplified99.8%

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{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 \left(-\tan t\right)}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right)\right| \]
  4. Add Preprocessing

Alternative 3: 98.2% accurate, 1.0× speedup?

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

\\
\left|\mathsf{fma}\left(ew, \log \left(e^{\cos t}\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(eh \cdot \frac{\tan t}{-ew}\right)\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. Step-by-step derivation
    1. fabs-sub99.8%

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. expm1-log1p-u99.8%

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
  7. Step-by-step derivation
    1. expm1-define99.2%

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \mathsf{expm1}\left(\color{blue}{\log \left(1 + \cos t\right)}\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
  10. Step-by-step derivation
    1. log1p-define99.0%

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

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\log \left(e^{\cos t}\right)}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
  12. Final simplification98.9%

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

Alternative 4: 93.7% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_1 := ew \cdot \cos t\\
\mathbf{if}\;eh \leq -6.4 \cdot 10^{-148} \lor \neg \left(eh \leq 2.4 \cdot 10^{-173}\right):\\
\;\;\;\;\left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right) + \frac{t\_1}{eh}\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -6.39999999999999987e-148 or 2.40000000000000017e-173 < 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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.8%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define99.4%

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

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

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

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

    if -6.39999999999999987e-148 < eh < 2.40000000000000017e-173

    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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.7%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define98.9%

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.9%

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

Alternative 5: 78.2% accurate, 1.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if ew < -8.5e-9 or 6.99999999999999982e105 < 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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.7%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define99.7%

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

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

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

    if -8.5e-9 < ew < -9.19999999999999995e-166

    1. Initial program 99.7%

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

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

      \[\leadsto \color{blue}{ew \cdot \left(-1 \cdot \frac{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} - \cos t\right)} \]
    5. Step-by-step derivation
      1. sub-neg70.6%

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

        \[\leadsto ew \cdot \left(\color{blue}{\left(-\frac{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew}\right)} + \left(-\cos t\right)\right) \]
      3. distribute-neg-in70.6%

        \[\leadsto ew \cdot \color{blue}{\left(-\left(\frac{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} + \cos t\right)\right)} \]
      4. remove-double-neg70.6%

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

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

        \[\leadsto ew \cdot \left(-\color{blue}{\left(\frac{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew} - -1 \cdot \cos t\right)}\right) \]
      7. associate-/l*70.6%

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

      \[\leadsto \color{blue}{ew \cdot \left(-\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 -9.19999999999999995e-166 < ew < 9.0000000000000001e-92

    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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.8%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define98.6%

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

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

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

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(-\frac{eh \cdot \tan t}{ew}\right)}\right)\right| \]
      2. associate-/l*82.7%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-\color{blue}{eh \cdot \frac{\tan t}{ew}}\right)\right)\right| \]
      3. distribute-lft-neg-out82.7%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}\right)\right| \]
      4. associate-*l*82.7%

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

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

      \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right| \]
    12. Step-by-step derivation
      1. sin-atan39.5%

        \[\leadsto \left|\color{blue}{\frac{eh \cdot \frac{-\tan t}{ew}}{\sqrt{1 + \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \frac{-\tan t}{ew}\right)}}} \cdot \left(eh \cdot \sin t\right)\right| \]
      2. associate-*r/39.3%

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

        \[\leadsto \left|\frac{\color{blue}{\frac{eh}{ew} \cdot \left(-\tan t\right)}}{\sqrt{1 + \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \frac{-\tan t}{ew}\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
      4. hypot-1-def53.1%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\color{blue}{\mathsf{hypot}\left(1, eh \cdot \frac{-\tan t}{ew}\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
      5. associate-*r/53.2%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh \cdot \left(-\tan t\right)}{ew}}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
      6. associate-*l/53.0%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh}{ew} \cdot \left(-\tan t\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
    13. Applied egg-rr53.0%

      \[\leadsto \left|\color{blue}{\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \left(-\tan t\right)\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
    14. Step-by-step derivation
      1. associate-/l*52.8%

        \[\leadsto \left|\color{blue}{\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \left(-\tan t\right)\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
      2. hypot-undefine36.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\color{blue}{\sqrt{1 \cdot 1 + \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right) \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      3. *-commutative36.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)} \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      4. distribute-lft-neg-in36.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(-\tan t \cdot \frac{eh}{ew}\right)} \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      5. *-commutative36.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \left(-\tan t \cdot \frac{eh}{ew}\right) \cdot \color{blue}{\left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      6. distribute-lft-neg-in36.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \left(-\tan t \cdot \frac{eh}{ew}\right) \cdot \color{blue}{\left(-\tan t \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      7. sqr-neg36.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(\tan t \cdot \frac{eh}{ew}\right) \cdot \left(\tan t \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      8. hypot-undefine52.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\color{blue}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      9. associate-*r/52.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \color{blue}{\frac{\tan t \cdot eh}{ew}}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      10. *-commutative52.8%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \frac{\color{blue}{eh \cdot \tan t}}{ew}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      11. associate-*r/52.7%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \color{blue}{eh \cdot \frac{\tan t}{ew}}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
    15. Simplified52.7%

      \[\leadsto \left|\color{blue}{\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
    16. Taylor expanded in eh around -inf 82.8%

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

    if 9.0000000000000001e-92 < ew < 6.99999999999999982e105

    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. Step-by-step derivation
      1. add-sqr-sqrt82.7%

        \[\leadsto \left|\color{blue}{\sqrt{\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)} \cdot \sqrt{\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. fabs-sqr82.7%

        \[\leadsto \color{blue}{\sqrt{\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)} \cdot \sqrt{\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)}} \]
      3. add-sqr-sqrt83.4%

        \[\leadsto \color{blue}{\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)} \]
      4. sub-neg83.4%

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

      \[\leadsto \color{blue}{\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} + \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)} \]
    5. Step-by-step derivation
      1. associate-/l*83.4%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(ew, \frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}, \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)\right)} \]
      3. associate-*r*83.4%

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

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

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

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

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

Alternative 6: 76.8% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \cos t\right|\\ \mathbf{if}\;ew \leq -1.45 \cdot 10^{-88}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 7 \cdot 10^{-97}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \mathbf{elif}\;ew \leq 2.3 \cdot 10^{+105}:\\ \;\;\;\;ew \cdot \left(\cos t + \frac{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{ew}\right)\right)}{ew}\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.45e-88)
     t_1
     (if (<= ew 7e-97)
       (fabs (* eh (sin t)))
       (if (<= ew 2.3e+105)
         (*
          ew
          (+
           (cos t)
           (/ (* eh (* (sin t) (sin (atan (/ (* eh (tan t)) ew))))) ew)))
         t_1)))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((ew * cos(t)));
	double tmp;
	if (ew <= -1.45e-88) {
		tmp = t_1;
	} else if (ew <= 7e-97) {
		tmp = fabs((eh * sin(t)));
	} else if (ew <= 2.3e+105) {
		tmp = ew * (cos(t) + ((eh * (sin(t) * sin(atan(((eh * tan(t)) / ew))))) / ew));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = abs((ew * cos(t)))
    if (ew <= (-1.45d-88)) then
        tmp = t_1
    else if (ew <= 7d-97) then
        tmp = abs((eh * sin(t)))
    else if (ew <= 2.3d+105) then
        tmp = ew * (cos(t) + ((eh * (sin(t) * sin(atan(((eh * tan(t)) / ew))))) / ew))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((ew * Math.cos(t)));
	double tmp;
	if (ew <= -1.45e-88) {
		tmp = t_1;
	} else if (ew <= 7e-97) {
		tmp = Math.abs((eh * Math.sin(t)));
	} else if (ew <= 2.3e+105) {
		tmp = ew * (Math.cos(t) + ((eh * (Math.sin(t) * Math.sin(Math.atan(((eh * Math.tan(t)) / ew))))) / ew));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((ew * math.cos(t)))
	tmp = 0
	if ew <= -1.45e-88:
		tmp = t_1
	elif ew <= 7e-97:
		tmp = math.fabs((eh * math.sin(t)))
	elif ew <= 2.3e+105:
		tmp = ew * (math.cos(t) + ((eh * (math.sin(t) * math.sin(math.atan(((eh * math.tan(t)) / ew))))) / ew))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(ew * cos(t)))
	tmp = 0.0
	if (ew <= -1.45e-88)
		tmp = t_1;
	elseif (ew <= 7e-97)
		tmp = abs(Float64(eh * sin(t)));
	elseif (ew <= 2.3e+105)
		tmp = Float64(ew * Float64(cos(t) + Float64(Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(eh * tan(t)) / ew))))) / ew)));
	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.45e-88)
		tmp = t_1;
	elseif (ew <= 7e-97)
		tmp = abs((eh * sin(t)));
	elseif (ew <= 2.3e+105)
		tmp = ew * (cos(t) + ((eh * (sin(t) * sin(atan(((eh * tan(t)) / ew))))) / ew));
	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.45e-88], t$95$1, If[LessEqual[ew, 7e-97], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[ew, 2.3e+105], N[(ew * N[(N[Cos[t], $MachinePrecision] + N[(N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ew), $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.45 \cdot 10^{-88}:\\
\;\;\;\;t\_1\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if ew < -1.4500000000000001e-88 or 2.2999999999999998e105 < 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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.7%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define99.7%

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

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

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

    if -1.4500000000000001e-88 < ew < 7.00000000000000038e-97

    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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.8%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define98.5%

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

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

      \[\leadsto \left|\color{blue}{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)}\right| \]
    10. Step-by-step derivation
      1. mul-1-neg77.2%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(-\frac{eh \cdot \tan t}{ew}\right)}\right)\right| \]
      2. associate-/l*77.2%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-\color{blue}{eh \cdot \frac{\tan t}{ew}}\right)\right)\right| \]
      3. distribute-lft-neg-out77.2%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}\right)\right| \]
      4. associate-*l*77.2%

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

        \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right| \]
    11. Simplified77.2%

      \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right| \]
    12. Step-by-step derivation
      1. sin-atan35.1%

        \[\leadsto \left|\color{blue}{\frac{eh \cdot \frac{-\tan t}{ew}}{\sqrt{1 + \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \frac{-\tan t}{ew}\right)}}} \cdot \left(eh \cdot \sin t\right)\right| \]
      2. associate-*r/34.9%

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

        \[\leadsto \left|\frac{\color{blue}{\frac{eh}{ew} \cdot \left(-\tan t\right)}}{\sqrt{1 + \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \frac{-\tan t}{ew}\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
      4. hypot-1-def49.7%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\color{blue}{\mathsf{hypot}\left(1, eh \cdot \frac{-\tan t}{ew}\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
      5. associate-*r/49.8%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh \cdot \left(-\tan t\right)}{ew}}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
      6. associate-*l/49.7%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh}{ew} \cdot \left(-\tan t\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
    13. Applied egg-rr49.7%

      \[\leadsto \left|\color{blue}{\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \left(-\tan t\right)\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
    14. Step-by-step derivation
      1. associate-/l*49.5%

        \[\leadsto \left|\color{blue}{\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \left(-\tan t\right)\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
      2. hypot-undefine32.1%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\color{blue}{\sqrt{1 \cdot 1 + \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right) \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      3. *-commutative32.1%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)} \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      4. distribute-lft-neg-in32.1%

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

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \left(-\tan t \cdot \frac{eh}{ew}\right) \cdot \color{blue}{\left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      6. distribute-lft-neg-in32.1%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \left(-\tan t \cdot \frac{eh}{ew}\right) \cdot \color{blue}{\left(-\tan t \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      7. sqr-neg32.1%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(\tan t \cdot \frac{eh}{ew}\right) \cdot \left(\tan t \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      8. hypot-undefine49.5%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\color{blue}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      9. associate-*r/49.4%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \color{blue}{\frac{\tan t \cdot eh}{ew}}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      10. *-commutative49.4%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \frac{\color{blue}{eh \cdot \tan t}}{ew}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      11. associate-*r/49.4%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \color{blue}{eh \cdot \frac{\tan t}{ew}}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
    15. Simplified49.4%

      \[\leadsto \left|\color{blue}{\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
    16. Taylor expanded in eh around -inf 77.4%

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

    if 7.00000000000000038e-97 < ew < 2.2999999999999998e105

    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. Step-by-step derivation
      1. add-sqr-sqrt82.7%

        \[\leadsto \left|\color{blue}{\sqrt{\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)} \cdot \sqrt{\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. fabs-sqr82.7%

        \[\leadsto \color{blue}{\sqrt{\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)} \cdot \sqrt{\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)}} \]
      3. add-sqr-sqrt83.4%

        \[\leadsto \color{blue}{\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)} \]
      4. sub-neg83.4%

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

      \[\leadsto \color{blue}{\frac{ew \cdot \cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)} + \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)} \]
    5. Step-by-step derivation
      1. associate-/l*83.4%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(ew, \frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}, \sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)\right)} \]
      3. associate-*r*83.4%

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

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

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

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

Alternative 7: 75.5% accurate, 4.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -2.9 \cdot 10^{-90} \lor \neg \left(ew \leq 8.4 \cdot 10^{-81}\right):\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (or (<= ew -2.9e-90) (not (<= ew 8.4e-81)))
   (fabs (* ew (cos t)))
   (fabs (* eh (sin t)))))
double code(double eh, double ew, double t) {
	double tmp;
	if ((ew <= -2.9e-90) || !(ew <= 8.4e-81)) {
		tmp = fabs((ew * cos(t)));
	} else {
		tmp = fabs((eh * sin(t)));
	}
	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 <= (-2.9d-90)) .or. (.not. (ew <= 8.4d-81))) then
        tmp = abs((ew * cos(t)))
    else
        tmp = abs((eh * sin(t)))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if ((ew <= -2.9e-90) || !(ew <= 8.4e-81)) {
		tmp = Math.abs((ew * Math.cos(t)));
	} else {
		tmp = Math.abs((eh * Math.sin(t)));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if (ew <= -2.9e-90) or not (ew <= 8.4e-81):
		tmp = math.fabs((ew * math.cos(t)))
	else:
		tmp = math.fabs((eh * math.sin(t)))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if ((ew <= -2.9e-90) || !(ew <= 8.4e-81))
		tmp = abs(Float64(ew * cos(t)));
	else
		tmp = abs(Float64(eh * sin(t)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if ((ew <= -2.9e-90) || ~((ew <= 8.4e-81)))
		tmp = abs((ew * cos(t)));
	else
		tmp = abs((eh * sin(t)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.9e-90], N[Not[LessEqual[ew, 8.4e-81]], $MachinePrecision]], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.9 \cdot 10^{-90} \lor \neg \left(ew \leq 8.4 \cdot 10^{-81}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

\mathbf{else}:\\
\;\;\;\;\left|eh \cdot \sin t\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.89999999999999983e-90 or 8.3999999999999997e-81 < 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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.8%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define99.7%

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

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

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

    if -2.89999999999999983e-90 < ew < 8.3999999999999997e-81

    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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.8%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define98.5%

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

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

      \[\leadsto \left|\color{blue}{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)}\right| \]
    10. Step-by-step derivation
      1. mul-1-neg77.2%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(-\frac{eh \cdot \tan t}{ew}\right)}\right)\right| \]
      2. associate-/l*77.2%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-\color{blue}{eh \cdot \frac{\tan t}{ew}}\right)\right)\right| \]
      3. distribute-lft-neg-out77.2%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}\right)\right| \]
      4. associate-*l*77.2%

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

        \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right| \]
    11. Simplified77.2%

      \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right| \]
    12. Step-by-step derivation
      1. sin-atan35.1%

        \[\leadsto \left|\color{blue}{\frac{eh \cdot \frac{-\tan t}{ew}}{\sqrt{1 + \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \frac{-\tan t}{ew}\right)}}} \cdot \left(eh \cdot \sin t\right)\right| \]
      2. associate-*r/34.9%

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

        \[\leadsto \left|\frac{\color{blue}{\frac{eh}{ew} \cdot \left(-\tan t\right)}}{\sqrt{1 + \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \frac{-\tan t}{ew}\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
      4. hypot-1-def49.7%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\color{blue}{\mathsf{hypot}\left(1, eh \cdot \frac{-\tan t}{ew}\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
      5. associate-*r/49.8%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh \cdot \left(-\tan t\right)}{ew}}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
      6. associate-*l/49.7%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh}{ew} \cdot \left(-\tan t\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
    13. Applied egg-rr49.7%

      \[\leadsto \left|\color{blue}{\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \left(-\tan t\right)\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
    14. Step-by-step derivation
      1. associate-/l*49.5%

        \[\leadsto \left|\color{blue}{\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \left(-\tan t\right)\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
      2. hypot-undefine32.1%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\color{blue}{\sqrt{1 \cdot 1 + \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right) \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      3. *-commutative32.1%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)} \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      4. distribute-lft-neg-in32.1%

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

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \left(-\tan t \cdot \frac{eh}{ew}\right) \cdot \color{blue}{\left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      6. distribute-lft-neg-in32.1%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \left(-\tan t \cdot \frac{eh}{ew}\right) \cdot \color{blue}{\left(-\tan t \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      7. sqr-neg32.1%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(\tan t \cdot \frac{eh}{ew}\right) \cdot \left(\tan t \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      8. hypot-undefine49.5%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\color{blue}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      9. associate-*r/49.4%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \color{blue}{\frac{\tan t \cdot eh}{ew}}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      10. *-commutative49.4%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \frac{\color{blue}{eh \cdot \tan t}}{ew}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      11. associate-*r/49.4%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \color{blue}{eh \cdot \frac{\tan t}{ew}}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
    15. Simplified49.4%

      \[\leadsto \left|\color{blue}{\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
    16. Taylor expanded in eh around -inf 77.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -2.9 \cdot 10^{-90} \lor \neg \left(ew \leq 8.4 \cdot 10^{-81}\right):\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 62.4% accurate, 4.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -4.2 \cdot 10^{-52}:\\
\;\;\;\;ew \cdot \left(-\cos t\right)\\

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

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


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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(ew \cdot \cos t\right)} \]
    5. Step-by-step derivation
      1. associate-*r*68.4%

        \[\leadsto \color{blue}{\left(-1 \cdot ew\right) \cdot \cos t} \]
      2. mul-1-neg68.4%

        \[\leadsto \color{blue}{\left(-ew\right)} \cdot \cos t \]
    6. Simplified68.4%

      \[\leadsto \color{blue}{\left(-ew\right) \cdot \cos t} \]

    if -4.1999999999999997e-52 < ew < 1.70000000000000008e-57

    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. Step-by-step derivation
      1. fabs-sub99.7%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.7%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define98.6%

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

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

      \[\leadsto \left|\color{blue}{eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\right)}\right| \]
    10. Step-by-step derivation
      1. mul-1-neg74.4%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(-\frac{eh \cdot \tan t}{ew}\right)}\right)\right| \]
      2. associate-/l*74.4%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-\color{blue}{eh \cdot \frac{\tan t}{ew}}\right)\right)\right| \]
      3. distribute-lft-neg-out74.4%

        \[\leadsto \left|eh \cdot \left(\sin t \cdot \sin \tan^{-1} \color{blue}{\left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}\right)\right| \]
      4. associate-*l*74.4%

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

        \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right| \]
    11. Simplified74.4%

      \[\leadsto \left|\color{blue}{\sin \tan^{-1} \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \sin t\right)}\right| \]
    12. Step-by-step derivation
      1. sin-atan33.8%

        \[\leadsto \left|\color{blue}{\frac{eh \cdot \frac{-\tan t}{ew}}{\sqrt{1 + \left(eh \cdot \frac{-\tan t}{ew}\right) \cdot \left(eh \cdot \frac{-\tan t}{ew}\right)}}} \cdot \left(eh \cdot \sin t\right)\right| \]
      2. associate-*r/33.5%

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

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

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\color{blue}{\mathsf{hypot}\left(1, eh \cdot \frac{-\tan t}{ew}\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
      5. associate-*r/48.7%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh \cdot \left(-\tan t\right)}{ew}}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
      6. associate-*l/48.6%

        \[\leadsto \left|\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \color{blue}{\frac{eh}{ew} \cdot \left(-\tan t\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
    13. Applied egg-rr48.6%

      \[\leadsto \left|\color{blue}{\frac{\frac{eh}{ew} \cdot \left(-\tan t\right)}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \left(-\tan t\right)\right)}} \cdot \left(eh \cdot \sin t\right)\right| \]
    14. Step-by-step derivation
      1. associate-/l*48.4%

        \[\leadsto \left|\color{blue}{\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \left(-\tan t\right)\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
      2. hypot-undefine31.0%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\color{blue}{\sqrt{1 \cdot 1 + \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right) \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      3. *-commutative31.0%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)} \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      4. distribute-lft-neg-in31.0%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \color{blue}{\left(-\tan t \cdot \frac{eh}{ew}\right)} \cdot \left(\frac{eh}{ew} \cdot \left(-\tan t\right)\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      5. *-commutative31.0%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \left(-\tan t \cdot \frac{eh}{ew}\right) \cdot \color{blue}{\left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      6. distribute-lft-neg-in31.0%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\sqrt{1 \cdot 1 + \left(-\tan t \cdot \frac{eh}{ew}\right) \cdot \color{blue}{\left(-\tan t \cdot \frac{eh}{ew}\right)}}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      7. sqr-neg31.0%

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

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\color{blue}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      9. associate-*r/48.3%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \color{blue}{\frac{\tan t \cdot eh}{ew}}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      10. *-commutative48.3%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \frac{\color{blue}{eh \cdot \tan t}}{ew}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
      11. associate-*r/48.3%

        \[\leadsto \left|\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, \color{blue}{eh \cdot \frac{\tan t}{ew}}\right)}\right) \cdot \left(eh \cdot \sin t\right)\right| \]
    15. Simplified48.3%

      \[\leadsto \left|\color{blue}{\left(\frac{eh}{ew} \cdot \frac{-\tan t}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}\right)} \cdot \left(eh \cdot \sin t\right)\right| \]
    16. Taylor expanded in eh around -inf 74.6%

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

    if 1.70000000000000008e-57 < 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. Step-by-step derivation
      1. fabs-sub99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.7%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define99.7%

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

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

      \[\leadsto \left|\color{blue}{ew}\right| \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -4.2 \cdot 10^{-52}:\\ \;\;\;\;ew \cdot \left(-\cos t\right)\\ \mathbf{elif}\;ew \leq 1.7 \cdot 10^{-57}:\\ \;\;\;\;\left|eh \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 50.0% accurate, 8.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1 \lor \neg \left(t \leq 0.00135\right):\\ \;\;\;\;ew \cdot \left(-\cos t\right)\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (or (<= t -1.0) (not (<= t 0.00135))) (* ew (- (cos t))) (fabs ew)))
double code(double eh, double ew, double t) {
	double tmp;
	if ((t <= -1.0) || !(t <= 0.00135)) {
		tmp = ew * -cos(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 ((t <= (-1.0d0)) .or. (.not. (t <= 0.00135d0))) then
        tmp = ew * -cos(t)
    else
        tmp = abs(ew)
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if ((t <= -1.0) || !(t <= 0.00135)) {
		tmp = ew * -Math.cos(t);
	} else {
		tmp = Math.abs(ew);
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if (t <= -1.0) or not (t <= 0.00135):
		tmp = ew * -math.cos(t)
	else:
		tmp = math.fabs(ew)
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if ((t <= -1.0) || !(t <= 0.00135))
		tmp = Float64(ew * Float64(-cos(t)));
	else
		tmp = abs(ew);
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if ((t <= -1.0) || ~((t <= 0.00135)))
		tmp = ew * -cos(t);
	else
		tmp = abs(ew);
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -1.0], N[Not[LessEqual[t, 0.00135]], $MachinePrecision]], N[(ew * (-N[Cos[t], $MachinePrecision])), $MachinePrecision], N[Abs[ew], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \lor \neg \left(t \leq 0.00135\right):\\
\;\;\;\;ew \cdot \left(-\cos t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1 or 0.0013500000000000001 < t

    1. Initial program 99.7%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(ew \cdot \cos t\right)} \]
    5. Step-by-step derivation
      1. associate-*r*25.2%

        \[\leadsto \color{blue}{\left(-1 \cdot ew\right) \cdot \cos t} \]
      2. mul-1-neg25.2%

        \[\leadsto \color{blue}{\left(-ew\right)} \cdot \cos t \]
    6. Simplified25.2%

      \[\leadsto \color{blue}{\left(-ew\right) \cdot \cos t} \]

    if -1 < t < 0.0013500000000000001

    1. Initial program 100.0%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Step-by-step derivation
      1. fabs-sub100.0%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. expm1-log1p-u99.9%

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
    7. Step-by-step derivation
      1. expm1-define99.0%

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

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

      \[\leadsto \left|\color{blue}{ew}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1 \lor \neg \left(t \leq 0.00135\right):\\ \;\;\;\;ew \cdot \left(-\cos t\right)\\ \mathbf{else}:\\ \;\;\;\;\left|ew\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 43.0% accurate, 9.1× speedup?

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

\\
\left|ew\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. Step-by-step derivation
    1. fabs-sub99.8%

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(ew, -\cos t \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)}\right| \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right|} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. expm1-log1p-u99.8%

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{e^{\mathsf{log1p}\left(\frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)} - 1}, eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
  7. Step-by-step derivation
    1. expm1-define99.2%

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

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

    \[\leadsto \left|\color{blue}{ew}\right| \]
  10. Add Preprocessing

Alternative 11: 22.4% accurate, 460.5× speedup?

\[\begin{array}{l} \\ -ew \end{array} \]
(FPCore (eh ew t) :precision binary64 (- ew))
double code(double eh, double ew, double t) {
	return -ew;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = -ew
end function
public static double code(double eh, double ew, double t) {
	return -ew;
}
def code(eh, ew, t):
	return -ew
function code(eh, ew, t)
	return Float64(-ew)
end
function tmp = code(eh, ew, t)
	tmp = -ew;
end
code[eh_, ew_, t_] := (-ew)
\begin{array}{l}

\\
-ew
\end{array}
Derivation
  1. Initial program 99.8%

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

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

    \[\leadsto \color{blue}{-1 \cdot ew} \]
  5. Step-by-step derivation
    1. mul-1-neg21.2%

      \[\leadsto \color{blue}{-ew} \]
  6. Simplified21.2%

    \[\leadsto \color{blue}{-ew} \]
  7. Add Preprocessing

Reproduce

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