Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 21.0s
Alternatives: 12
Speedup: 1.0×

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 12 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.0× speedup?

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

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

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

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

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \sin t\right)\right| \]
    2. accelerator-lowering-fma.f64N/A

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \sin t\right)\right)\right| \]
    6. atan-lowering-atan.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \sin t\right)\right)\right| \]
    7. /-lowering-/.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \sin t\right)\right)\right| \]
    8. *-lowering-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right), ew \cdot \left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \sin t\right)\right)\right| \]
    9. tan-lowering-tan.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right), ew \cdot \left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) \cdot \sin t\right)\right)\right| \]
    10. *-commutativeN/A

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

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), \color{blue}{\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right)\right| \]
    12. *-lowering-*.f64N/A

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

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

Alternative 2: 99.1% accurate, 1.1× speedup?

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

    \[\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. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\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| \]
    2. *-commutativeN/A

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

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

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

Alternative 3: 98.4% accurate, 1.6× speedup?

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

\\
\left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), ew \cdot \sin 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. cos-atanN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. un-div-invN/A

      \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. clear-numN/A

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. /-lowering-/.f64N/A

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. /-lowering-/.f64N/A

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

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

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

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
    2. accelerator-lowering-fma.f64N/A

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
    6. atan-lowering-atan.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
    7. /-lowering-/.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
    8. *-lowering-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right), ew \cdot \sin t\right)\right| \]
    9. tan-lowering-tan.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right), ew \cdot \sin t\right)\right| \]
    10. *-lowering-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), \color{blue}{ew \cdot \sin t}\right)\right| \]
    11. sin-lowering-sin.f6497.9

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

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

Alternative 4: 98.4% accurate, 1.6× speedup?

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

\\
\left|\mathsf{fma}\left(\sin t, ew, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\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. cos-atanN/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. un-div-invN/A

      \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    3. clear-numN/A

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    4. /-lowering-/.f64N/A

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    5. /-lowering-/.f64N/A

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

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

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

      \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
    2. accelerator-lowering-fma.f64N/A

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
    6. atan-lowering-atan.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
    7. /-lowering-/.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
    8. *-lowering-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right), ew \cdot \sin t\right)\right| \]
    9. tan-lowering-tan.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right), ew \cdot \sin t\right)\right| \]
    10. *-lowering-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), \color{blue}{ew \cdot \sin t}\right)\right| \]
    11. sin-lowering-sin.f6497.9

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

    \[\leadsto \left|\color{blue}{\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), ew \cdot \sin t\right)}\right| \]
  8. Step-by-step derivation
    1. +-commutativeN/A

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

      \[\leadsto \left|\color{blue}{\sin t \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right| \]
    3. accelerator-lowering-fma.f64N/A

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

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

      \[\leadsto \left|\mathsf{fma}\left(\sin t, ew, \color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right)\right| \]
    6. *-lowering-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\sin t, ew, \color{blue}{\left(eh \cdot \cos t\right)} \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right)\right| \]
    7. cos-lowering-cos.f64N/A

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

      \[\leadsto \left|\mathsf{fma}\left(\sin t, ew, \left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right)\right| \]
    9. atan-lowering-atan.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\sin t, ew, \left(eh \cdot \cos t\right) \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right)\right| \]
    10. /-lowering-/.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\sin t, ew, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right)\right| \]
    11. *-lowering-*.f64N/A

      \[\leadsto \left|\mathsf{fma}\left(\sin t, ew, \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right)\right)\right| \]
    12. tan-lowering-tan.f6497.9

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

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

