Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 22.3s
Alternatives: 10
Speedup: 0.9×

Specification

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

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

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

Alternative 1: 99.8% accurate, 0.9× speedup?

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

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Step-by-step derivation
    1. associate-*l*99.8%

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.1× speedup?

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

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

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*99.8%

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

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

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

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

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

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

Alternative 3: 98.9% accurate, 1.1× speedup?

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

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

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

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

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

Alternative 4: 98.3% accurate, 1.5× speedup?

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

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

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*99.8%

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

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

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

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

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

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

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

Alternative 5: 74.9% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -2.8 \cdot 10^{-66} \lor \neg \left(eh \leq 2.15 \cdot 10^{-70}\right):\\
\;\;\;\;\left|\cos t \cdot \left(eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -2.8e-66 or 2.15e-70 < eh

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

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

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

    if -2.8e-66 < eh < 2.15e-70

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\sqrt[3]{ew \cdot \sin t}\right)}}^{3} \]
    8. Step-by-step derivation
      1. rem-cube-cbrt45.0%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. add-sqr-sqrt43.7%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \sin t} \cdot \sqrt{ew \cdot \sin t}} \]
      3. sqrt-unprod49.0%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \sin t\right) \cdot \left(ew \cdot \sin t\right)}} \]
      4. pow249.0%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \sin t\right)}^{2}}} \]
    9. Applied egg-rr49.0%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
    10. Step-by-step derivation
      1. unpow249.0%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \sin t\right) \cdot \left(ew \cdot \sin t\right)}} \]
      2. rem-sqrt-square70.6%

        \[\leadsto \color{blue}{\left|ew \cdot \sin t\right|} \]
    11. Simplified70.6%

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

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

Alternative 6: 62.9% accurate, 4.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-18} \lor \neg \left(t \leq 1.4 \cdot 10^{-20}\right):\\
\;\;\;\;\left|ew \cdot \sin t\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.99999999999999983e-18 or 1.4000000000000001e-20 < t

    1. Initial program 99.6%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. associate-*l*99.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\sqrt[3]{ew \cdot \sin t}\right)}}^{3} \]
    8. Step-by-step derivation
      1. rem-cube-cbrt33.3%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. add-sqr-sqrt32.5%

        \[\leadsto \color{blue}{\sqrt{ew \cdot \sin t} \cdot \sqrt{ew \cdot \sin t}} \]
      3. sqrt-unprod28.7%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \sin t\right) \cdot \left(ew \cdot \sin t\right)}} \]
      4. pow228.7%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \sin t\right)}^{2}}} \]
    9. Applied egg-rr28.7%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
    10. Step-by-step derivation
      1. unpow228.7%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot \sin t\right) \cdot \left(ew \cdot \sin t\right)}} \]
      2. rem-sqrt-square51.3%

        \[\leadsto \color{blue}{\left|ew \cdot \sin t\right|} \]
    11. Simplified51.3%

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

    if -2.99999999999999983e-18 < t < 1.4000000000000001e-20

    1. Initial program 100.0%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      3. *-un-lft-identity24.1%

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

        \[\leadsto \left|eh \cdot \frac{1 \cdot \frac{\frac{eh}{ew}}{\tan t}}{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right| \]
      5. add-cube-cbrt45.7%

        \[\leadsto \left|eh \cdot \frac{1 \cdot \frac{\frac{eh}{ew}}{\tan t}}{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}}\right| \]
      6. times-frac45.7%

        \[\leadsto \left|eh \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}} \cdot \frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right)}\right| \]
      7. pow245.7%

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

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

        \[\leadsto \left|eh \cdot \left(\frac{1}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2}} \cdot \frac{\color{blue}{\frac{eh}{ew \cdot \tan t}}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right)\right| \]
    7. Applied egg-rr37.8%

      \[\leadsto \left|eh \cdot \color{blue}{\left(\frac{1}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2}} \cdot \frac{\frac{eh}{ew \cdot \tan t}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right)}\right| \]
    8. Step-by-step derivation
      1. times-frac37.8%

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

        \[\leadsto \left|eh \cdot \frac{\color{blue}{\frac{eh}{ew \cdot \tan t}}}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
      3. unpow237.8%

        \[\leadsto \left|eh \cdot \frac{\frac{eh}{ew \cdot \tan t}}{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
      4. rem-3cbrt-lft38.5%

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

        \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right) \cdot \left(ew \cdot \tan t\right)}}\right| \]
    9. Simplified38.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3 \cdot 10^{-18} \lor \neg \left(t \leq 1.4 \cdot 10^{-20}\right):\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 50.1% accurate, 8.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.4 \cdot 10^{-13} \lor \neg \left(t \leq 28000\right):\\
