Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 22.2s
Alternatives: 11
Speedup: N/A×

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 11 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, 1.1× speedup?

\[\begin{array}{l} \\ \left|ew \cdot \frac{\sin t}{\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| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (+
   (* ew (/ (sin t) (hypot 1.0 (/ eh (* ew (tan t))))))
   (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))
double code(double eh, double ew, double t) {
	return fabs(((ew * (sin(t) / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
}
public static double code(double eh, double ew, double t) {
	return Math.abs(((ew * (Math.sin(t) / Math.hypot(1.0, (eh / (ew * Math.tan(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) / math.hypot(1.0, (eh / (ew * math.tan(t)))))) + ((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
function code(eh, ew, t)
	return abs(Float64(Float64(ew * Float64(sin(t) / hypot(1.0, Float64(eh / Float64(ew * tan(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) / hypot(1.0, (eh / (ew * tan(t)))))) + ((eh * cos(t)) * sin(atan(((eh / ew) / tan(t)))))));
end
code[eh_, ew_, t_] := N[Abs[N[(N[(ew * N[(N[Sin[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $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 \frac{\sin t}{\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|
\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. Step-by-step derivation
    1. *-commutative99.8%

      \[\leadsto \left|\frac{\color{blue}{\sin t \cdot ew}}{\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| \]
    2. associate-/l*99.8%

      \[\leadsto \left|\color{blue}{\sin t \cdot \frac{ew}{\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| \]
    3. associate-/r*99.8%

      \[\leadsto \left|\sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \color{blue}{\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| \]
  6. Simplified99.8%

    \[\leadsto \left|\color{blue}{\sin t \cdot \frac{ew}{\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| \]
  7. Step-by-step derivation
    1. clear-num99.7%

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

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

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

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

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

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

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

    \[\leadsto \left|ew \cdot \frac{\sin t}{\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| \]
  12. Add Preprocessing

Alternative 2: 99.8% 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) + \sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (+
   (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t)))))
   (* (sin t) (/ ew (hypot 1.0 (/ eh (* ew (tan t)))))))))
double code(double eh, double ew, double t) {
	return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * (ew / hypot(1.0, (eh / (ew * tan(t))))))));
}
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))))) + (Math.sin(t) * (ew / Math.hypot(1.0, (eh / (ew * Math.tan(t))))))));
}
def code(eh, ew, t):
	return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (math.sin(t) * (ew / math.hypot(1.0, (eh / (ew * math.tan(t))))))))
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(sin(t) * Float64(ew / hypot(1.0, Float64(eh / Float64(ew * tan(t))))))))
end
function tmp = code(eh, ew, t)
	tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * (ew / hypot(1.0, (eh / (ew * tan(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[Sin[t], $MachinePrecision] * N[(ew / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $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) + \sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \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. Step-by-step derivation
    1. *-commutative99.8%

      \[\leadsto \left|\frac{\color{blue}{\sin t \cdot ew}}{\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| \]
    2. associate-/l*99.8%

      \[\leadsto \left|\color{blue}{\sin t \cdot \frac{ew}{\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| \]
    3. associate-/r*99.8%

      \[\leadsto \left|\sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \color{blue}{\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| \]
  6. Simplified99.8%

    \[\leadsto \left|\color{blue}{\sin t \cdot \frac{ew}{\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| \]
  7. Final simplification99.8%

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

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

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

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

Alternative 4: 98.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \sin t \cdot ew\right| \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (+ (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))) (* (sin t) ew))))
double code(double eh, double ew, double t) {
	return fabs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(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((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * ew)))
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))))) + (Math.sin(t) * ew)));
}
def code(eh, ew, t):
	return math.fabs((((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / math.tan(t))))) + (math.sin(t) * ew)))
function code(eh, ew, t)
	return abs(Float64(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / tan(t))))) + Float64(sin(t) * ew)))
end
function tmp = code(eh, ew, t)
	tmp = abs((((eh * cos(t)) * sin(atan(((eh / ew) / tan(t))))) + (sin(t) * ew)));
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[Sin[t], $MachinePrecision] * ew), $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) + \sin t \cdot ew\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. Step-by-step derivation
    1. *-commutative99.8%

      \[\leadsto \left|\frac{\color{blue}{\sin t \cdot ew}}{\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| \]
    2. associate-/l*99.8%

      \[\leadsto \left|\color{blue}{\sin t \cdot \frac{ew}{\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| \]
    3. associate-/r*99.8%

      \[\leadsto \left|\sin t \cdot \frac{ew}{\mathsf{hypot}\left(1, \color{blue}{\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| \]
  6. Simplified99.8%

    \[\leadsto \left|\color{blue}{\sin t \cdot \frac{ew}{\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| \]
  7. Taylor expanded in ew around inf 99.2%

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

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

Alternative 5: 73.9% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5.5 \cdot 10^{+64} \lor \neg \left(ew \leq 6 \cdot 10^{-18}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -5.4999999999999996e64 or 5.99999999999999966e-18 < ew

    1. Initial program 99.9%

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

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

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

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

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

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

      \[\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-sqr-sqrt99.1%

        \[\leadsto \color{blue}{\sqrt{\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{\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. pow299.1%

        \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    6. Applied egg-rr49.0%

      \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    7. Taylor expanded in ew around inf 36.9%

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

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

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

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \sin t\right)}^{2}}} \]
      4. *-commutative44.7%

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

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

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

        \[\leadsto \color{blue}{\left|\sin t \cdot ew\right|} \]
      3. *-commutative77.9%

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

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

    if -5.4999999999999996e64 < ew < 5.99999999999999966e-18

    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 88.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*88.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. *-commutative88.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*88.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. Simplified88.5%

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

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

Alternative 6: 58.8% accurate, 4.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -5.4 \cdot 10^{+26} \lor \neg \left(ew \leq 2.35 \cdot 10^{-79}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -5.4e26 or 2.3500000000000001e-79 < ew

    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-sqr-sqrt99.1%

        \[\leadsto \color{blue}{\sqrt{\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{\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. pow299.1%

        \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    6. Applied egg-rr50.3%

      \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    7. Taylor expanded in ew around inf 34.4%

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

        \[\leadsto \color{blue}{\sqrt{ew \cdot \sin t} \cdot \sqrt{ew \cdot \sin t}} \]
      2. sqrt-unprod42.9%

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \sin t\right) \cdot \left(ew \cdot \sin t\right)}} \]
      3. pow242.9%

        \[\leadsto \sqrt{\color{blue}{{\left(ew \cdot \sin t\right)}^{2}}} \]
      4. *-commutative42.9%

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

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

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

        \[\leadsto \color{blue}{\left|\sin t \cdot ew\right|} \]
      3. *-commutative72.1%

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

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

    if -5.4e26 < ew < 2.3500000000000001e-79

    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 58.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. sin-atan7.0%

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{ew \cdot \tan t}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}}\right| \]
      2. hypot-1-def14.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| \]
      3. div-inv14.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 45.5% accurate, 8.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.75 \cdot 10^{+31} \lor \neg \left(ew \leq 2 \cdot 10^{+104}\right):\\
\;\;\;\;\sin t \cdot ew\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.75e31 or 2e104 < ew

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\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{\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. pow299.0%

        \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    6. Applied egg-rr56.4%

      \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    7. Taylor expanded in ew around inf 42.4%

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

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

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

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

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

    if -1.75e31 < ew < 2e104

    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 52.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. sin-atan10.1%

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{ew \cdot \tan t}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}}\right| \]
      2. hypot-1-def17.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| \]
      3. div-inv17.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 44.9% accurate, 8.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.6 \cdot 10^{+167} \lor \neg \left(ew \leq 1.8 \cdot 10^{+188}\right):\\
\;\;\;\;\left|t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.5999999999999999e167 or 1.8000000000000001e188 < ew

    1. Initial program 99.9%

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

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

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

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

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

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

      \[\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-sqr-sqrt99.1%

        \[\leadsto \color{blue}{\sqrt{\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{\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. pow299.1%

        \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    6. Applied egg-rr52.2%

      \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    7. Taylor expanded in ew around inf 47.3%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left|ew \cdot t\right|} \]
      3. *-commutative44.6%

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

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

    if -1.5999999999999999e167 < ew < 1.8000000000000001e188

    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 48.4%

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

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{ew \cdot \tan t}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}}\right| \]
      2. hypot-1-def18.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| \]
      3. div-inv18.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -1.6 \cdot 10^{+167} \lor \neg \left(ew \leq 1.8 \cdot 10^{+188}\right):\\ \;\;\;\;\left|t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 42.0% accurate, 8.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.7 \cdot 10^{+209}:\\
\;\;\;\;t \cdot ew\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.6999999999999998e209

    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. Step-by-step derivation
      1. add-sqr-sqrt99.0%

        \[\leadsto \color{blue}{\sqrt{\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{\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. pow299.0%

        \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    6. Applied egg-rr64.6%

      \[\leadsto \color{blue}{{\left(\sqrt{\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)}^{2}} \]
    7. Taylor expanded in ew around inf 60.6%

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

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

    if -1.6999999999999998e209 < ew

    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 43.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. sin-atan10.4%

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{ew \cdot \tan t}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}}\right| \]
      2. hypot-1-def17.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| \]
      3. div-inv17.3%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -1.7 \cdot 10^{+209}:\\ \;\;\;\;t \cdot ew\\ \mathbf{else}:\\ \;\;\;\;\left|eh\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 41.8% accurate, 131.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-eh\\ \mathbf{else}:\\ \;\;\;\;eh\\ \end{array} \end{array} \]
(FPCore (eh ew t) :precision binary64 (if (<= eh -5e-310) (- eh) eh))
double code(double eh, double ew, double t) {
	double tmp;
	if (eh <= -5e-310) {
		tmp = -eh;
	} else {
		tmp = 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 (eh <= (-5d-310)) then
        tmp = -eh
    else
        tmp = eh
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if (eh <= -5e-310) {
		tmp = -eh;
	} else {
		tmp = eh;
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if eh <= -5e-310:
		tmp = -eh
	else:
		tmp = eh
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if (eh <= -5e-310)
		tmp = Float64(-eh);
	else
		tmp = eh;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if (eh <= -5e-310)
		tmp = -eh;
	else
		tmp = eh;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[eh, -5e-310], (-eh), eh]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-eh\\

\mathbf{else}:\\
\;\;\;\;eh\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -4.999999999999985e-310

    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 37.7%

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

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{ew \cdot \tan t}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}}\right| \]
      2. hypot-1-def13.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| \]
      3. div-inv13.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
    10. Step-by-step derivation
      1. add-sqr-sqrt9.4%

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

        \[\leadsto \color{blue}{\sqrt{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \cdot \sqrt{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}} \]
      3. add-sqr-sqrt9.8%

        \[\leadsto \color{blue}{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
      4. associate-*r/8.8%

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

        \[\leadsto \color{blue}{\frac{eh}{\tan t} \cdot \frac{\frac{eh}{ew}}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
    11. Applied egg-rr8.3%

      \[\leadsto \color{blue}{\frac{eh}{\tan t} \cdot \frac{\frac{eh}{ew}}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
    12. Step-by-step derivation
      1. associate-*r/7.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot eh} \]
    15. Step-by-step derivation
      1. neg-mul-138.2%

        \[\leadsto \color{blue}{-eh} \]
    16. Simplified38.2%

      \[\leadsto \color{blue}{-eh} \]

    if -4.999999999999985e-310 < 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 41.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. sin-atan11.9%

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

        \[\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| \]
      3. div-inv18.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
    10. Step-by-step derivation
      1. add-sqr-sqrt7.4%

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

        \[\leadsto \color{blue}{\sqrt{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \cdot \sqrt{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}} \]
      3. add-sqr-sqrt8.0%

        \[\leadsto \color{blue}{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
      4. associate-*r/7.6%

        \[\leadsto \color{blue}{\frac{eh \cdot \frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
      5. times-frac7.2%

        \[\leadsto \color{blue}{\frac{eh}{\tan t} \cdot \frac{\frac{eh}{ew}}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
    11. Applied egg-rr7.2%

      \[\leadsto \color{blue}{\frac{eh}{\tan t} \cdot \frac{\frac{eh}{ew}}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
    12. Step-by-step derivation
      1. associate-*r/6.7%

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

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

      \[\leadsto \color{blue}{eh} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 21.9% accurate, 919.0× speedup?

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

\\
eh
\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 39.6%

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

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

      \[\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| \]
    3. div-inv16.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}\right| \]
  10. Step-by-step derivation
    1. add-sqr-sqrt8.4%

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

      \[\leadsto \color{blue}{\sqrt{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \cdot \sqrt{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}}} \]
    3. add-sqr-sqrt8.9%

      \[\leadsto \color{blue}{eh \cdot \frac{\frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
    4. associate-*r/8.2%

      \[\leadsto \color{blue}{\frac{eh \cdot \frac{eh}{ew}}{\tan t \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
    5. times-frac7.8%

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

    \[\leadsto \color{blue}{\frac{eh}{\tan t} \cdot \frac{\frac{eh}{ew}}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}} \]
  12. Step-by-step derivation
    1. associate-*r/7.3%

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

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

    \[\leadsto \color{blue}{eh} \]
  15. Add Preprocessing

Reproduce

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