Alternative 5: 83.9% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_1 := eh \cdot \cos t\\
t_2 := \left|t\_1 \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
\mathbf{if}\;eh \leq -4.2 \cdot 10^{+61}:\\
\;\;\;\;t\_2\\

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

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -4.2000000000000002e61 or 1.1500000000000001e127 < 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. Add Preprocessing
    3. Taylor expanded in ew around 0

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

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. *-lowering-*.f64N/A

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

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

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      6. atan-lowering-atan.f64N/A

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

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      8. *-lowering-*.f64N/A

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

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

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

    if -4.2000000000000002e61 < eh < 1.1500000000000001e127

    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. Add Preprocessing
    3. Taylor expanded in t around 0

      \[\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. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\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| \]
      2. *-commutativeN/A

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

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

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

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\left(\sin t \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right) \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right| \]
      3. remove-double-divN/A

        \[\leadsto \left|\left(\sin t \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right) \cdot \color{blue}{\frac{1}{\frac{1}{ew}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right| \]
      4. un-div-invN/A

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

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

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

Alternative 6: 74.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ t_2 := \sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}\\ \mathbf{if}\;eh \leq -5.4 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 0.065:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{t\_2}, ew, eh \cdot \left(\cos t \cdot \frac{eh}{\left(t \cdot ew\right) \cdot t\_2}\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* (* eh (cos t)) (sin (atan (/ eh (* ew (tan t))))))))
        (t_2 (sqrt (+ 1.0 (/ (* eh eh) (* (* t ew) (* t ew)))))))
   (if (<= eh -5.4e+21)
     t_1
     (if (<= eh 0.065)
       (fabs
        (fma (/ (sin t) t_2) ew (* eh (* (cos t) (/ eh (* (* t ew) t_2))))))
       t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs(((eh * cos(t)) * sin(atan((eh / (ew * tan(t)))))));
	double t_2 = sqrt((1.0 + ((eh * eh) / ((t * ew) * (t * ew)))));
	double tmp;
	if (eh <= -5.4e+21) {
		tmp = t_1;
	} else if (eh <= 0.065) {
		tmp = fabs(fma((sin(t) / t_2), ew, (eh * (cos(t) * (eh / ((t * ew) * t_2))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(eh / Float64(ew * tan(t)))))))
	t_2 = sqrt(Float64(1.0 + Float64(Float64(eh * eh) / Float64(Float64(t * ew) * Float64(t * ew)))))
	tmp = 0.0
	if (eh <= -5.4e+21)
		tmp = t_1;
	elseif (eh <= 0.065)
		tmp = abs(fma(Float64(sin(t) / t_2), ew, Float64(eh * Float64(cos(t) * Float64(eh / Float64(Float64(t * ew) * t_2))))));
	else
		tmp = t_1;
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 + N[(N[(eh * eh), $MachinePrecision] / N[(N[(t * ew), $MachinePrecision] * N[(t * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -5.4e+21], t$95$1, If[LessEqual[eh, 0.065], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] / t$95$2), $MachinePrecision] * ew + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[(eh / N[(N[(t * ew), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\
t_2 := \sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}\\
\mathbf{if}\;eh \leq -5.4 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 0.065:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{t\_2}, ew, eh \cdot \left(\cos t \cdot \frac{eh}{\left(t \cdot ew\right) \cdot t\_2}\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -5.4e21 or 0.065000000000000002 < 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. Add Preprocessing
    3. Taylor expanded in ew around 0

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

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      2. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. *-lowering-*.f64N/A

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

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

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      6. atan-lowering-atan.f64N/A

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

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      8. *-lowering-*.f64N/A

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

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

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

    if -5.4e21 < eh < 0.065000000000000002

    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. Add Preprocessing
    3. Taylor expanded in t around 0

      \[\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. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\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| \]
      2. *-commutativeN/A

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

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

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

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\left(\sin t \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right) \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right| \]
      3. accelerator-lowering-fma.f64N/A

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\frac{\sin t}{\sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}}, ew, eh \cdot \left(\cos t \cdot \frac{eh}{\sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}} \cdot \left(t \cdot ew\right)}\right)\right)}\right| \]
  3. Recombined 2 regimes into one program.
  4. Final simplification78.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -5.4 \cdot 10^{+21}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \mathbf{elif}\;eh \leq 0.065:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{\sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}}, ew, eh \cdot \left(\cos t \cdot \frac{eh}{\left(t \cdot ew\right) \cdot \sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}}\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 75.7% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}\\ \mathbf{if}\;t \leq -5.1 \cdot 10^{-8}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{elif}\;t \leq 0.00037:\\ \;\;\;\;\left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), t \cdot ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{t\_1}, ew, eh \cdot \left(\cos t \cdot \frac{eh}{\left(t \cdot ew\right) \cdot t\_1}\right)\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (sqrt (+ 1.0 (/ (* eh eh) (* (* t ew) (* t ew)))))))
   (if (<= t -5.1e-8)
     (fabs (* ew (sin t)))
     (if (<= t 0.00037)
       (fabs (fma eh (sin (atan (/ eh (* ew (tan t))))) (* t ew)))
       (fabs
        (fma
         (/ (sin t) t_1)
         ew
         (* eh (* (cos t) (/ eh (* (* t ew) t_1))))))))))
