Example 2 from Robby

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

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.1× speedup?

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

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

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

    \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
  5. Step-by-step derivation
    1. add-cbrt-cube59.3%

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

      \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
  6. Applied egg-rr59.6%

    \[\leadsto \left|\color{blue}{\sqrt[3]{{\left(ew \cdot \frac{\cos t}{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}\right)}^{3}}} - \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. rem-cbrt-cube99.8%

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

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

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

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

Alternative 2: 99.1% accurate, 1.3× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. 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| \]
    4. associate-*l*99.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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
    5. associate-/l*99.8%

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

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

    \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
  5. Applied egg-rr98.1%

    \[\leadsto \left|\color{blue}{\frac{ew \cdot \left(\cos \left(t + \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right) + \cos \left(t + \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)\right)}{2}} - \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. associate-/l*98.4%

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

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

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

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

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

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

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

Alternative 3: 98.6% 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| \]
    4. associate-*l*99.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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
    5. associate-/l*99.8%

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

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

    \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
  5. Step-by-step derivation
    1. add-cbrt-cube59.3%

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

      \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
  6. Applied egg-rr59.6%

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

    \[\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. Final simplification98.2%

    \[\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| \]
  9. Add Preprocessing

Alternative 4: 83.5% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_1 := eh \cdot \sin t\\
\mathbf{if}\;eh \leq -2.65 \cdot 10^{-17}:\\
\;\;\;\;\left|ew - t\_1 \cdot \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{ew}\right)\right|\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if eh < -2.6499999999999999e-17

    1. Initial program 99.9%

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

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

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

        \[\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| \]
      4. associate-*l*99.9%

        \[\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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
      5. associate-/l*99.9%

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

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

      \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
    5. Step-by-step derivation
      1. add-cbrt-cube70.4%

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

        \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
    6. Applied egg-rr70.4%

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

      \[\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. Taylor expanded in t around 0 90.6%

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

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

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

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

    if -2.6499999999999999e-17 < eh < 6.6e-111

    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| \]
      4. associate-*l*99.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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
      5. associate-/l*99.8%

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

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

      \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
    5. Applied egg-rr98.7%

      \[\leadsto \left|\color{blue}{\frac{ew \cdot \left(\cos \left(t + \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right) + \cos \left(t + \tan^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)\right)}{2}} - \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. associate-/l*98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.6e-111 < 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| \]
      4. associate-*l*99.9%

        \[\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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
      5. associate-/l*99.9%

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

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

      \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
    5. Step-by-step derivation
      1. add-cbrt-cube67.1%

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

        \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
    6. Applied egg-rr68.1%

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

      \[\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. Step-by-step derivation
      1. expm1-log1p-u65.9%

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

        \[\leadsto \left|ew - \color{blue}{\left(e^{\mathsf{log1p}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)} - 1\right)}\right| \]
      3. associate-/r/57.6%

        \[\leadsto \left|ew - \left(e^{\mathsf{log1p}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{-eh}{ew} \cdot \tan t\right)}\right)} - 1\right)\right| \]
      4. add-sqr-sqrt0.0%

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

        \[\leadsto \left|ew - \left(e^{\mathsf{log1p}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\color{blue}{\sqrt{\left(-eh\right) \cdot \left(-eh\right)}}}{ew} \cdot \tan t\right)\right)} - 1\right)\right| \]
      6. sqr-neg47.1%

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

        \[\leadsto \left|ew - \left(e^{\mathsf{log1p}\left(\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\color{blue}{\sqrt{eh} \cdot \sqrt{eh}}}{ew} \cdot \tan t\right)\right)} - 1\right)\right| \]
      8. add-sqr-sqrt48.2%

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

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

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

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

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

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

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

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

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

Alternative 5: 72.9% accurate, 2.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left|ew - \left(t \cdot eh\right) \cdot t\_1\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -0.0580000000000000029 or 1.5000000000000001e64 < 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. sub-neg99.6%

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

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

        \[\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| \]
      4. associate-*l*99.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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
      5. associate-/l*99.7%

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

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

      \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
    5. Step-by-step derivation
      1. add-cbrt-cube66.5%

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

        \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
    6. Applied egg-rr67.3%

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

      \[\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. Taylor expanded in t around 0 57.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0580000000000000029 < t < 1.5000000000000001e64

    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. sub-neg100.0%

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

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

        \[\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| \]
      4. associate-*l*100.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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
      5. associate-/l*100.0%

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

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

      \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
    5. Step-by-step derivation
      1. add-cbrt-cube52.9%

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

        \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
    6. Applied egg-rr52.9%

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

      \[\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. Taylor expanded in t around 0 92.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.2% accurate, 2.2× speedup?

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

\\
\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{t \cdot \left(-eh\right)}{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. 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| \]
    4. associate-*l*99.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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
    5. associate-/l*99.8%

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

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

    \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
  5. Step-by-step derivation
    1. add-cbrt-cube59.3%

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

      \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
  6. Applied egg-rr59.6%

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

    \[\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. Taylor expanded in t around 0 76.3%

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

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

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

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

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

Alternative 7: 79.2% accurate, 2.2× speedup?

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

\\
\left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(t \cdot \frac{eh}{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. 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| \]
    4. associate-*l*99.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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
    5. associate-/l*99.8%

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

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

    \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
  5. Step-by-step derivation
    1. add-cbrt-cube59.3%

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

      \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
  6. Applied egg-rr59.6%

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

    \[\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. Taylor expanded in t around 0 76.3%

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

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

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

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

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

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

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

      \[\leadsto \left|ew - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\color{blue}{\sqrt{eh \cdot t} \cdot \sqrt{eh \cdot t}}}{ew}\right)\right| \]
    5. add-sqr-sqrt76.3%

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

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

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

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

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

Alternative 8: 54.7% accurate, 3.0× speedup?

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

\\
\left|ew - \left(t \cdot eh\right) \cdot \sin \tan^{-1} \left(t \cdot \frac{-eh}{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. 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| \]
    4. associate-*l*99.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 \left(-\sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right| \]
    5. associate-/l*99.8%

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

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

    \[\leadsto \color{blue}{\left|ew \cdot \left(\cos t \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. Add Preprocessing
  5. Step-by-step derivation
    1. add-cbrt-cube59.3%

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

      \[\leadsto \left|\sqrt[3]{\color{blue}{{\left(ew \cdot \left(\cos t \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| \]
  6. Applied egg-rr59.6%

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

    \[\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. Taylor expanded in t around 0 76.3%

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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