Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 18.7s
Alternatives: 12
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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.1× speedup?

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

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

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

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 1.1× speedup?

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

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

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

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

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

Alternative 3: 98.5% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 4: 73.8% accurate, 1.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left|\cos t \cdot \left(eh \cdot \sin t\_1\right)\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.3e8 or 2.8e18 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.3e8 < ew < 2.8e18

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 73.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{eh}{ew \cdot \tan t}\\ \mathbf{if}\;ew \leq -290000000 \lor \neg \left(ew \leq 5.4 \cdot 10^{+18}\right):\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, t\_1\right)}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\cos t \cdot \left(eh \cdot \sin \tan^{-1} t\_1\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ eh (* ew (tan t)))))
   (if (or (<= ew -290000000.0) (not (<= ew 5.4e+18)))
     (fabs (* (* ew (sin t)) (/ 1.0 (hypot 1.0 t_1))))
     (fabs (* (cos t) (* eh (sin (atan t_1))))))))
double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * tan(t));
	double tmp;
	if ((ew <= -290000000.0) || !(ew <= 5.4e+18)) {
		tmp = fabs(((ew * sin(t)) * (1.0 / hypot(1.0, t_1))));
	} else {
		tmp = fabs((cos(t) * (eh * sin(atan(t_1)))));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * Math.tan(t));
	double tmp;
	if ((ew <= -290000000.0) || !(ew <= 5.4e+18)) {
		tmp = Math.abs(((ew * Math.sin(t)) * (1.0 / Math.hypot(1.0, t_1))));
	} else {
		tmp = Math.abs((Math.cos(t) * (eh * Math.sin(Math.atan(t_1)))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = eh / (ew * math.tan(t))
	tmp = 0
	if (ew <= -290000000.0) or not (ew <= 5.4e+18):
		tmp = math.fabs(((ew * math.sin(t)) * (1.0 / math.hypot(1.0, t_1))))
	else:
		tmp = math.fabs((math.cos(t) * (eh * math.sin(math.atan(t_1)))))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(eh / Float64(ew * tan(t)))
	tmp = 0.0
	if ((ew <= -290000000.0) || !(ew <= 5.4e+18))
		tmp = abs(Float64(Float64(ew * sin(t)) * Float64(1.0 / hypot(1.0, t_1))));
	else
		tmp = abs(Float64(cos(t) * Float64(eh * sin(atan(t_1)))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = eh / (ew * tan(t));
	tmp = 0.0;
	if ((ew <= -290000000.0) || ~((ew <= 5.4e+18)))
		tmp = abs(((ew * sin(t)) * (1.0 / hypot(1.0, t_1))));
	else
		tmp = abs((cos(t) * (eh * sin(atan(t_1)))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -290000000.0], N[Not[LessEqual[ew, 5.4e+18]], $MachinePrecision]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Cos[t], $MachinePrecision] * N[(eh * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot \tan t}\\
\mathbf{if}\;ew \leq -290000000 \lor \neg \left(ew \leq 5.4 \cdot 10^{+18}\right):\\
\;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, t\_1\right)}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.9e8 or 5.4e18 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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}}}}\right| \]
      3. hypot-1-def70.9%

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

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

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

    if -2.9e8 < ew < 5.4e18

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 60.5% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{eh}{ew \cdot \tan t}\\ \mathbf{if}\;t \leq -5.8 \cdot 10^{-113} \lor \neg \left(t \leq 1.1 \cdot 10^{-17}\right):\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, t\_1\right)}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} t\_1\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ eh (* ew (tan t)))))
   (if (or (<= t -5.8e-113) (not (<= t 1.1e-17)))
     (fabs (* (* ew (sin t)) (/ 1.0 (hypot 1.0 t_1))))
     (fabs (* eh (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * tan(t));
	double tmp;
	if ((t <= -5.8e-113) || !(t <= 1.1e-17)) {
		tmp = fabs(((ew * sin(t)) * (1.0 / hypot(1.0, t_1))));
	} else {
		tmp = fabs((eh * sin(atan(t_1))));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * Math.tan(t));
	double tmp;
	if ((t <= -5.8e-113) || !(t <= 1.1e-17)) {
		tmp = Math.abs(((ew * Math.sin(t)) * (1.0 / Math.hypot(1.0, t_1))));
	} else {
		tmp = Math.abs((eh * Math.sin(Math.atan(t_1))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = eh / (ew * math.tan(t))
	tmp = 0
	if (t <= -5.8e-113) or not (t <= 1.1e-17):
		tmp = math.fabs(((ew * math.sin(t)) * (1.0 / math.hypot(1.0, t_1))))
	else:
		tmp = math.fabs((eh * math.sin(math.atan(t_1))))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(eh / Float64(ew * tan(t)))
	tmp = 0.0
	if ((t <= -5.8e-113) || !(t <= 1.1e-17))
		tmp = abs(Float64(Float64(ew * sin(t)) * Float64(1.0 / hypot(1.0, t_1))));
	else
		tmp = abs(Float64(eh * sin(atan(t_1))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = eh / (ew * tan(t));
	tmp = 0.0;
	if ((t <= -5.8e-113) || ~((t <= 1.1e-17)))
		tmp = abs(((ew * sin(t)) * (1.0 / hypot(1.0, t_1))));
	else
		tmp = abs((eh * sin(atan(t_1))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -5.8e-113], N[Not[LessEqual[t, 1.1e-17]], $MachinePrecision]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot \tan t}\\
\mathbf{if}\;t \leq -5.8 \cdot 10^{-113} \lor \neg \left(t \leq 1.1 \cdot 10^{-17}\right):\\
\;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, t\_1\right)}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.80000000000000008e-113 or 1.1e-17 < 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. Step-by-step derivation
      1. fma-define99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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}}}}\right| \]
      3. hypot-1-def60.6%

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

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

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

    if -5.80000000000000008e-113 < t < 1.1e-17

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.8 \cdot 10^{-113} \lor \neg \left(t \leq 1.1 \cdot 10^{-17}\right):\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 50.6% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{-113} \lor \neg \left(t \leq 1.9 \cdot 10^{-22}\right):\\
\;\;\;\;ew \cdot \sin t + eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.80000000000000008e-113 or 1.90000000000000012e-22 < 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. Step-by-step derivation
      1. fma-define99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.80000000000000008e-113 < t < 1.90000000000000012e-22

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 8: 47.7% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{eh}{ew \cdot \tan t}\\ \mathbf{if}\;t \leq -1.08 \cdot 10^{-63} \lor \neg \left(t \leq 3.4 \cdot 10^{-16}\right):\\ \;\;\;\;\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t\_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} t\_1\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ eh (* ew (tan t)))))
   (if (or (<= t -1.08e-63) (not (<= t 3.4e-16)))
     (/ (* ew (sin t)) (hypot 1.0 t_1))
     (fabs (* eh (sin (atan t_1)))))))
