Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 21.1s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

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

Alternative 2: 99.7% accurate, 1.1× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cube-cbrt98.7%

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

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

    \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  5. Step-by-step derivation
    1. rem-cube-cbrt99.9%

      \[\leadsto \left|\color{blue}{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. clear-num99.8%

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

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

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

Alternative 3: 98.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \left|ew \cdot \cos t - eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \left(-\tan t\right)}{ew}\right)\right)\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (-
   (* ew (cos t))
   (* eh (* (sin t) (sin (atan (/ (* eh (- (tan t))) ew))))))))
double code(double eh, double ew, double t) {
	return fabs(((ew * cos(t)) - (eh * (sin(t) * sin(atan(((eh * -tan(t)) / ew)))))));
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs(((ew * cos(t)) - (eh * (sin(t) * sin(atan(((eh * -tan(t)) / 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(((eh * -Math.tan(t)) / ew)))))));
}
def code(eh, ew, t):
	return math.fabs(((ew * math.cos(t)) - (eh * (math.sin(t) * math.sin(math.atan(((eh * -math.tan(t)) / ew)))))))
function code(eh, ew, t)
	return abs(Float64(Float64(ew * cos(t)) - Float64(eh * Float64(sin(t) * sin(atan(Float64(Float64(eh * Float64(-tan(t))) / ew)))))))
end
function tmp = code(eh, ew, t)
	tmp = abs(((ew * cos(t)) - (eh * (sin(t) * sin(atan(((eh * -tan(t)) / 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[(N[(eh * (-N[Tan[t], $MachinePrecision])), $MachinePrecision] / ew), $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 \cdot \left(-\tan t\right)}{ew}\right)\right)\right|
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cube-cbrt98.7%

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

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

    \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  5. Taylor expanded in eh around 0 97.7%

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

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

Alternative 4: 98.4% accurate, 1.5× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cube-cbrt98.7%

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

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

    \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  5. Step-by-step derivation
    1. rem-cube-cbrt99.9%

      \[\leadsto \left|\color{blue}{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. clear-num99.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 74.6% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.6:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

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

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


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

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt98.6%

        \[\leadsto \left|\color{blue}{\left(\sqrt[3]{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)} \cdot \sqrt[3]{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)}\right) \cdot \sqrt[3]{\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. pow398.6%

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

      \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    5. Taylor expanded in ew around inf 59.1%

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

    if -0.599999999999999978 < t < 0.00110000000000000007

    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. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt98.7%

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

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

      \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    5. Step-by-step derivation
      1. rem-cube-cbrt100.0%

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
      2. clear-num99.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.00110000000000000007 < t

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 74.6% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{eh}{-ew}\\
\mathbf{if}\;t \leq -0.6:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

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

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


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

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt98.6%

        \[\leadsto \left|\color{blue}{\left(\sqrt[3]{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)} \cdot \sqrt[3]{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)}\right) \cdot \sqrt[3]{\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. pow398.6%

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

      \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    5. Taylor expanded in ew around inf 59.1%

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

    if -0.599999999999999978 < t < 2.59999999999999977e-4

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \log \left(e^{\left(-\cos t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right) \cdot \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)}}}}\right), eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(\left(-eh\right) \cdot \frac{\tan t}{ew}\right)\right)\right)\right| \]
      4. un-div-inv100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.59999999999999977e-4 < t

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 74.6% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -7.5 \cdot 10^{-141} \lor \neg \left(ew \leq 1.7 \cdot 10^{-146}\right):\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -7.50000000000000046e-141 or 1.7e-146 < ew

    1. Initial program 99.9%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt98.4%

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

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

      \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    5. Taylor expanded in ew around inf 78.2%

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

    if -7.50000000000000046e-141 < ew < 1.7e-146

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 63.9% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.26 \cdot 10^{+237} \lor \neg \left(eh \leq 2.2 \cdot 10^{+157}\right):\\
\;\;\;\;\left|eh \cdot \left(t \cdot \sin \tan^{-1} \left(\frac{t \cdot eh}{-ew}\right)\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -1.2599999999999999e237 or 2.2000000000000001e157 < 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. Add Preprocessing
    3. Taylor expanded in ew around inf 69.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2599999999999999e237 < eh < 2.2000000000000001e157

    1. Initial program 99.9%

      \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cube-cbrt98.6%

        \[\leadsto \left|\color{blue}{\left(\sqrt[3]{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)} \cdot \sqrt[3]{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)}\right) \cdot \sqrt[3]{\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. pow398.6%

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

      \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
    5. Taylor expanded in ew around inf 70.4%

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

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

Alternative 9: 61.4% accurate, 4.5× speedup?

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

\\
\left|ew \cdot \cos t\right|
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cube-cbrt98.7%

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

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

    \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  5. Taylor expanded in ew around inf 62.8%

    \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
  6. Add Preprocessing

Alternative 10: 41.9% 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.9%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cube-cbrt98.7%

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

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

    \[\leadsto \left|\color{blue}{{\left(\sqrt[3]{\frac{ew \cdot \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{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  5. Taylor expanded in t around 0 44.1%

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

Reproduce

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