Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 19.9s
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|ew \cdot \left(\cos t \cdot \cos t_1\right) - eh \cdot \left(\sin t \cdot \sin t_1\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (- eh) (/ ew (tan t))))))
   (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 / (ew / tan(t))));
	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 / (ew / tan(t))))
    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 / (ew / Math.tan(t))));
	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 / (ew / math.tan(t))))
	return math.fabs(((ew * (math.cos(t) * math.cos(t_1))) - (eh * (math.sin(t) * math.sin(t_1)))))
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(-eh) / Float64(ew / tan(t))))
	return abs(Float64(Float64(ew * Float64(cos(t) * cos(t_1))) - Float64(eh * Float64(sin(t) * sin(t_1)))))
end
function tmp = code(eh, ew, t)
	t_1 = atan((-eh / (ew / tan(t))));
	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[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(ew * N[(N[Cos[t], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\\
\left|ew \cdot \left(\cos t \cdot \cos t_1\right) - eh \cdot \left(\sin t \cdot \sin 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. fabs-neg99.8%

      \[\leadsto \color{blue}{\left|-\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)\right|} \]
    2. sub0-neg99.8%

      \[\leadsto \left|\color{blue}{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)}\right| \]
    3. sub-neg99.8%

      \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
    4. +-commutative99.8%

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

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

    \[\leadsto \left|ew \cdot \left(\cos t \cdot \cos \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right) - eh \cdot \left(\sin t \cdot \sin \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}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\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(eh * Float64(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[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-eh) / N[(ew / N[Tan[t], $MachinePrecision]), $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}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|
\end{array}
Derivation
  1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\left|-\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)\right|} \]
    2. sub0-neg99.8%

      \[\leadsto \left|\color{blue}{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)}\right| \]
    3. sub-neg99.8%

      \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
    4. +-commutative99.8%

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

      \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
  4. Step-by-step derivation
    1. expm1-log1p-u75.0%

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

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

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

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

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

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

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

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

Alternative 3: 98.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \left|\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\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 (/ (- t) (/ ew eh)))))))))
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((-t / (ew / eh))))))));
}
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((-t / (ew / eh))))))));
}
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((-t / (ew / eh))))))))
function code(eh, ew, t)
	return abs(Float64(Float64(ew / Float64(hypot(1.0, Float64(tan(t) * Float64(eh / ew))) / cos(t))) - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(-t) / Float64(ew / eh))))))))
end
function tmp = code(eh, ew, t)
	tmp = abs(((ew / (hypot(1.0, (tan(t) * (eh / ew))) / cos(t))) - (eh * (sin(t) * sin(atan((-t / (ew / eh))))))));
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[(eh * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[((-t) / N[(ew / eh), $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}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)\right|
\end{array}
Derivation
  1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\left|-\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)\right|} \]
    2. sub0-neg99.8%

      \[\leadsto \left|\color{blue}{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)}\right| \]
    3. sub-neg99.8%

      \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
    4. +-commutative99.8%

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

      \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
  4. Step-by-step derivation
    1. expm1-log1p-u75.0%

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\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}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right| \]
  8. Taylor expanded in t around 0 99.3%

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

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

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

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

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

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

Alternative 4: 98.2% accurate, 1.5× speedup?

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

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

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

      \[\leadsto \color{blue}{\left|-\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)\right|} \]
    2. sub0-neg99.8%

      \[\leadsto \left|\color{blue}{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)}\right| \]
    3. sub-neg99.8%

      \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
    4. +-commutative99.8%

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

      \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
  4. Step-by-step derivation
    1. add-cbrt-cube56.7%

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

      \[\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}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right| \]
  5. Applied egg-rr58.5%

    \[\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}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right| \]
  6. Taylor expanded in ew around inf 98.4%

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

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

Alternative 5: 97.9% accurate, 1.8× speedup?

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

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

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

      \[\leadsto \color{blue}{\left|-\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)\right|} \]
    2. sub0-neg99.8%

      \[\leadsto \left|\color{blue}{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)}\right| \]
    3. sub-neg99.8%

      \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
    4. +-commutative99.8%

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

      \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
  4. Step-by-step derivation
    1. expm1-log1p-u75.0%

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\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}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right| \]
  8. Taylor expanded in t around 0 99.3%

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

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

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

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

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

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

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

Alternative 6: 97.9% accurate, 1.8× speedup?

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

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

      \[\leadsto \color{blue}{\left|-\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)\right|} \]
    2. sub0-neg99.8%

      \[\leadsto \left|\color{blue}{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)}\right| \]
    3. sub-neg99.8%

      \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
    4. +-commutative99.8%

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

      \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
  4. Step-by-step derivation
    1. expm1-log1p-u75.0%

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\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}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right| \]
  8. Taylor expanded in t around 0 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 86.8% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -6.5 \cdot 10^{-98} \lor \neg \left(eh \leq 3.2 \cdot 10^{-99}\right):\\
