Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 19.0s
Alternatives: 9
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 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\\
\left|\mathsf{fma}\left(\sin t \cdot \cos t\_1, ew, \left(\cos t \cdot eh\right) \cdot \sin 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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(\cos \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot \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| \]
  5. Applied rewrites99.8%

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

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

Alternative 2: 99.0% accurate, 1.1× speedup?

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

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

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

    \[\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. lower-/.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. lower-*.f6499.2

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

    \[\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| \]
  6. Final simplification99.2%

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

Alternative 3: 98.4% accurate, 1.6× speedup?

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

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

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

      \[\leadsto \left|\color{blue}{\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. lift-cos.f64N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\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| \]
    3. lift-atan.f64N/A

      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\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| \]
    4. 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| \]
    5. 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| \]
    6. 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| \]
    7. lower-/.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| \]
    8. lower-/.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 rewrites87.5%

    \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(\tan t \cdot ew\right)}^{-2}, 1\right)}}{\sin t \cdot ew}}} + \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. lower-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 90.1% accurate, 1.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.15000000000000001e-213 or 4.80000000000000017e-82 < ew

    1. Initial program 99.8%

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

        \[\leadsto \left|\color{blue}{\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. lift-cos.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\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| \]
      3. lift-atan.f64N/A

        \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\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| \]
      4. 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| \]
      5. 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| \]
      6. 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| \]
      7. lower-/.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| \]
      8. lower-/.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 rewrites89.4%

      \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(\tan t \cdot ew\right)}^{-2}, 1\right)}}{\sin t \cdot ew}}} + \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|\frac{1}{\frac{\color{blue}{1}}{\sin t \cdot ew}} + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    6. Step-by-step derivation
      1. Applied rewrites97.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -1.15000000000000001e-213 < ew < 4.80000000000000017e-82

      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 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -1.15 \cdot 10^{-213}:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{1}{\frac{1}{\sin t}}, ew, \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) \cdot \left(\cos t \cdot eh\right)\right)\right|\\ \mathbf{elif}\;ew \leq 4.8 \cdot 10^{-82}:\\ \;\;\;\;\left|\left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{1}{\frac{1}{\sin t}}, ew, \sin \tan^{-1} \left(\frac{eh}{t \cdot ew}\right) \cdot \left(\cos t \cdot eh\right)\right)\right|\\ \end{array} \]
    9. Add Preprocessing

    Alternative 5: 74.6% accurate, 2.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\\ t_2 := \left|\sin t \cdot ew\right|\\ \mathbf{if}\;t \leq -2.1 \cdot 10^{+173}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -220000:\\ \;\;\;\;\left|\left(\cos t \cdot eh\right) \cdot t\_1\right|\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\ \;\;\;\;\left|\mathsf{fma}\left(t\_1, eh, t \cdot ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (let* ((t_1 (sin (atan (/ eh (* (tan t) ew))))) (t_2 (fabs (* (sin t) ew))))
       (if (<= t -2.1e+173)
         t_2
         (if (<= t -220000.0)
           (fabs (* (* (cos t) eh) t_1))
           (if (<= t 1.75e-6) (fabs (fma t_1 eh (* t ew))) t_2)))))
    double code(double eh, double ew, double t) {
    	double t_1 = sin(atan((eh / (tan(t) * ew))));
    	double t_2 = fabs((sin(t) * ew));
    	double tmp;
    	if (t <= -2.1e+173) {
    		tmp = t_2;
    	} else if (t <= -220000.0) {
    		tmp = fabs(((cos(t) * eh) * t_1));
    	} else if (t <= 1.75e-6) {
    		tmp = fabs(fma(t_1, eh, (t * ew)));
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    function code(eh, ew, t)
    	t_1 = sin(atan(Float64(eh / Float64(tan(t) * ew))))
    	t_2 = abs(Float64(sin(t) * ew))
    	tmp = 0.0
    	if (t <= -2.1e+173)
    		tmp = t_2;
    	elseif (t <= -220000.0)
    		tmp = abs(Float64(Float64(cos(t) * eh) * t_1));
    	elseif (t <= 1.75e-6)
    		tmp = abs(fma(t_1, eh, Float64(t * ew)));
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    code[eh_, ew_, t_] := Block[{t$95$1 = N[Sin[N[ArcTan[N[(eh / N[(N[Tan[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -2.1e+173], t$95$2, If[LessEqual[t, -220000.0], N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 1.75e-6], N[Abs[N[(t$95$1 * eh + N[(t * ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\\
    t_2 := \left|\sin t \cdot ew\right|\\
    \mathbf{if}\;t \leq -2.1 \cdot 10^{+173}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;t \leq -220000:\\
    \;\;\;\;\left|\left(\cos t \cdot eh\right) \cdot t\_1\right|\\
    
    \mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\
    \;\;\;\;\left|\mathsf{fma}\left(t\_1, eh, t \cdot ew\right)\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if t < -2.1e173 or 1.74999999999999997e-6 < 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. lift-*.f64N/A

          \[\leadsto \left|\color{blue}{\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. lift-cos.f64N/A

          \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\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| \]
        3. lift-atan.f64N/A

          \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\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| \]
        4. 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| \]
        5. 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| \]
        6. 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| \]
        7. lower-/.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| \]
        8. lower-/.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 rewrites91.0%

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(\tan t \cdot ew\right)}^{-2}, 1\right)}}{\sin t \cdot ew}}} + \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. *-commutativeN/A

          \[\leadsto \left|\color{blue}{\sin t \cdot ew}\right| \]
        2. lower-*.f64N/A

          \[\leadsto \left|\color{blue}{\sin t \cdot ew}\right| \]
        3. lower-sin.f6463.0

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

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

      if -2.1e173 < t < -2.2e5

      1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.2e5 < t < 1.74999999999999997e-6

      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. lift-*.f64N/A

          \[\leadsto \left|\color{blue}{\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. lift-cos.f64N/A

          \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\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| \]
        3. lift-atan.f64N/A

          \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\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| \]
        4. 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| \]
        5. 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| \]
        6. 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| \]
        7. lower-/.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| \]
        8. lower-/.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 rewrites84.5%

        \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(\tan t \cdot ew\right)}^{-2}, 1\right)}}{\sin t \cdot ew}}} + \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. lower-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{+173}:\\ \;\;\;\;\left|\sin t \cdot ew\right|\\ \mathbf{elif}\;t \leq -220000:\\ \;\;\;\;\left|\left(\cos t \cdot eh\right) \cdot \sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right|\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\ \;\;\;\;\left|\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), eh, t \cdot ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\sin t \cdot ew\right|\\ \end{array} \]
      12. Add Preprocessing

      Alternative 6: 74.7% accurate, 2.5× speedup?

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

        1. Initial program 99.6%

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

            \[\leadsto \left|\color{blue}{\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. lift-cos.f64N/A

            \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\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| \]
          3. lift-atan.f64N/A

            \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\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| \]
          4. 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| \]
          5. 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| \]
          6. 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| \]
          7. lower-/.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| \]
          8. lower-/.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 rewrites90.5%

          \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(\tan t \cdot ew\right)}^{-2}, 1\right)}}{\sin t \cdot ew}}} + \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. *-commutativeN/A

            \[\leadsto \left|\color{blue}{\sin t \cdot ew}\right| \]
          2. lower-*.f64N/A

            \[\leadsto \left|\color{blue}{\sin t \cdot ew}\right| \]
          3. lower-sin.f6456.5

            \[\leadsto \left|\color{blue}{\sin t} \cdot ew\right| \]
        7. Applied rewrites56.5%

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

        if -5.0000000000000001e-4 < t < 1.74999999999999997e-6

        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. lift-*.f64N/A

            \[\leadsto \left|\color{blue}{\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. lift-cos.f64N/A

            \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\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| \]
          3. lift-atan.f64N/A

            \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\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| \]
          4. 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| \]
          5. 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| \]
          6. 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| \]
          7. lower-/.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| \]
          8. lower-/.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 rewrites84.3%

          \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(\tan t \cdot ew\right)}^{-2}, 1\right)}}{\sin t \cdot ew}}} + \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. lower-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left|\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), \color{blue}{eh}, ew \cdot t\right)\right| \]
        10. Recombined 2 regimes into one program.
        11. Final simplification76.6%

          \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -0.0005:\\ \;\;\;\;\left|\sin t \cdot ew\right|\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\ \;\;\;\;\left|\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{eh}{\tan t \cdot ew}\right), eh, t \cdot ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\sin t \cdot ew\right|\\ \end{array} \]
        12. Add Preprocessing

        Alternative 7: 61.8% accurate, 7.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\sin t \cdot ew\right|\\ \mathbf{if}\;t \leq -3.6 \cdot 10^{-36}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{-6}:\\ \;\;\;\;\left|-eh\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (let* ((t_1 (fabs (* (sin t) ew))))
           (if (<= t -3.6e-36) t_1 (if (<= t 1.6e-6) (fabs (- eh)) t_1))))
        double code(double eh, double ew, double t) {
        	double t_1 = fabs((sin(t) * ew));
        	double tmp;
        	if (t <= -3.6e-36) {
        		tmp = t_1;
        	} else if (t <= 1.6e-6) {
        		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((sin(t) * ew))
            if (t <= (-3.6d-36)) then
                tmp = t_1
            else if (t <= 1.6d-6) 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((Math.sin(t) * ew));
        	double tmp;
        	if (t <= -3.6e-36) {
        		tmp = t_1;
        	} else if (t <= 1.6e-6) {
        		tmp = Math.abs(-eh);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(eh, ew, t):
        	t_1 = math.fabs((math.sin(t) * ew))
        	tmp = 0
        	if t <= -3.6e-36:
        		tmp = t_1
        	elif t <= 1.6e-6:
        		tmp = math.fabs(-eh)
        	else:
        		tmp = t_1
        	return tmp
        
        function code(eh, ew, t)
        	t_1 = abs(Float64(sin(t) * ew))
        	tmp = 0.0
        	if (t <= -3.6e-36)
        		tmp = t_1;
        	elseif (t <= 1.6e-6)
        		tmp = abs(Float64(-eh));
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(eh, ew, t)
        	t_1 = abs((sin(t) * ew));
        	tmp = 0.0;
        	if (t <= -3.6e-36)
        		tmp = t_1;
        	elseif (t <= 1.6e-6)
        		tmp = abs(-eh);
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -3.6e-36], t$95$1, If[LessEqual[t, 1.6e-6], N[Abs[(-eh)], $MachinePrecision], t$95$1]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left|\sin t \cdot ew\right|\\
        \mathbf{if}\;t \leq -3.6 \cdot 10^{-36}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;t \leq 1.6 \cdot 10^{-6}:\\
        \;\;\;\;\left|-eh\right|\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if t < -3.60000000000000032e-36 or 1.5999999999999999e-6 < t

          1. Initial program 99.6%

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

              \[\leadsto \left|\color{blue}{\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. lift-cos.f64N/A

              \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\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| \]
            3. lift-atan.f64N/A

              \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\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| \]
            4. 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| \]
            5. 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| \]
            6. 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| \]
            7. lower-/.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| \]
            8. lower-/.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 rewrites90.3%

            \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(\tan t \cdot ew\right)}^{-2}, 1\right)}}{\sin t \cdot ew}}} + \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. *-commutativeN/A

              \[\leadsto \left|\color{blue}{\sin t \cdot ew}\right| \]
            2. lower-*.f64N/A

              \[\leadsto \left|\color{blue}{\sin t \cdot ew}\right| \]
            3. lower-sin.f6456.7

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

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

          if -3.60000000000000032e-36 < t < 1.5999999999999999e-6

          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. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left|-1 \cdot \color{blue}{eh}\right| \]
            3. Step-by-step derivation
              1. Applied rewrites79.6%

                \[\leadsto \left|-eh\right| \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 8: 45.3% accurate, 43.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|-eh\right|\\ \mathbf{if}\;eh \leq -1.4 \cdot 10^{-131}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 2.2 \cdot 10^{-228}:\\ \;\;\;\;\left|t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
            (FPCore (eh ew t)
             :precision binary64
             (let* ((t_1 (fabs (- eh))))
               (if (<= eh -1.4e-131) t_1 (if (<= eh 2.2e-228) (fabs (* t ew)) t_1))))
            double code(double eh, double ew, double t) {
            	double t_1 = fabs(-eh);
            	double tmp;
            	if (eh <= -1.4e-131) {
            		tmp = t_1;
            	} else if (eh <= 2.2e-228) {
            		tmp = fabs((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(-eh)
                if (eh <= (-1.4d-131)) then
                    tmp = t_1
                else if (eh <= 2.2d-228) then
                    tmp = abs((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(-eh);
            	double tmp;
            	if (eh <= -1.4e-131) {
            		tmp = t_1;
            	} else if (eh <= 2.2e-228) {
            		tmp = Math.abs((t * ew));
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            def code(eh, ew, t):
            	t_1 = math.fabs(-eh)
            	tmp = 0
            	if eh <= -1.4e-131:
            		tmp = t_1
            	elif eh <= 2.2e-228:
            		tmp = math.fabs((t * ew))
            	else:
            		tmp = t_1
            	return tmp
            
            function code(eh, ew, t)
            	t_1 = abs(Float64(-eh))
            	tmp = 0.0
            	if (eh <= -1.4e-131)
            		tmp = t_1;
            	elseif (eh <= 2.2e-228)
            		tmp = abs(Float64(t * ew));
            	else
            		tmp = t_1;
            	end
            	return tmp
            end
            
            function tmp_2 = code(eh, ew, t)
            	t_1 = abs(-eh);
            	tmp = 0.0;
            	if (eh <= -1.4e-131)
            		tmp = t_1;
            	elseif (eh <= 2.2e-228)
            		tmp = abs((t * ew));
            	else
            		tmp = t_1;
            	end
            	tmp_2 = tmp;
            end
            
            code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[(-eh)], $MachinePrecision]}, If[LessEqual[eh, -1.4e-131], t$95$1, If[LessEqual[eh, 2.2e-228], N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision], t$95$1]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_1 := \left|-eh\right|\\
            \mathbf{if}\;eh \leq -1.4 \cdot 10^{-131}:\\
            \;\;\;\;t\_1\\
            
            \mathbf{elif}\;eh \leq 2.2 \cdot 10^{-228}:\\
            \;\;\;\;\left|t \cdot ew\right|\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if eh < -1.4e-131 or 2.2e-228 < 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left|-eh\right| \]

                  if -1.4e-131 < eh < 2.2e-228

                  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. lift-*.f64N/A

                      \[\leadsto \left|\color{blue}{\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. lift-cos.f64N/A

                      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \color{blue}{\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| \]
                    3. lift-atan.f64N/A

                      \[\leadsto \left|\left(ew \cdot \sin t\right) \cdot \cos \color{blue}{\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| \]
                    4. 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| \]
                    5. 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| \]
                    6. 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| \]
                    7. lower-/.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| \]
                    8. lower-/.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 rewrites72.2%

                    \[\leadsto \left|\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(eh \cdot eh, {\left(\tan t \cdot ew\right)}^{-2}, 1\right)}}{\sin t \cdot ew}}} + \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. *-commutativeN/A

                      \[\leadsto \left|\color{blue}{\sin t \cdot ew}\right| \]
                    2. lower-*.f64N/A

                      \[\leadsto \left|\color{blue}{\sin t \cdot ew}\right| \]
                    3. lower-sin.f6485.3

                      \[\leadsto \left|\color{blue}{\sin t} \cdot ew\right| \]
                  7. Applied rewrites85.3%

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

                    \[\leadsto \left|ew \cdot \color{blue}{t}\right| \]
                  9. Step-by-step derivation
                    1. Applied rewrites35.8%

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -1.4 \cdot 10^{-131}:\\ \;\;\;\;\left|-eh\right|\\ \mathbf{elif}\;eh \leq 2.2 \cdot 10^{-228}:\\ \;\;\;\;\left|t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\left|-eh\right|\\ \end{array} \]
                  12. Add Preprocessing

                  Alternative 9: 42.9% accurate, 174.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(Float64(-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left|-eh\right| \]
                      2. Add Preprocessing

                      Reproduce

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