double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * tan(t));
	double tmp;
	if ((t <= -1.08e-63) || !(t <= 3.4e-16)) {
		tmp = (ew * sin(t)) / hypot(1.0, t_1);
	} else {
		tmp = fabs((eh * sin(atan(t_1))));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * Math.tan(t));
	double tmp;
	if ((t <= -1.08e-63) || !(t <= 3.4e-16)) {
		tmp = (ew * Math.sin(t)) / Math.hypot(1.0, t_1);
	} else {
		tmp = Math.abs((eh * Math.sin(Math.atan(t_1))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = eh / (ew * math.tan(t))
	tmp = 0
	if (t <= -1.08e-63) or not (t <= 3.4e-16):
		tmp = (ew * math.sin(t)) / math.hypot(1.0, t_1)
	else:
		tmp = math.fabs((eh * math.sin(math.atan(t_1))))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(eh / Float64(ew * tan(t)))
	tmp = 0.0
	if ((t <= -1.08e-63) || !(t <= 3.4e-16))
		tmp = Float64(Float64(ew * sin(t)) / hypot(1.0, t_1));
	else
		tmp = abs(Float64(eh * sin(atan(t_1))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = eh / (ew * tan(t));
	tmp = 0.0;
	if ((t <= -1.08e-63) || ~((t <= 3.4e-16)))
		tmp = (ew * sin(t)) / hypot(1.0, t_1);
	else
		tmp = abs((eh * sin(atan(t_1))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -1.08e-63], N[Not[LessEqual[t, 3.4e-16]], $MachinePrecision]], N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision], N[Abs[N[(eh * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot \tan t}\\
\mathbf{if}\;t \leq -1.08 \cdot 10^{-63} \lor \neg \left(t \leq 3.4 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t\_1\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.07999999999999994e-63 or 3.4e-16 < 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. Step-by-step derivation
      1. fma-define99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      4. hypot-1-def60.7%

        \[\leadsto \left|\left(ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right| \]
      5. div-inv60.7%

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right| \]
      6. add-sqr-sqrt36.8%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}} \cdot \sqrt{\frac{ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}}\right| \]
      7. fabs-sqr36.8%

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

        \[\leadsto \color{blue}{\frac{ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}} \]
      9. log1p-expm1-u37.3%

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

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

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

    if -1.07999999999999994e-63 < t < 3.4e-16

    1. Initial program 100.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.08 \cdot 10^{-63} \lor \neg \left(t \leq 3.4 \cdot 10^{-16}\right):\\ \;\;\;\;\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 47.7% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.08 \cdot 10^{-63} \lor \neg \left(t \leq 1.46 \cdot 10^{-16}\right):\\ \;\;\;\;\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (or (<= t -1.08e-63) (not (<= t 1.46e-16)))
   (/ (* ew (sin t)) (hypot 1.0 (/ eh (* ew (tan t)))))
   (fabs (* eh (sin (atan (/ (/ eh ew) t)))))))
double code(double eh, double ew, double t) {
	double tmp;
	if ((t <= -1.08e-63) || !(t <= 1.46e-16)) {
		tmp = (ew * sin(t)) / hypot(1.0, (eh / (ew * tan(t))));
	} else {
		tmp = fabs((eh * sin(atan(((eh / ew) / t)))));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double tmp;
	if ((t <= -1.08e-63) || !(t <= 1.46e-16)) {
		tmp = (ew * Math.sin(t)) / Math.hypot(1.0, (eh / (ew * Math.tan(t))));
	} else {
		tmp = Math.abs((eh * Math.sin(Math.atan(((eh / ew) / t)))));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if (t <= -1.08e-63) or not (t <= 1.46e-16):
		tmp = (ew * math.sin(t)) / math.hypot(1.0, (eh / (ew * math.tan(t))))
	else:
		tmp = math.fabs((eh * math.sin(math.atan(((eh / ew) / t)))))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if ((t <= -1.08e-63) || !(t <= 1.46e-16))
		tmp = Float64(Float64(ew * sin(t)) / hypot(1.0, Float64(eh / Float64(ew * tan(t)))));
	else
		tmp = abs(Float64(eh * sin(atan(Float64(Float64(eh / ew) / t)))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if ((t <= -1.08e-63) || ~((t <= 1.46e-16)))
		tmp = (ew * sin(t)) / hypot(1.0, (eh / (ew * tan(t))));
	else
		tmp = abs((eh * sin(atan(((eh / ew) / t)))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[Or[LessEqual[t, -1.08e-63], N[Not[LessEqual[t, 1.46e-16]], $MachinePrecision]], N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Abs[N[(eh * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.08 \cdot 10^{-63} \lor \neg \left(t \leq 1.46 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.07999999999999994e-63 or 1.4600000000000001e-16 < 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. Step-by-step derivation
      1. fma-define99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\left(ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)\right) \cdot \color{blue}{\frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{\tan t} \cdot \frac{\frac{eh}{ew}}{\tan t}}}}\right| \]
      4. hypot-1-def60.7%

        \[\leadsto \left|\left(ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right| \]
      5. div-inv60.7%

        \[\leadsto \left|\color{blue}{\frac{ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}\right| \]
      6. add-sqr-sqrt36.8%

        \[\leadsto \left|\color{blue}{\sqrt{\frac{ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}} \cdot \sqrt{\frac{ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}}}\right| \]
      7. fabs-sqr36.8%

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

        \[\leadsto \color{blue}{\frac{ew \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin t\right)\right)}{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}} \]
      9. log1p-expm1-u37.3%

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

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

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

    if -1.07999999999999994e-63 < t < 1.4600000000000001e-16

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.08 \cdot 10^{-63} \lor \neg \left(t \leq 1.46 \cdot 10^{-16}\right):\\ \;\;\;\;\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \tan t}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 40.5% accurate, 3.0× speedup?

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

\\
\left|eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{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. Step-by-step derivation
    1. fma-define99.9%

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

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

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

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

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

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

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

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

Alternative 11: 26.3% accurate, 4.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ \mathbf{if}\;ew \leq -1.22 \cdot 10^{-145} \lor \neg \left(ew \leq 2.6 \cdot 10^{-121}\right):\\ \;\;\;\;\left|eh \cdot \frac{eh}{\left(ew \cdot t\right) \cdot \mathsf{hypot}\left(1, t\_1\right)}\right|\\ \mathbf{else}:\\ \;\;\;\;eh \cdot \sin \tan^{-1} t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ eh (* ew t))))
   (if (or (<= ew -1.22e-145) (not (<= ew 2.6e-121)))
     (fabs (* eh (/ eh (* (* ew t) (hypot 1.0 t_1)))))
     (* eh (sin (atan t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * t);
	double tmp;
	if ((ew <= -1.22e-145) || !(ew <= 2.6e-121)) {
		tmp = fabs((eh * (eh / ((ew * t) * hypot(1.0, t_1)))));
	} else {
		tmp = eh * sin(atan(t_1));
	}
	return tmp;
}
public static double code(double eh, double ew, double t) {
	double t_1 = eh / (ew * t);
	double tmp;
	if ((ew <= -1.22e-145) || !(ew <= 2.6e-121)) {
		tmp = Math.abs((eh * (eh / ((ew * t) * Math.hypot(1.0, t_1)))));
	} else {
		tmp = eh * Math.sin(Math.atan(t_1));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = eh / (ew * t)
	tmp = 0
	if (ew <= -1.22e-145) or not (ew <= 2.6e-121):
		tmp = math.fabs((eh * (eh / ((ew * t) * math.hypot(1.0, t_1)))))
	else:
		tmp = eh * math.sin(math.atan(t_1))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(eh / Float64(ew * t))
	tmp = 0.0
	if ((ew <= -1.22e-145) || !(ew <= 2.6e-121))
		tmp = abs(Float64(eh * Float64(eh / Float64(Float64(ew * t) * hypot(1.0, t_1)))));
	else
		tmp = Float64(eh * sin(atan(t_1)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = eh / (ew * t);
	tmp = 0.0;
	if ((ew <= -1.22e-145) || ~((ew <= 2.6e-121)))
		tmp = abs((eh * (eh / ((ew * t) * hypot(1.0, t_1)))));
	else
		tmp = eh * sin(atan(t_1));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[ew, -1.22e-145], N[Not[LessEqual[ew, 2.6e-121]], $MachinePrecision]], N[Abs[N[(eh * N[(eh / N[(N[(ew * t), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(eh * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
\mathbf{if}\;ew \leq -1.22 \cdot 10^{-145} \lor \neg \left(ew \leq 2.6 \cdot 10^{-121}\right):\\
\;\;\;\;\left|eh \cdot \frac{eh}{\left(ew \cdot t\right) \cdot \mathsf{hypot}\left(1, t\_1\right)}\right|\\

\mathbf{else}:\\
\;\;\;\;eh \cdot \sin \tan^{-1} t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.2199999999999999e-145 or 2.59999999999999986e-121 < ew

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{\frac{eh}{ew}}{t}}{\sqrt{1 + \frac{\frac{eh}{ew}}{t} \cdot \frac{\frac{eh}{ew}}{t}}}}\right| \]
      2. associate-/l/15.4%

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

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

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

      \[\leadsto \left|eh \cdot \color{blue}{\frac{\frac{eh}{t \cdot ew}}{\mathsf{hypot}\left(1, \frac{eh}{t \cdot ew}\right)}}\right| \]
    10. Step-by-step derivation
      1. associate-/l/26.4%

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

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

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

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

    if -1.2199999999999999e-145 < ew < 2.59999999999999986e-121

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)} \cdot \sqrt{eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)}} \]
      3. add-sqr-sqrt28.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -1.22 \cdot 10^{-145} \lor \neg \left(ew \leq 2.6 \cdot 10^{-121}\right):\\ \;\;\;\;\left|eh \cdot \frac{eh}{\left(ew \cdot t\right) \cdot \mathsf{hypot}\left(1, \frac{eh}{ew \cdot t}\right)}\right|\\ \mathbf{else}:\\ \;\;\;\;eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 21.3% accurate, 4.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)} \cdot \sqrt{eh \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)}} \]
    3. add-sqr-sqrt19.0%

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

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

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

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

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

Reproduce

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