\;\;\;\;ew \cdot \sin t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.39999999999999999e-13 or 28000 < t

    1. Initial program 99.6%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. associate-*l*99.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\sqrt[3]{ew \cdot \sin t}\right)}}^{3} \]
    8. Step-by-step derivation
      1. rem-cube-cbrt34.1%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. *-commutative34.1%

        \[\leadsto \color{blue}{\sin t \cdot ew} \]
    9. Applied egg-rr34.1%

      \[\leadsto \color{blue}{\sin t \cdot ew} \]

    if -6.39999999999999999e-13 < t < 28000

    1. Initial program 100.0%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      3. *-un-lft-identity23.6%

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

        \[\leadsto \left|eh \cdot \frac{1 \cdot \frac{\frac{eh}{ew}}{\tan t}}{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right| \]
      5. add-cube-cbrt44.7%

        \[\leadsto \left|eh \cdot \frac{1 \cdot \frac{\frac{eh}{ew}}{\tan t}}{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}}\right| \]
      6. times-frac44.7%

        \[\leadsto \left|eh \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}} \cdot \frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right)}\right| \]
      7. pow244.7%

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

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

        \[\leadsto \left|eh \cdot \left(\frac{1}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2}} \cdot \frac{\color{blue}{\frac{eh}{ew \cdot \tan t}}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right)\right| \]
    7. Applied egg-rr37.0%

      \[\leadsto \left|eh \cdot \color{blue}{\left(\frac{1}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2}} \cdot \frac{\frac{eh}{ew \cdot \tan t}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right)}\right| \]
    8. Step-by-step derivation
      1. times-frac37.0%

        \[\leadsto \left|eh \cdot \color{blue}{\frac{1 \cdot \frac{eh}{ew \cdot \tan t}}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}}\right| \]
      2. *-lft-identity37.0%

        \[\leadsto \left|eh \cdot \frac{\color{blue}{\frac{eh}{ew \cdot \tan t}}}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
      3. unpow237.0%

        \[\leadsto \left|eh \cdot \frac{\frac{eh}{ew \cdot \tan t}}{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
      4. rem-3cbrt-lft37.7%

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

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

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

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

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

Alternative 8: 45.1% accurate, 8.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -3.3 \cdot 10^{-123} \lor \neg \left(eh \leq 8.6 \cdot 10^{-194}\right):\\
\;\;\;\;\left|eh\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -3.3000000000000003e-123 or 8.60000000000000012e-194 < eh

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. associate-*l*99.8%

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

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

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

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

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

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

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

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

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      3. *-un-lft-identity15.8%

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

        \[\leadsto \left|eh \cdot \frac{1 \cdot \frac{\frac{eh}{ew}}{\tan t}}{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right| \]
      5. add-cube-cbrt31.5%

        \[\leadsto \left|eh \cdot \frac{1 \cdot \frac{\frac{eh}{ew}}{\tan t}}{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}}\right| \]
      6. times-frac31.5%

        \[\leadsto \left|eh \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}} \cdot \frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right)}\right| \]
      7. pow231.5%

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

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

        \[\leadsto \left|eh \cdot \left(\frac{1}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2}} \cdot \frac{\color{blue}{\frac{eh}{ew \cdot \tan t}}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right)\right| \]
    7. Applied egg-rr28.8%

      \[\leadsto \left|eh \cdot \color{blue}{\left(\frac{1}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2}} \cdot \frac{\frac{eh}{ew \cdot \tan t}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right)}\right| \]
    8. Step-by-step derivation
      1. times-frac28.9%

        \[\leadsto \left|eh \cdot \color{blue}{\frac{1 \cdot \frac{eh}{ew \cdot \tan t}}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}}\right| \]
      2. *-lft-identity28.9%

        \[\leadsto \left|eh \cdot \frac{\color{blue}{\frac{eh}{ew \cdot \tan t}}}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
      3. unpow228.9%

        \[\leadsto \left|eh \cdot \frac{\frac{eh}{ew \cdot \tan t}}{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
      4. rem-3cbrt-lft29.3%

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

        \[\leadsto \left|eh \cdot \color{blue}{\frac{eh}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right) \cdot \left(ew \cdot \tan t\right)}}\right| \]
    9. Simplified29.5%

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

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

    if -3.3000000000000003e-123 < eh < 8.60000000000000012e-194

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\sqrt[3]{ew \cdot \sin t}\right)}}^{3} \]
    8. Taylor expanded in t around 0 23.7%

      \[\leadsto \color{blue}{ew \cdot t} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt22.7%

        \[\leadsto \color{blue}{\sqrt{ew \cdot t} \cdot \sqrt{ew \cdot t}} \]
      2. sqrt-unprod29.8%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot t\right) \cdot \left(ew \cdot t\right)}} \]
      3. pow229.8%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot t\right)}^{2}}} \]
    10. Applied egg-rr29.8%

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot t\right)}^{2}}} \]
    11. Step-by-step derivation
      1. unpow229.8%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot t\right) \cdot \left(ew \cdot t\right)}} \]
      2. rem-sqrt-square42.9%

        \[\leadsto \color{blue}{\left|ew \cdot t\right|} \]
    12. Simplified42.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -3.3 \cdot 10^{-123} \lor \neg \left(eh \leq 8.6 \cdot 10^{-194}\right):\\ \;\;\;\;\left|eh\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot t\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 42.8% accurate, 9.1× speedup?

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

