Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 19.7s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Step-by-step derivation
    1. 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 ew around 0 99.8%

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

Alternative 2: 99.8% accurate, 1.1× speedup?

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

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

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/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 3: 99.7% accurate, 1.1× speedup?

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

\\
\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\right) + \frac{ew}{\frac{\mathsf{hypot}\left(1, \frac{\frac{eh}{ew}}{\tan t}\right)}{\sin 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.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 ew around 0 99.8%

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

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

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

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

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

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

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

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

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

Alternative 4: 99.0% accurate, 1.1× speedup?

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

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

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

    \[\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}{t \cdot ew}\right)\right| \]
  5. Add Preprocessing

Alternative 5: 87.1% accurate, 1.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left|\frac{ew \cdot \sin t}{\mathsf{hypot}\left(1, t\_1\right)} + eh \cdot t\_2\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -9.4999999999999995e37 or 9.59999999999999948e34 < eh

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. 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 ew around inf 74.4%

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

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

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

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

    if -9.4999999999999995e37 < eh < 9.59999999999999948e34

    1. Initial program 99.9%

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

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

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

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

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

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

        \[\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| \]
    5. Applied egg-rr90.0%

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

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

Alternative 6: 86.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\mathbf{if}\;eh \leq -3 \cdot 10^{+38} \lor \neg \left(eh \leq 2.35 \cdot 10^{+48}\right):\\
\;\;\;\;\left|eh \cdot \left(\cos t \cdot t\_1\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -3.0000000000000001e38 or 2.35000000000000006e48 < eh

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. 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 ew around inf 74.4%

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

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

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

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

    if -3.0000000000000001e38 < eh < 2.35000000000000006e48

    1. Initial program 99.9%

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

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

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

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

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

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

        \[\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| \]
    5. Applied egg-rr90.0%

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

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

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

Alternative 7: 74.0% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -3.40000000000000035e-117 or 1100 < eh

    1. Initial program 99.8%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. 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 ew around inf 82.0%

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

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

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

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

    if -3.40000000000000035e-117 < eh < 1100

    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 ew around inf 99.8%

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

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

        \[\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-/r*73.7%

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

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

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

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

Alternative 8: 49.8% accurate, 2.2× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.79999999999999952e-136 or 1.6500000000000001e-23 < 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 ew around inf 89.0%

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

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

        \[\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-/r*48.4%

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

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

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

    if -7.79999999999999952e-136 < t < 1.6500000000000001e-23

    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. Step-by-step derivation
      1. add-cube-cbrt97.7%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
      2. pow397.7%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 35.5% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\ \mathbf{if}\;t \leq -4.5 \cdot 10^{+33}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -4.6 \cdot 10^{-130}:\\ \;\;\;\;ew \cdot \sqrt{{\sin t}^{2}}\\ \mathbf{elif}\;t \leq 5.1 \cdot 10^{-23}:\\ \;\;\;\;t \cdot ew + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (sqrt (pow (* ew (sin t)) 2.0))))
   (if (<= t -4.5e+33)
     t_1
     (if (<= t -4.6e-130)
       (* ew (sqrt (pow (sin t) 2.0)))
       (if (<= t 5.1e-23)
         (+ (* t ew) (* eh (sin (atan (/ eh (* ew (tan t)))))))
         t_1)))))