double code(double eh, double ew, double t) {
	double t_1 = sqrt((1.0 + ((eh * eh) / ((t * ew) * (t * ew)))));
	double tmp;
	if (t <= -5.1e-8) {
		tmp = fabs((ew * sin(t)));
	} else if (t <= 0.00037) {
		tmp = fabs(fma(eh, sin(atan((eh / (ew * tan(t))))), (t * ew)));
	} else {
		tmp = fabs(fma((sin(t) / t_1), ew, (eh * (cos(t) * (eh / ((t * ew) * t_1))))));
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = sqrt(Float64(1.0 + Float64(Float64(eh * eh) / Float64(Float64(t * ew) * Float64(t * ew)))))
	tmp = 0.0
	if (t <= -5.1e-8)
		tmp = abs(Float64(ew * sin(t)));
	elseif (t <= 0.00037)
		tmp = abs(fma(eh, sin(atan(Float64(eh / Float64(ew * tan(t))))), Float64(t * ew)));
	else
		tmp = abs(fma(Float64(sin(t) / t_1), ew, Float64(eh * Float64(cos(t) * Float64(eh / Float64(Float64(t * ew) * t_1))))));
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sqrt[N[(1.0 + N[(N[(eh * eh), $MachinePrecision] / N[(N[(t * ew), $MachinePrecision] * N[(t * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -5.1e-8], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 0.00037], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] / t$95$1), $MachinePrecision] * ew + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[(eh / N[(N[(t * ew), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}\\
\mathbf{if}\;t \leq -5.1 \cdot 10^{-8}:\\
\;\;\;\;\left|ew \cdot \sin t\right|\\

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

\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{t\_1}, ew, eh \cdot \left(\cos t \cdot \frac{eh}{\left(t \cdot ew\right) \cdot t\_1}\right)\right)\right|\\


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

    1. Initial program 99.7%

      \[\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. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. un-div-invN/A

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. clear-numN/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. /-lowering-/.f64N/A

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6450.4

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified50.4%

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

    if -5.10000000000000001e-8 < t < 3.6999999999999999e-4

    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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. un-div-invN/A

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. clear-numN/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. /-lowering-/.f64N/A

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

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

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

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
      2. accelerator-lowering-fma.f64N/A

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
      6. atan-lowering-atan.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
      7. /-lowering-/.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
      8. *-lowering-*.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right), ew \cdot \sin t\right)\right| \]
      9. tan-lowering-tan.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right), ew \cdot \sin t\right)\right| \]
      10. *-lowering-*.f64N/A

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

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

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

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot t}\right| \]
    9. Step-by-step derivation
      1. accelerator-lowering-fma.f64N/A

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), ew \cdot t\right)}\right| \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot t\right)\right| \]
      3. atan-lowering-atan.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot t\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot t\right)\right| \]
      5. *-lowering-*.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right), ew \cdot t\right)\right| \]
      6. tan-lowering-tan.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right), ew \cdot t\right)\right| \]
      7. *-commutativeN/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), \color{blue}{t \cdot ew}\right)\right| \]
      8. *-lowering-*.f6498.0

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

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

    if 3.6999999999999999e-4 < t

    1. Initial program 99.7%

      \[\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

      \[\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. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\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| \]
      2. *-commutativeN/A

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

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

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

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\left(\sin t \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right) \cdot ew} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right)\right| \]
      3. accelerator-lowering-fma.f64N/A

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

      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\frac{\sin t}{\sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}}, ew, eh \cdot \left(\cos t \cdot \frac{eh}{\sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}} \cdot \left(t \cdot ew\right)}\right)\right)}\right| \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.1 \cdot 10^{-8}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \mathbf{elif}\;t \leq 0.00037:\\ \;\;\;\;\left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), t \cdot ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{\sin t}{\sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}}, ew, eh \cdot \left(\cos t \cdot \frac{eh}{\left(t \cdot ew\right) \cdot \sqrt{1 + \frac{eh \cdot eh}{\left(t \cdot ew\right) \cdot \left(t \cdot ew\right)}}}\right)\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 74.7% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \sin t\right|\\ \mathbf{if}\;t \leq -5.1 \cdot 10^{-8}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 0.24:\\ \;\;\;\;\left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), t \cdot ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* ew (sin t)))))
   (if (<= t -5.1e-8)
     t_1
     (if (<= t 0.24)
       (fabs (fma eh (sin (atan (/ eh (* ew (tan t))))) (* t ew)))
       t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((ew * sin(t)));
	double tmp;
	if (t <= -5.1e-8) {
		tmp = t_1;
	} else if (t <= 0.24) {
		tmp = fabs(fma(eh, sin(atan((eh / (ew * tan(t))))), (t * ew)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = abs(Float64(ew * sin(t)))
	tmp = 0.0
	if (t <= -5.1e-8)
		tmp = t_1;
	elseif (t <= 0.24)
		tmp = abs(fma(eh, sin(atan(Float64(eh / Float64(ew * tan(t))))), Float64(t * ew)));
	else
		tmp = t_1;
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -5.1e-8], t$95$1, If[LessEqual[t, 0.24], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;t \leq -5.1 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.10000000000000001e-8 or 0.23999999999999999 < t

    1. Initial program 99.7%

      \[\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. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. un-div-invN/A

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. clear-numN/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. /-lowering-/.f64N/A

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6450.6

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

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

    if -5.10000000000000001e-8 < t < 0.23999999999999999

    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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. un-div-invN/A

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. clear-numN/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. /-lowering-/.f64N/A

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

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

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

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)} + ew \cdot \sin t\right| \]
      2. accelerator-lowering-fma.f64N/A

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
      6. atan-lowering-atan.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
      7. /-lowering-/.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot \sin t\right)\right| \]
      8. *-lowering-*.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right), ew \cdot \sin t\right)\right| \]
      9. tan-lowering-tan.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh \cdot \cos t, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right), ew \cdot \sin t\right)\right| \]
      10. *-lowering-*.f64N/A

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

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

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

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right) + ew \cdot t}\right| \]
    9. Step-by-step derivation
      1. accelerator-lowering-fma.f64N/A

        \[\leadsto \left|\color{blue}{\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), ew \cdot t\right)}\right| \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot t\right)\right| \]
      3. atan-lowering-atan.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot t\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \tan t}\right)}, ew \cdot t\right)\right| \]
      5. *-lowering-*.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{\color{blue}{ew \cdot \tan t}}\right), ew \cdot t\right)\right| \]
      6. tan-lowering-tan.f64N/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right), ew \cdot t\right)\right| \]
      7. *-commutativeN/A

        \[\leadsto \left|\mathsf{fma}\left(eh, \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), \color{blue}{t \cdot ew}\right)\right| \]
      8. *-lowering-*.f6496.9

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

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