\\
\left|eh\right|
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Step-by-step derivation
    1. associate-*l*99.8%

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

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

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

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

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

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

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

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

      \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
    3. *-un-lft-identity15.4%

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

      \[\leadsto \left|eh \cdot \frac{1 \cdot \frac{\frac{eh}{ew}}{\tan t}}{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right| \]
    5. add-cube-cbrt27.5%

      \[\leadsto \left|eh \cdot \frac{1 \cdot \frac{\frac{eh}{ew}}{\tan t}}{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}}\right| \]
    6. times-frac27.5%

      \[\leadsto \left|eh \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}} \cdot \frac{\frac{\frac{eh}{ew}}{\tan t}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right)}\right| \]
    7. pow227.5%

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

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

      \[\leadsto \left|eh \cdot \left(\frac{1}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2}} \cdot \frac{\color{blue}{\frac{eh}{ew \cdot \tan t}}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right)\right| \]
  7. Applied egg-rr23.6%

    \[\leadsto \left|eh \cdot \color{blue}{\left(\frac{1}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2}} \cdot \frac{\frac{eh}{ew \cdot \tan t}}{\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right)}\right| \]
  8. Step-by-step derivation
    1. times-frac23.6%

      \[\leadsto \left|eh \cdot \color{blue}{\frac{1 \cdot \frac{eh}{ew \cdot \tan t}}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}}\right| \]
    2. *-lft-identity23.6%

      \[\leadsto \left|eh \cdot \frac{\color{blue}{\frac{eh}{ew \cdot \tan t}}}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
    3. unpow223.6%

      \[\leadsto \left|eh \cdot \frac{\frac{eh}{ew \cdot \tan t}}{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
    4. rem-3cbrt-lft24.0%

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

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

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

    \[\leadsto \left|\color{blue}{eh}\right| \]
  11. Add Preprocessing

Alternative 10: 9.9% accurate, 306.3× speedup?

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

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

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Step-by-step derivation
    1. associate-*l*99.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto {\color{blue}{\left(\sqrt[3]{ew \cdot \sin t}\right)}}^{3} \]
  8. Taylor expanded in t around 0 12.0%

    \[\leadsto \color{blue}{ew \cdot t} \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024136 
(FPCore (eh ew t)
  :name "Example from Robby"
  :precision binary64
  (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))