double code(double eh, double ew, double t) {
	double t_1 = sqrt(pow((ew * sin(t)), 2.0));
	double tmp;
	if (t <= -4.5e+33) {
		tmp = t_1;
	} else if (t <= -4.6e-130) {
		tmp = ew * sqrt(pow(sin(t), 2.0));
	} else if (t <= 5.1e-23) {
		tmp = (t * ew) + (eh * sin(atan((eh / (ew * tan(t))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt(((ew * sin(t)) ** 2.0d0))
    if (t <= (-4.5d+33)) then
        tmp = t_1
    else if (t <= (-4.6d-130)) then
        tmp = ew * sqrt((sin(t) ** 2.0d0))
    else if (t <= 5.1d-23) then
        tmp = (t * ew) + (eh * sin(atan((eh / (ew * tan(t))))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.sqrt(Math.pow((ew * Math.sin(t)), 2.0));
	double tmp;
	if (t <= -4.5e+33) {
		tmp = t_1;
	} else if (t <= -4.6e-130) {
		tmp = ew * Math.sqrt(Math.pow(Math.sin(t), 2.0));
	} else if (t <= 5.1e-23) {
		tmp = (t * ew) + (eh * Math.sin(Math.atan((eh / (ew * Math.tan(t))))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.sqrt(math.pow((ew * math.sin(t)), 2.0))
	tmp = 0
	if t <= -4.5e+33:
		tmp = t_1
	elif t <= -4.6e-130:
		tmp = ew * math.sqrt(math.pow(math.sin(t), 2.0))
	elif t <= 5.1e-23:
		tmp = (t * ew) + (eh * math.sin(math.atan((eh / (ew * math.tan(t))))))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = sqrt((Float64(ew * sin(t)) ^ 2.0))
	tmp = 0.0
	if (t <= -4.5e+33)
		tmp = t_1;
	elseif (t <= -4.6e-130)
		tmp = Float64(ew * sqrt((sin(t) ^ 2.0)));
	elseif (t <= 5.1e-23)
		tmp = Float64(Float64(t * ew) + Float64(eh * sin(atan(Float64(eh / Float64(ew * tan(t)))))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = sqrt(((ew * sin(t)) ^ 2.0));
	tmp = 0.0;
	if (t <= -4.5e+33)
		tmp = t_1;
	elseif (t <= -4.6e-130)
		tmp = ew * sqrt((sin(t) ^ 2.0));
	elseif (t <= 5.1e-23)
		tmp = (t * ew) + (eh * sin(atan((eh / (ew * tan(t))))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Sqrt[N[Power[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -4.5e+33], t$95$1, If[LessEqual[t, -4.6e-130], N[(ew * N[Sqrt[N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.1e-23], N[(N[(t * ew), $MachinePrecision] + N[(eh * N[Sin[N[ArcTan[N[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\
\mathbf{if}\;t \leq -4.5 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -4.6 \cdot 10^{-130}:\\
\;\;\;\;ew \cdot \sqrt{{\sin t}^{2}}\\

\mathbf{elif}\;t \leq 5.1 \cdot 10^{-23}:\\
\;\;\;\;t \cdot ew + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -4.5e33 or 5.10000000000000011e-23 < t

    1. Initial program 99.6%

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

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

        \[\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. Step-by-step derivation
      1. add-cube-cbrt97.8%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
      2. pow397.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]

    if -4.5e33 < t < -4.6000000000000002e-130

    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. Step-by-step derivation
      1. add-cube-cbrt98.1%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
      2. pow398.0%

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

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

      \[\leadsto \color{blue}{ew \cdot \sin t} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt6.3%

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

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

        \[\leadsto ew \cdot \sqrt{\color{blue}{{\sin t}^{2}}} \]
    9. Applied egg-rr39.7%

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

    if -4.6000000000000002e-130 < t < 5.10000000000000011e-23

    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. Step-by-step derivation
      1. add-cube-cbrt97.7%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
      2. pow397.6%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.5 \cdot 10^{+33}:\\ \;\;\;\;\sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\ \mathbf{elif}\;t \leq -4.6 \cdot 10^{-130}:\\ \;\;\;\;ew \cdot \sqrt{{\sin t}^{2}}\\ \mathbf{elif}\;t \leq 5.1 \cdot 10^{-23}:\\ \;\;\;\;t \cdot ew + eh \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 29.2% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq 1.75 \cdot 10^{+214}:\\ \;\;\;\;\sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;ew \cdot \sqrt{{\sin t}^{2}}\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= ew 1.75e+214)
   (sqrt (pow (* ew (sin t)) 2.0))
   (* ew (sqrt (pow (sin t) 2.0)))))
double code(double eh, double ew, double t) {
	double tmp;
	if (ew <= 1.75e+214) {
		tmp = sqrt(pow((ew * sin(t)), 2.0));
	} else {
		tmp = ew * sqrt(pow(sin(t), 2.0));
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: tmp
    if (ew <= 1.75d+214) then
        tmp = sqrt(((ew * sin(t)) ** 2.0d0))
    else
        tmp = ew * sqrt((sin(t) ** 2.0d0))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if (ew <= 1.75e+214) {
		tmp = Math.sqrt(Math.pow((ew * Math.sin(t)), 2.0));
	} else {
		tmp = ew * Math.sqrt(Math.pow(Math.sin(t), 2.0));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if ew <= 1.75e+214:
		tmp = math.sqrt(math.pow((ew * math.sin(t)), 2.0))
	else:
		tmp = ew * math.sqrt(math.pow(math.sin(t), 2.0))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if (ew <= 1.75e+214)
		tmp = sqrt((Float64(ew * sin(t)) ^ 2.0));
	else
		tmp = Float64(ew * sqrt((sin(t) ^ 2.0)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if (ew <= 1.75e+214)
		tmp = sqrt(((ew * sin(t)) ^ 2.0));
	else
		tmp = ew * sqrt((sin(t) ^ 2.0));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[ew, 1.75e+214], N[Sqrt[N[Power[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], N[(ew * N[Sqrt[N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;ew \leq 1.75 \cdot 10^{+214}:\\
\;\;\;\;\sqrt{{\left(ew \cdot \sin t\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;ew \cdot \sqrt{{\sin t}^{2}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < 1.75e214

    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. Step-by-step derivation
      1. add-cube-cbrt97.8%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
      2. pow397.8%

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

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

      \[\leadsto \color{blue}{ew \cdot \sin t} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt18.4%

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]

    if 1.75e214 < ew

    1. Initial program 99.9%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. 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. Step-by-step derivation
      1. add-cube-cbrt97.8%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
      2. pow397.7%

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

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

      \[\leadsto \color{blue}{ew \cdot \sin t} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt48.0%

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

        \[\leadsto ew \cdot \color{blue}{\sqrt{\sin t \cdot \sin t}} \]
      3. pow276.9%

        \[\leadsto ew \cdot \sqrt{\color{blue}{{\sin t}^{2}}} \]
    9. Applied egg-rr76.9%

      \[\leadsto ew \cdot \color{blue}{\sqrt{{\sin t}^{2}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 27.2% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := ew \cdot \sin t\\ \mathbf{if}\;ew \leq 3.4 \cdot 10^{+183}:\\ \;\;\;\;\sqrt{{t\_1}^{2}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* ew (sin t)))) (if (<= ew 3.4e+183) (sqrt (pow t_1 2.0)) t_1)))
double code(double eh, double ew, double t) {
	double t_1 = ew * sin(t);
	double tmp;
	if (ew <= 3.4e+183) {
		tmp = sqrt(pow(t_1, 2.0));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = ew * sin(t)
    if (ew <= 3.4d+183) then
        tmp = sqrt((t_1 ** 2.0d0))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = ew * Math.sin(t);
	double tmp;
	if (ew <= 3.4e+183) {
		tmp = Math.sqrt(Math.pow(t_1, 2.0));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = ew * math.sin(t)
	tmp = 0
	if ew <= 3.4e+183:
		tmp = math.sqrt(math.pow(t_1, 2.0))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = Float64(ew * sin(t))
	tmp = 0.0
	if (ew <= 3.4e+183)
		tmp = sqrt((t_1 ^ 2.0));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = ew * sin(t);
	tmp = 0.0;
	if (ew <= 3.4e+183)
		tmp = sqrt((t_1 ^ 2.0));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, 3.4e+183], N[Sqrt[N[Power[t$95$1, 2.0], $MachinePrecision]], $MachinePrecision], t$95$1]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := ew \cdot \sin t\\
\mathbf{if}\;ew \leq 3.4 \cdot 10^{+183}:\\
\;\;\;\;\sqrt{{t\_1}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < 3.4e183

    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. Step-by-step derivation
      1. add-cube-cbrt97.7%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
      2. pow397.7%

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

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

      \[\leadsto \color{blue}{ew \cdot \sin t} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt17.4%

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]

    if 3.4e183 < ew

    1. Initial program 99.9%

      \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
    2. Step-by-step derivation
      1. 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. Step-by-step derivation
      1. add-cube-cbrt97.9%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
      2. pow397.8%

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

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

      \[\leadsto \color{blue}{ew \cdot \sin t} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 22.0% accurate, 8.9× speedup?

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

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

    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
  2. Step-by-step derivation
    1. 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. Step-by-step derivation
    1. add-cube-cbrt97.8%

      \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
    2. pow397.7%

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

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

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

Alternative 13: 10.6% accurate, 306.3× speedup?

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

\\
t \cdot ew
\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.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. Step-by-step derivation
    1. add-cube-cbrt97.8%

      \[\leadsto \color{blue}{\left(\sqrt[3]{\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|} \cdot \sqrt[3]{\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|}\right) \cdot \sqrt[3]{\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|}} \]
    2. pow397.7%

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

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

    \[\leadsto \color{blue}{ew \cdot \sin t} \]
  8. Taylor expanded in t around 0 12.1%

    \[\leadsto ew \cdot \color{blue}{t} \]
  9. Final simplification12.1%

    \[\leadsto t \cdot ew \]
  10. Add Preprocessing

Reproduce

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