Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 28.1s
Alternatives: 9
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \left|\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)}\right| \]
    2. distribute-rgt-neg-in99.8%

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

      \[\leadsto \left|\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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right| \]
  3. Simplified99.8%

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

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

Alternative 2: 99.7% accurate, 1.1× speedup?

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

\\
\left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\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. sub-neg99.8%

      \[\leadsto \left|\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)}\right| \]
    2. distribute-rgt-neg-in99.8%

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

      \[\leadsto \left|\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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right| \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\left|\cos t \cdot \left(ew \cdot \cos \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right|} \]
  4. Step-by-step derivation
    1. expm1-log1p-u74.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.8% accurate, 1.1× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. 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-def99.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(-\tan t\right) \cdot \frac{eh}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right|} \]
  4. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

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

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

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
  6. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
  8. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

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

      \[\leadsto \left|ew \cdot \color{blue}{\frac{1 \cdot \left(-\cos t\right)}{\mathsf{hypot}\left(1, \frac{eh}{ew} \cdot \tan t\right)}} + eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right| \]
    3. *-un-lft-identity99.8%

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

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

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

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

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

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

Alternative 4: 98.5% accurate, 1.5× speedup?

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

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

      \[\leadsto \left|\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)}\right| \]
    2. distribute-rgt-neg-in99.8%

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

      \[\leadsto \left|\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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right| \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\left|\cos t \cdot \left(ew \cdot \cos \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right|} \]
  4. Step-by-step derivation
    1. add-cube-cbrt98.7%

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

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

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

    \[\leadsto \left|\color{blue}{\left(\cos t \cdot ew\right) \cdot {1}^{0.3333333333333333}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right| \]
  7. Step-by-step derivation
    1. pow-base-198.5%

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

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

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

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

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

Alternative 5: 73.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\cos t \cdot ew\right|\\ t_2 := \left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right|\\ \mathbf{if}\;t \leq -5.6 \cdot 10^{+178}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -1.66 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 18500000:\\ \;\;\;\;\left|\left(t \cdot eh\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{-\tan t}{ew}\right) - ew\right|\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+68}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* (cos t) ew)))
        (t_2 (fabs (* (sin t) (* eh (sin (atan (* (tan t) (/ (- eh) ew)))))))))
   (if (<= t -5.6e+178)
     t_2
     (if (<= t -1.66e-7)
       t_1
       (if (<= t 18500000.0)
         (fabs (- (* (* t eh) (sin (atan (* eh (/ (- (tan t)) ew))))) ew))
         (if (<= t 3.6e+68) t_1 t_2))))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((cos(t) * ew));
	double t_2 = fabs((sin(t) * (eh * sin(atan((tan(t) * (-eh / ew)))))));
	double tmp;
	if (t <= -5.6e+178) {
		tmp = t_2;
	} else if (t <= -1.66e-7) {
		tmp = t_1;
	} else if (t <= 18500000.0) {
		tmp = fabs((((t * eh) * sin(atan((eh * (-tan(t) / ew))))) - ew));
	} else if (t <= 3.6e+68) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = abs((cos(t) * ew))
    t_2 = abs((sin(t) * (eh * sin(atan((tan(t) * (-eh / ew)))))))
    if (t <= (-5.6d+178)) then
        tmp = t_2
    else if (t <= (-1.66d-7)) then
        tmp = t_1
    else if (t <= 18500000.0d0) then
        tmp = abs((((t * eh) * sin(atan((eh * (-tan(t) / ew))))) - ew))
    else if (t <= 3.6d+68) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((Math.cos(t) * ew));
	double t_2 = Math.abs((Math.sin(t) * (eh * Math.sin(Math.atan((Math.tan(t) * (-eh / ew)))))));
	double tmp;
	if (t <= -5.6e+178) {
		tmp = t_2;
	} else if (t <= -1.66e-7) {
		tmp = t_1;
	} else if (t <= 18500000.0) {
		tmp = Math.abs((((t * eh) * Math.sin(Math.atan((eh * (-Math.tan(t) / ew))))) - ew));
	} else if (t <= 3.6e+68) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((math.cos(t) * ew))
	t_2 = math.fabs((math.sin(t) * (eh * math.sin(math.atan((math.tan(t) * (-eh / ew)))))))
	tmp = 0
	if t <= -5.6e+178:
		tmp = t_2
	elif t <= -1.66e-7:
		tmp = t_1
	elif t <= 18500000.0:
		tmp = math.fabs((((t * eh) * math.sin(math.atan((eh * (-math.tan(t) / ew))))) - ew))
	elif t <= 3.6e+68:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(cos(t) * ew))
	t_2 = abs(Float64(sin(t) * Float64(eh * sin(atan(Float64(tan(t) * Float64(Float64(-eh) / ew)))))))
	tmp = 0.0
	if (t <= -5.6e+178)
		tmp = t_2;
	elseif (t <= -1.66e-7)
		tmp = t_1;
	elseif (t <= 18500000.0)
		tmp = abs(Float64(Float64(Float64(t * eh) * sin(atan(Float64(eh * Float64(Float64(-tan(t)) / ew))))) - ew));
	elseif (t <= 3.6e+68)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((cos(t) * ew));
	t_2 = abs((sin(t) * (eh * sin(atan((tan(t) * (-eh / ew)))))));
	tmp = 0.0;
	if (t <= -5.6e+178)
		tmp = t_2;
	elseif (t <= -1.66e-7)
		tmp = t_1;
	elseif (t <= 18500000.0)
		tmp = abs((((t * eh) * sin(atan((eh * (-tan(t) / ew))))) - ew));
	elseif (t <= 3.6e+68)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[Sin[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[N[(N[Tan[t], $MachinePrecision] * N[((-eh) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -5.6e+178], t$95$2, If[LessEqual[t, -1.66e-7], t$95$1, If[LessEqual[t, 18500000.0], N[Abs[N[(N[(N[(t * eh), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh * N[((-N[Tan[t], $MachinePrecision]) / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - ew), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 3.6e+68], t$95$1, t$95$2]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|\cos t \cdot ew\right|\\
t_2 := \left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right|\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{+178}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq -1.66 \cdot 10^{-7}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 3.6 \cdot 10^{+68}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.59999999999999986e178 or 3.5999999999999999e68 < t

    1. Initial program 99.6%

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

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

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

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

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

        \[\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-def99.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    6. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    8. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

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

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

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

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

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

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

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

    if -5.59999999999999986e178 < t < -1.66000000000000004e-7 or 1.85e7 < t < 3.5999999999999999e68

    1. Initial program 99.6%

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

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

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

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

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

        \[\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-def99.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    6. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    8. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\left(-\cos t\right)} \cdot ew\right| \]
    12. Simplified70.8%

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

    if -1.66000000000000004e-7 < t < 1.85e7

    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-def100.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. Simplified100.0%

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

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

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

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\frac{eh \cdot \color{blue}{\left(\sqrt{\tan t} \cdot \sqrt{\tan t}\right)}}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
      7. add-sqr-sqrt100.0%

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    6. Step-by-step derivation
      1. associate-*r/100.0%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    8. Step-by-step derivation
      1. associate-*r/100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.6 \cdot 10^{+178}:\\ \;\;\;\;\left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right|\\ \mathbf{elif}\;t \leq -1.66 \cdot 10^{-7}:\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \mathbf{elif}\;t \leq 18500000:\\ \;\;\;\;\left|\left(t \cdot eh\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{-\tan t}{ew}\right) - ew\right|\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+68}:\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\sin t \cdot \left(eh \cdot \sin \tan^{-1} \left(\tan t \cdot \frac{-eh}{ew}\right)\right)\right|\\ \end{array} \]

Alternative 6: 87.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -3 \cdot 10^{-20} \lor \neg \left(eh \leq 1.95 \cdot 10^{-32}\right):\\
\;\;\;\;\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -3.00000000000000029e-20 or 1.9500000000000001e-32 < 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. sub-neg99.8%

        \[\leadsto \left|\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)}\right| \]
      2. distribute-rgt-neg-in99.8%

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

        \[\leadsto \left|\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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)}\right| \]
    3. Simplified99.8%

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

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

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

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

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

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

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

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

    if -3.00000000000000029e-20 < eh < 1.9500000000000001e-32

    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-def99.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(-\tan t\right) \cdot \frac{eh}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right|} \]
    4. Step-by-step derivation
      1. associate-*r/99.7%

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    6. Step-by-step derivation
      1. associate-*r/99.7%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    8. Step-by-step derivation
      1. associate-*r/99.8%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\left(-\cos t\right)} \cdot ew\right| \]
    12. Simplified85.3%

      \[\leadsto \left|\color{blue}{\left(-\cos t\right) \cdot ew}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -3 \cdot 10^{-20} \lor \neg \left(eh \leq 1.95 \cdot 10^{-32}\right):\\ \;\;\;\;\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \end{array} \]

Alternative 7: 74.2% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.66 \cdot 10^{-7} \lor \neg \left(t \leq 18500000\right):\\
\;\;\;\;\left|\cos t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.66000000000000004e-7 or 1.85e7 < t

    1. Initial program 99.6%

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

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

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

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

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

        \[\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-def99.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    6. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    8. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\left(-\cos t\right)} \cdot ew\right| \]
    12. Simplified51.0%

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

    if -1.66000000000000004e-7 < t < 1.85e7

    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-def100.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. Simplified100.0%

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

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

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

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \left(\frac{eh \cdot \color{blue}{\left(\sqrt{\tan t} \cdot \sqrt{\tan t}\right)}}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
      7. add-sqr-sqrt100.0%

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    6. Step-by-step derivation
      1. associate-*r/100.0%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
    8. Step-by-step derivation
      1. associate-*r/100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.66 \cdot 10^{-7} \lor \neg \left(t \leq 18500000\right):\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(t \cdot eh\right) \cdot \sin \tan^{-1} \left(eh \cdot \frac{-\tan t}{ew}\right) - ew\right|\\ \end{array} \]

Alternative 8: 62.5% accurate, 4.5× speedup?

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

\\
\left|\cos t \cdot 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-def99.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(-\tan t\right) \cdot \frac{eh}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right|} \]
  4. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

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

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

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
  6. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
  8. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\left(-\cos t\right)} \cdot ew\right| \]
  12. Simplified58.0%

    \[\leadsto \left|\color{blue}{\left(-\cos t\right) \cdot ew}\right| \]
  13. Final simplification58.0%

    \[\leadsto \left|\cos t \cdot ew\right| \]

Alternative 9: 42.7% 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-def99.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(-\tan t\right) \cdot \frac{eh}{ew}\right) \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right|} \]
  4. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

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

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

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \cos \tan^{-1} \color{blue}{\left(\frac{eh \cdot \tan t}{ew}\right)} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
  6. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

    \[\leadsto \left|\mathsf{fma}\left(ew, \color{blue}{\frac{1}{\mathsf{hypot}\left(1, eh \cdot \frac{\tan t}{ew}\right)}} \cdot \left(-\cos t\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-\tan t\right) \cdot \frac{eh}{ew}\right)\right)\right)\right| \]
  8. Step-by-step derivation
    1. associate-*r/99.8%

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

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

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

    \[\leadsto \left|\color{blue}{-1 \cdot ew}\right| \]
  11. Step-by-step derivation
    1. mul-1-neg38.8%

      \[\leadsto \left|\color{blue}{-ew}\right| \]
  12. Simplified38.8%

    \[\leadsto \left|\color{blue}{-ew}\right| \]
  13. Final simplification38.8%

    \[\leadsto \left|ew\right| \]

Reproduce

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