Alternative 9: 67.8% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;ew \leq -8.5 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -8.50000000000000035e61 or 2.80000000000000015e-10 < 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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. un-div-invN/A

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. clear-numN/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. /-lowering-/.f64N/A

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6468.1

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

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

    if -8.50000000000000035e61 < ew < 2.80000000000000015e-10

    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

      \[\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. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\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| \]
      2. *-commutativeN/A

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

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

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

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot t}\right)}\right| \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)}\right| \]
      2. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)}\right| \]
      3. *-lowering-*.f64N/A

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

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

        \[\leadsto \left|\left(eh \cdot \cos t\right) \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)}\right| \]
      6. atan-lowering-atan.f64N/A

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

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

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

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

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

Alternative 10: 58.0% accurate, 7.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|ew \cdot \sin t\right|\\ \mathbf{if}\;ew \leq -9.6 \cdot 10^{-85}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 1.45 \cdot 10^{-8}:\\ \;\;\;\;\left|eh\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* ew (sin t)))))
   (if (<= ew -9.6e-85) t_1 (if (<= ew 1.45e-8) (fabs eh) t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((ew * sin(t)));
	double tmp;
	if (ew <= -9.6e-85) {
		tmp = t_1;
	} else if (ew <= 1.45e-8) {
		tmp = fabs(eh);
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = abs((ew * sin(t)))
    if (ew <= (-9.6d-85)) then
        tmp = t_1
    else if (ew <= 1.45d-8) then
        tmp = abs(eh)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.abs((ew * Math.sin(t)));
	double tmp;
	if (ew <= -9.6e-85) {
		tmp = t_1;
	} else if (ew <= 1.45e-8) {
		tmp = Math.abs(eh);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((ew * math.sin(t)))
	tmp = 0
	if ew <= -9.6e-85:
		tmp = t_1
	elif ew <= 1.45e-8:
		tmp = math.fabs(eh)
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(ew * sin(t)))
	tmp = 0.0
	if (ew <= -9.6e-85)
		tmp = t_1;
	elseif (ew <= 1.45e-8)
		tmp = abs(eh);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((ew * sin(t)));
	tmp = 0.0;
	if (ew <= -9.6e-85)
		tmp = t_1;
	elseif (ew <= 1.45e-8)
		tmp = abs(eh);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -9.6e-85], t$95$1, If[LessEqual[ew, 1.45e-8], N[Abs[eh], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|ew \cdot \sin t\right|\\
\mathbf{if}\;ew \leq -9.6 \cdot 10^{-85}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;ew \leq 1.45 \cdot 10^{-8}:\\
\;\;\;\;\left|eh\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -9.6000000000000002e-85 or 1.4500000000000001e-8 < 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. Add Preprocessing
    3. Step-by-step derivation
      1. cos-atanN/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      2. un-div-invN/A

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      3. clear-numN/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      4. /-lowering-/.f64N/A

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
      5. /-lowering-/.f64N/A

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
      2. sin-lowering-sin.f6464.0

        \[\leadsto \left|ew \cdot \color{blue}{\sin t}\right| \]
    7. Simplified64.0%

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

    if -9.6000000000000002e-85 < ew < 1.4500000000000001e-8

    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

      \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto \left|eh \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      3. atan-lowering-atan.f64N/A

        \[\leadsto \left|eh \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      4. /-lowering-/.f64N/A

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

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

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

      \[\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-atanN/A

        \[\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. div-invN/A

        \[\leadsto \left|eh \cdot \frac{\color{blue}{eh \cdot \frac{1}{ew \cdot \tan t}}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}\right| \]
      3. associate-/l*N/A

        \[\leadsto \left|eh \cdot \color{blue}{\left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}\right)}\right| \]
      4. associate-/r*N/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\frac{\frac{eh}{ew}}{\tan t}} \cdot \frac{eh}{ew \cdot \tan t}}}\right)\right| \]
      5. associate-/r*N/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \color{blue}{\frac{\frac{eh}{ew}}{\tan t}}}}\right)\right| \]
      6. associate-/r*N/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\frac{eh}{ew \cdot \tan t}} \cdot \frac{\frac{eh}{ew}}{\tan t}}}\right)\right| \]
      7. div-invN/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\left(eh \cdot \frac{1}{ew \cdot \tan t}\right)} \cdot \frac{\frac{eh}{ew}}{\tan t}}}\right)\right| \]
      8. associate-/r*N/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot \frac{1}{ew \cdot \tan t}\right) \cdot \color{blue}{\frac{eh}{ew \cdot \tan t}}}}\right)\right| \]
      9. div-invN/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot \frac{1}{ew \cdot \tan t}\right) \cdot \color{blue}{\left(eh \cdot \frac{1}{ew \cdot \tan t}\right)}}}\right)\right| \]
      10. swap-sqrN/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\left(eh \cdot eh\right) \cdot \left(\frac{1}{ew \cdot \tan t} \cdot \frac{1}{ew \cdot \tan t}\right)}}}\right)\right| \]
      11. inv-powN/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot eh\right) \cdot \left(\color{blue}{{\left(ew \cdot \tan t\right)}^{-1}} \cdot \frac{1}{ew \cdot \tan t}\right)}}\right)\right| \]
      12. inv-powN/A

        \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot eh\right) \cdot \left({\left(ew \cdot \tan t\right)}^{-1} \cdot \color{blue}{{\left(ew \cdot \tan t\right)}^{-1}}\right)}}\right)\right| \]
    7. Applied egg-rr3.9%

      \[\leadsto \left|eh \cdot \color{blue}{\left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(ew \cdot \tan t\right)}^{-2}, 1\right)}}\right)}\right| \]
    8. Taylor expanded in eh around inf

      \[\leadsto \left|\color{blue}{eh}\right| \]
    9. Step-by-step derivation
      1. Simplified56.5%

        \[\leadsto \left|\color{blue}{eh}\right| \]
    10. Recombined 2 regimes into one program.
    11. Add Preprocessing

    Alternative 11: 43.2% accurate, 43.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -9 \cdot 10^{-164}:\\ \;\;\;\;\left|eh\right|\\ \mathbf{elif}\;eh \leq 0.05:\\ \;\;\;\;\left|t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh\right|\\ \end{array} \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (if (<= eh -9e-164) (fabs eh) (if (<= eh 0.05) (fabs (* t ew)) (fabs eh))))
    double code(double eh, double ew, double t) {
    	double tmp;
    	if (eh <= -9e-164) {
    		tmp = fabs(eh);
    	} else if (eh <= 0.05) {
    		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 (eh <= (-9d-164)) then
            tmp = abs(eh)
        else if (eh <= 0.05d0) 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 (eh <= -9e-164) {
    		tmp = Math.abs(eh);
    	} else if (eh <= 0.05) {
    		tmp = Math.abs((t * ew));
    	} else {
    		tmp = Math.abs(eh);
    	}
    	return tmp;
    }
    
    def code(eh, ew, t):
    	tmp = 0
    	if eh <= -9e-164:
    		tmp = math.fabs(eh)
    	elif eh <= 0.05:
    		tmp = math.fabs((t * ew))
    	else:
    		tmp = math.fabs(eh)
    	return tmp
    
    function code(eh, ew, t)
    	tmp = 0.0
    	if (eh <= -9e-164)
    		tmp = abs(eh);
    	elseif (eh <= 0.05)
    		tmp = abs(Float64(t * ew));
    	else
    		tmp = abs(eh);
    	end
    	return tmp
    end
    
    function tmp_2 = code(eh, ew, t)
    	tmp = 0.0;
    	if (eh <= -9e-164)
    		tmp = abs(eh);
    	elseif (eh <= 0.05)
    		tmp = abs((t * ew));
    	else
    		tmp = abs(eh);
    	end
    	tmp_2 = tmp;
    end
    
    code[eh_, ew_, t_] := If[LessEqual[eh, -9e-164], N[Abs[eh], $MachinePrecision], If[LessEqual[eh, 0.05], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], N[Abs[eh], $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;eh \leq -9 \cdot 10^{-164}:\\
    \;\;\;\;\left|eh\right|\\
    
    \mathbf{elif}\;eh \leq 0.05:\\
    \;\;\;\;\left|t \cdot ew\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;\left|eh\right|\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if eh < -8.9999999999999995e-164 or 0.050000000000000003 < 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. Add Preprocessing
      3. Taylor expanded in t around 0

        \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

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

          \[\leadsto \left|eh \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
        3. atan-lowering-atan.f64N/A

          \[\leadsto \left|eh \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
        4. /-lowering-/.f64N/A

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

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

          \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right)\right| \]
      5. Simplified49.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-atanN/A

          \[\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. div-invN/A

          \[\leadsto \left|eh \cdot \frac{\color{blue}{eh \cdot \frac{1}{ew \cdot \tan t}}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}\right| \]
        3. associate-/l*N/A

          \[\leadsto \left|eh \cdot \color{blue}{\left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}\right)}\right| \]
        4. associate-/r*N/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\frac{\frac{eh}{ew}}{\tan t}} \cdot \frac{eh}{ew \cdot \tan t}}}\right)\right| \]
        5. associate-/r*N/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \color{blue}{\frac{\frac{eh}{ew}}{\tan t}}}}\right)\right| \]
        6. associate-/r*N/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\frac{eh}{ew \cdot \tan t}} \cdot \frac{\frac{eh}{ew}}{\tan t}}}\right)\right| \]
        7. div-invN/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\left(eh \cdot \frac{1}{ew \cdot \tan t}\right)} \cdot \frac{\frac{eh}{ew}}{\tan t}}}\right)\right| \]
        8. associate-/r*N/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot \frac{1}{ew \cdot \tan t}\right) \cdot \color{blue}{\frac{eh}{ew \cdot \tan t}}}}\right)\right| \]
        9. div-invN/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot \frac{1}{ew \cdot \tan t}\right) \cdot \color{blue}{\left(eh \cdot \frac{1}{ew \cdot \tan t}\right)}}}\right)\right| \]
        10. swap-sqrN/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\left(eh \cdot eh\right) \cdot \left(\frac{1}{ew \cdot \tan t} \cdot \frac{1}{ew \cdot \tan t}\right)}}}\right)\right| \]
        11. inv-powN/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot eh\right) \cdot \left(\color{blue}{{\left(ew \cdot \tan t\right)}^{-1}} \cdot \frac{1}{ew \cdot \tan t}\right)}}\right)\right| \]
        12. inv-powN/A

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

        \[\leadsto \left|eh \cdot \color{blue}{\left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(ew \cdot \tan t\right)}^{-2}, 1\right)}}\right)}\right| \]
      8. Taylor expanded in eh around inf

        \[\leadsto \left|\color{blue}{eh}\right| \]
      9. Step-by-step derivation
        1. Simplified49.4%

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

        if -8.9999999999999995e-164 < eh < 0.050000000000000003

        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. Add Preprocessing
        3. Step-by-step derivation
          1. cos-atanN/A

            \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          2. un-div-invN/A

            \[\leadsto \left|\color{blue}{\frac{ew \cdot \sin t}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          3. clear-numN/A

            \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          4. /-lowering-/.f64N/A

            \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}{ew \cdot \sin t}}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
          5. /-lowering-/.f64N/A

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

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

          \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
        6. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
          2. sin-lowering-sin.f6476.6

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

          \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
        8. Taylor expanded in t around 0

          \[\leadsto \left|\color{blue}{ew \cdot t}\right| \]
        9. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
          2. *-lowering-*.f6439.1

            \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
        10. Simplified39.1%

          \[\leadsto \left|\color{blue}{t \cdot ew}\right| \]
      10. Recombined 2 regimes into one program.
      11. Add Preprocessing

      Alternative 12: 42.4% accurate, 290.0× speedup?

      \[\begin{array}{l} \\ \left|eh\right| \end{array} \]
      (FPCore (eh ew t) :precision binary64 (fabs eh))
      double code(double eh, double ew, double t) {
      	return fabs(eh);
      }
      
      real(8) function code(eh, ew, t)
          real(8), intent (in) :: eh
          real(8), intent (in) :: ew
          real(8), intent (in) :: t
          code = abs(eh)
      end function
      
      public static double code(double eh, double ew, double t) {
      	return Math.abs(eh);
      }
      
      def code(eh, ew, t):
      	return math.fabs(eh)
      
      function code(eh, ew, t)
      	return abs(eh)
      end
      
      function tmp = code(eh, ew, t)
      	tmp = abs(eh);
      end
      
      code[eh_, ew_, t_] := N[Abs[eh], $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \left|eh\right|
      \end{array}
      
      Derivation
      1. Initial program 99.8%

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

        \[\leadsto \left|\color{blue}{eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
      4. Step-by-step derivation
        1. *-lowering-*.f64N/A

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

          \[\leadsto \left|eh \cdot \color{blue}{\sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
        3. atan-lowering-atan.f64N/A

          \[\leadsto \left|eh \cdot \sin \color{blue}{\tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)}\right| \]
        4. /-lowering-/.f64N/A

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

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

          \[\leadsto \left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \color{blue}{\tan t}}\right)\right| \]
      5. Simplified39.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-atanN/A

          \[\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. div-invN/A

          \[\leadsto \left|eh \cdot \frac{\color{blue}{eh \cdot \frac{1}{ew \cdot \tan t}}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}\right| \]
        3. associate-/l*N/A

          \[\leadsto \left|eh \cdot \color{blue}{\left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \frac{eh}{ew \cdot \tan t} \cdot \frac{eh}{ew \cdot \tan t}}}\right)}\right| \]
        4. associate-/r*N/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\frac{\frac{eh}{ew}}{\tan t}} \cdot \frac{eh}{ew \cdot \tan t}}}\right)\right| \]
        5. associate-/r*N/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \color{blue}{\frac{\frac{eh}{ew}}{\tan t}}}}\right)\right| \]
        6. associate-/r*N/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\frac{eh}{ew \cdot \tan t}} \cdot \frac{\frac{eh}{ew}}{\tan t}}}\right)\right| \]
        7. div-invN/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\left(eh \cdot \frac{1}{ew \cdot \tan t}\right)} \cdot \frac{\frac{eh}{ew}}{\tan t}}}\right)\right| \]
        8. associate-/r*N/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot \frac{1}{ew \cdot \tan t}\right) \cdot \color{blue}{\frac{eh}{ew \cdot \tan t}}}}\right)\right| \]
        9. div-invN/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot \frac{1}{ew \cdot \tan t}\right) \cdot \color{blue}{\left(eh \cdot \frac{1}{ew \cdot \tan t}\right)}}}\right)\right| \]
        10. swap-sqrN/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \color{blue}{\left(eh \cdot eh\right) \cdot \left(\frac{1}{ew \cdot \tan t} \cdot \frac{1}{ew \cdot \tan t}\right)}}}\right)\right| \]
        11. inv-powN/A

          \[\leadsto \left|eh \cdot \left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{1 + \left(eh \cdot eh\right) \cdot \left(\color{blue}{{\left(ew \cdot \tan t\right)}^{-1}} \cdot \frac{1}{ew \cdot \tan t}\right)}}\right)\right| \]
        12. inv-powN/A

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

        \[\leadsto \left|eh \cdot \color{blue}{\left(eh \cdot \frac{\frac{1}{ew \cdot \tan t}}{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(ew \cdot \tan t\right)}^{-2}, 1\right)}}\right)}\right| \]
      8. Taylor expanded in eh around inf

        \[\leadsto \left|\color{blue}{eh}\right| \]
      9. Step-by-step derivation
        1. Simplified39.9%

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

        Reproduce

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