\;\;\;\;\left|ew - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -6.50000000000000017e-98 or 3.2000000000000001e-99 < eh

    1. Initial program 99.9%

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

        \[\leadsto \color{blue}{\left|-\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)\right|} \]
      2. sub0-neg99.9%

        \[\leadsto \left|\color{blue}{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)}\right| \]
      3. sub-neg99.9%

        \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
      4. +-commutative99.9%

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

        \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
    4. Step-by-step derivation
      1. expm1-log1p-u77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.50000000000000017e-98 < eh < 3.2000000000000001e-99

    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-neg99.7%

        \[\leadsto \color{blue}{\left|-\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)\right|} \]
      2. sub0-neg99.7%

        \[\leadsto \left|\color{blue}{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)}\right| \]
      3. sub-neg99.7%

        \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
      4. +-commutative99.7%

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

        \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
    4. Step-by-step derivation
      1. expm1-log1p-u70.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\cos t \cdot ew - eh \cdot \color{blue}{\left(\frac{\cos \left(t + \tan^{-1} \left(t \cdot \frac{eh}{ew}\right)\right)}{2} - \frac{\cos \left(t + \tan^{-1} \left(t \cdot \frac{eh}{ew}\right)\right)}{2}\right)}\right| \]
    14. Step-by-step derivation
      1. +-inverses88.5%

        \[\leadsto \left|\cos t \cdot ew - eh \cdot \color{blue}{0}\right| \]
    15. Simplified88.5%

      \[\leadsto \left|\cos t \cdot ew - eh \cdot \color{blue}{0}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -6.5 \cdot 10^{-98} \lor \neg \left(eh \leq 3.2 \cdot 10^{-99}\right):\\ \;\;\;\;\left|ew - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \cos t + eh \cdot 0\right|\\ \end{array} \]

Alternative 8: 61.0% accurate, 4.4× speedup?

\[\begin{array}{l} \\ \left|ew \cdot \cos t + eh \cdot 0\right| \end{array} \]
(FPCore (eh ew t) :precision binary64 (fabs (+ (* ew (cos t)) (* eh 0.0))))
double code(double eh, double ew, double t) {
	return fabs(((ew * cos(t)) + (eh * 0.0)));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs(((ew * cos(t)) + (eh * 0.0d0)))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs(((ew * Math.cos(t)) + (eh * 0.0)));
}
def code(eh, ew, t):
	return math.fabs(((ew * math.cos(t)) + (eh * 0.0)))
function code(eh, ew, t)
	return abs(Float64(Float64(ew * cos(t)) + Float64(eh * 0.0)))
end
function tmp = code(eh, ew, t)
	tmp = abs(((ew * cos(t)) + (eh * 0.0)));
end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] + N[(eh * 0.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|ew \cdot \cos t + eh \cdot 0\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-neg99.8%

      \[\leadsto \color{blue}{\left|-\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)\right|} \]
    2. sub0-neg99.8%

      \[\leadsto \left|\color{blue}{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)}\right| \]
    3. sub-neg99.8%

      \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
    4. +-commutative99.8%

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

      \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
  4. Step-by-step derivation
    1. expm1-log1p-u75.0%

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{ew}{\frac{\mathsf{hypot}\left(1, \tan t \cdot \frac{eh}{ew}\right)}{\cos t}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\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}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right| \]
  8. Taylor expanded in t around 0 99.3%

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

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

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

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

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

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

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

      \[\leadsto \left|\cos t \cdot ew - eh \cdot \color{blue}{\left(\frac{\cos \left(t - \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)}{2} - \frac{\cos \left(t + \tan^{-1} \left(\frac{-t}{\frac{ew}{eh}}\right)\right)}{2}\right)}\right| \]
  13. Applied egg-rr62.0%

    \[\leadsto \left|\cos t \cdot ew - eh \cdot \color{blue}{\left(\frac{\cos \left(t + \tan^{-1} \left(t \cdot \frac{eh}{ew}\right)\right)}{2} - \frac{\cos \left(t + \tan^{-1} \left(t \cdot \frac{eh}{ew}\right)\right)}{2}\right)}\right| \]
  14. Step-by-step derivation
    1. +-inverses62.0%

      \[\leadsto \left|\cos t \cdot ew - eh \cdot \color{blue}{0}\right| \]
  15. Simplified62.0%

    \[\leadsto \left|\cos t \cdot ew - eh \cdot \color{blue}{0}\right| \]
  16. Final simplification62.0%

    \[\leadsto \left|ew \cdot \cos t + eh \cdot 0\right| \]

Alternative 9: 41.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-neg99.8%

      \[\leadsto \color{blue}{\left|-\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)\right|} \]
    2. sub0-neg99.8%

      \[\leadsto \left|\color{blue}{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)}\right| \]
    3. sub-neg99.8%

      \[\leadsto \left|0 - \color{blue}{\left(\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)}\right| \]
    4. +-commutative99.8%

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

      \[\leadsto \left|\color{blue}{\left(0 - \left(-\left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right)\right) - \left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\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) - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right|} \]
  4. Step-by-step derivation
    1. add-cbrt-cube56.7%

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

      \[\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}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right| \]
  5. Applied egg-rr58.5%

    \[\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}}} - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{-eh}{\frac{ew}{\tan t}}\right)\right)\right| \]
  6. Taylor expanded in t around 0 79.4%

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

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

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

    \[\leadsto \left|ew - \color{blue}{\frac{eh \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}}\right| \]
  9. Step-by-step derivation
    1. +-inverses43.0%

      \[\leadsto \left|ew - \frac{eh \cdot \color{blue}{0}}{2}\right| \]
    2. mul0-rgt43.0%

      \[\leadsto \left|ew - \frac{\color{blue}{0}}{2}\right| \]
    3. metadata-eval43.0%

      \[\leadsto \left|ew - \color{blue}{0}\right| \]
  10. Simplified43.0%

    \[\leadsto \left|ew - \color{blue}{0}\right| \]
  11. Final simplification43.0%

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

Reproduce

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