Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 18.8s
Alternatives: 8
Speedup: N/A×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{eh}{ew \cdot \tan t}\\ \left|ew \cdot \frac{\sin t}{\mathsf{hypot}\left(1, t\_1\right)} + eh \cdot \left(\cos t \cdot \sin \tan^{-1} t\_1\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ eh (* ew (tan t)))))
   (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(eh / Float64(ew * tan(t)))
	return abs(Float64(Float64(ew * Float64(sin(t) / hypot(1.0, t_1))) + Float64(eh * Float64(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[(eh / N[(ew * N[Tan[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(ew * N[(N[Sin[t], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

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

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

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

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

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

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

      \[\leadsto \left|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) + eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right| \]
    3. un-div-inv99.8%

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

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 1.1× speedup?

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

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

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

    \[\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. Add Preprocessing

Alternative 3: 98.5% accurate, 1.5× speedup?

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

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

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

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

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

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

      \[\leadsto \left|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) + eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right| \]
    3. un-div-inv99.8%

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

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

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

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

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

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

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

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

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

Alternative 4: 74.5% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq -2.1 \cdot 10^{+29} \lor \neg \left(ew \leq -1.25 \cdot 10^{-78} \lor \neg \left(ew \leq -1.35 \cdot 10^{-90}\right) \land ew \leq 5.4 \cdot 10^{+37}\right):\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (or (<= ew -2.1e+29)
         (not
          (or (<= ew -1.25e-78)
              (and (not (<= ew -1.35e-90)) (<= ew 5.4e+37)))))
   (fabs (* (* ew (sin t)) (cos (atan (/ eh (* ew t))))))
   (fabs (* eh (* (cos t) (sin (atan (/ (/ eh ew) (tan t)))))))))
double code(double eh, double ew, double t) {
	double tmp;
	if ((ew <= -2.1e+29) || !((ew <= -1.25e-78) || (!(ew <= -1.35e-90) && (ew <= 5.4e+37)))) {
		tmp = fabs(((ew * sin(t)) * cos(atan((eh / (ew * t))))));
	} else {
		tmp = fabs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t)))))));
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((ew <= (-2.1d+29)) .or. (.not. (ew <= (-1.25d-78)) .or. (.not. (ew <= (-1.35d-90))) .and. (ew <= 5.4d+37))) then
        tmp = abs(((ew * sin(t)) * cos(atan((eh / (ew * t))))))
    else
        tmp = abs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t)))))))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if ((ew <= -2.1e+29) || !((ew <= -1.25e-78) || (!(ew <= -1.35e-90) && (ew <= 5.4e+37)))) {
		tmp = Math.abs(((ew * Math.sin(t)) * Math.cos(Math.atan((eh / (ew * t))))));
	} else {
		tmp = Math.abs((eh * (Math.cos(t) * Math.sin(Math.atan(((eh / ew) / Math.tan(t)))))));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if (ew <= -2.1e+29) or not ((ew <= -1.25e-78) or (not (ew <= -1.35e-90) and (ew <= 5.4e+37))):
		tmp = math.fabs(((ew * math.sin(t)) * math.cos(math.atan((eh / (ew * t))))))
	else:
		tmp = math.fabs((eh * (math.cos(t) * math.sin(math.atan(((eh / ew) / math.tan(t)))))))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if ((ew <= -2.1e+29) || !((ew <= -1.25e-78) || (!(ew <= -1.35e-90) && (ew <= 5.4e+37))))
		tmp = abs(Float64(Float64(ew * sin(t)) * cos(atan(Float64(eh / Float64(ew * t))))));
	else
		tmp = abs(Float64(eh * Float64(cos(t) * sin(atan(Float64(Float64(eh / ew) / tan(t)))))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if ((ew <= -2.1e+29) || ~(((ew <= -1.25e-78) || (~((ew <= -1.35e-90)) && (ew <= 5.4e+37)))))
		tmp = abs(((ew * sin(t)) * cos(atan((eh / (ew * t))))));
	else
		tmp = abs((eh * (cos(t) * sin(atan(((eh / ew) / tan(t)))))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[Or[LessEqual[ew, -2.1e+29], N[Not[Or[LessEqual[ew, -1.25e-78], And[N[Not[LessEqual[ew, -1.35e-90]], $MachinePrecision], LessEqual[ew, 5.4e+37]]]], $MachinePrecision]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $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]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.1 \cdot 10^{+29} \lor \neg \left(ew \leq -1.25 \cdot 10^{-78} \lor \neg \left(ew \leq -1.35 \cdot 10^{-90}\right) \land ew \leq 5.4 \cdot 10^{+37}\right):\\
\;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.1000000000000002e29 or -1.2499999999999999e-78 < ew < -1.34999999999999998e-90 or 5.39999999999999973e37 < ew

    1. Initial program 99.8%

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

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

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

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

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

      \[\leadsto \left|\color{blue}{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. *-commutative75.9%

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

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

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

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

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

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

    if -2.1000000000000002e29 < ew < -1.2499999999999999e-78 or -1.34999999999999998e-90 < ew < 5.39999999999999973e37

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -2.1 \cdot 10^{+29} \lor \neg \left(ew \leq -1.25 \cdot 10^{-78} \lor \neg \left(ew \leq -1.35 \cdot 10^{-90}\right) \land ew \leq 5.4 \cdot 10^{+37}\right):\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 74.2% accurate, 1.7× speedup?

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

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

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

\mathbf{elif}\;ew \leq -1.35 \cdot 10^{-90} \lor \neg \left(ew \leq 4.2 \cdot 10^{+38}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if ew < -8.00000000000000038e26 or -8.59999999999999963e-79 < ew < -1.34999999999999998e-90 or 4.2e38 < ew

    1. Initial program 99.8%

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

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

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

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

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

      \[\leadsto \left|\color{blue}{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. *-commutative75.9%

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

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

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

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

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

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

    if -8.00000000000000038e26 < ew < -8.59999999999999963e-79

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

    if -1.34999999999999998e-90 < ew < 4.2e38

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -8 \cdot 10^{+26}:\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{elif}\;ew \leq -8.6 \cdot 10^{-79}:\\ \;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew} + -0.3333333333333333 \cdot \frac{eh \cdot {t}^{2}}{ew}}{t}\right)\right)\right|\\ \mathbf{elif}\;ew \leq -1.35 \cdot 10^{-90} \lor \neg \left(ew \leq 4.2 \cdot 10^{+38}\right):\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 68.2% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\ \mathbf{if}\;ew \leq -5.5 \cdot 10^{+25} \lor \neg \left(ew \leq -8.6 \cdot 10^{-79}\right) \land \left(ew \leq -1.35 \cdot 10^{-90} \lor \neg \left(ew \leq 6.1 \cdot 10^{+41}\right)\right):\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin t\_1\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ eh (* ew t)))))
   (if (or (<= ew -5.5e+25)
           (and (not (<= ew -8.6e-79))
                (or (<= ew -1.35e-90) (not (<= ew 6.1e+41)))))
     (fabs (* (* ew (sin t)) (cos t_1)))
     (fabs (* eh (* (cos t) (sin t_1)))))))
double code(double eh, double ew, double t) {
	double t_1 = atan((eh / (ew * t)));
	double tmp;
	if ((ew <= -5.5e+25) || (!(ew <= -8.6e-79) && ((ew <= -1.35e-90) || !(ew <= 6.1e+41)))) {
		tmp = fabs(((ew * sin(t)) * cos(t_1)));
	} else {
		tmp = fabs((eh * (cos(t) * sin(t_1))));
	}
	return tmp;
}
real(8) function code(eh, ew, t)
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = atan((eh / (ew * t)))
    if ((ew <= (-5.5d+25)) .or. (.not. (ew <= (-8.6d-79))) .and. (ew <= (-1.35d-90)) .or. (.not. (ew <= 6.1d+41))) then
        tmp = abs(((ew * sin(t)) * cos(t_1)))
    else
        tmp = abs((eh * (cos(t) * sin(t_1))))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan((eh / (ew * t)));
	double tmp;
	if ((ew <= -5.5e+25) || (!(ew <= -8.6e-79) && ((ew <= -1.35e-90) || !(ew <= 6.1e+41)))) {
		tmp = Math.abs(((ew * Math.sin(t)) * Math.cos(t_1)));
	} else {
		tmp = Math.abs((eh * (Math.cos(t) * Math.sin(t_1))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.atan((eh / (ew * t)))
	tmp = 0
	if (ew <= -5.5e+25) or (not (ew <= -8.6e-79) and ((ew <= -1.35e-90) or not (ew <= 6.1e+41))):
		tmp = math.fabs(((ew * math.sin(t)) * math.cos(t_1)))
	else:
		tmp = math.fabs((eh * (math.cos(t) * math.sin(t_1))))
	return tmp
function code(eh, ew, t)
	t_1 = atan(Float64(eh / Float64(ew * t)))
	tmp = 0.0
	if ((ew <= -5.5e+25) || (!(ew <= -8.6e-79) && ((ew <= -1.35e-90) || !(ew <= 6.1e+41))))
		tmp = abs(Float64(Float64(ew * sin(t)) * cos(t_1)));
	else
		tmp = abs(Float64(eh * Float64(cos(t) * sin(t_1))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = atan((eh / (ew * t)));
	tmp = 0.0;
	if ((ew <= -5.5e+25) || (~((ew <= -8.6e-79)) && ((ew <= -1.35e-90) || ~((ew <= 6.1e+41)))))
		tmp = abs(((ew * sin(t)) * cos(t_1)));
	else
		tmp = abs((eh * (cos(t) * sin(t_1))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[ew, -5.5e+25], And[N[Not[LessEqual[ew, -8.6e-79]], $MachinePrecision], Or[LessEqual[ew, -1.35e-90], N[Not[LessEqual[ew, 6.1e+41]], $MachinePrecision]]]], N[Abs[N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(eh * N[(N[Cos[t], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\\
\mathbf{if}\;ew \leq -5.5 \cdot 10^{+25} \lor \neg \left(ew \leq -8.6 \cdot 10^{-79}\right) \land \left(ew \leq -1.35 \cdot 10^{-90} \lor \neg \left(ew \leq 6.1 \cdot 10^{+41}\right)\right):\\
\;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -5.50000000000000018e25 or -8.59999999999999963e-79 < ew < -1.34999999999999998e-90 or 6.09999999999999998e41 < ew

    1. Initial program 99.8%

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

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

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

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

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

      \[\leadsto \left|\color{blue}{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. *-commutative75.9%

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

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

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

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

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

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

    if -5.50000000000000018e25 < ew < -8.59999999999999963e-79 or -1.34999999999999998e-90 < ew < 6.09999999999999998e41

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -5.5 \cdot 10^{+25} \lor \neg \left(ew \leq -8.6 \cdot 10^{-79}\right) \land \left(ew \leq -1.35 \cdot 10^{-90} \lor \neg \left(ew \leq 6.1 \cdot 10^{+41}\right)\right):\\ \;\;\;\;\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|eh \cdot \left(\cos t \cdot \sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right)\right)\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 51.7% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 42.5% accurate, 9.1× speedup?

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

\\
\left|eh\right|
\end{array}
Derivation
  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\color{blue}{\frac{\frac{eh}{t \cdot ew} \cdot eh}{\sqrt{1 + \frac{eh}{t \cdot ew} \cdot \frac{eh}{t \cdot ew}}}}\right| \]
    4. *-commutative11.5%

      \[\leadsto \left|\frac{\frac{eh}{\color{blue}{ew \cdot t}} \cdot eh}{\sqrt{1 + \frac{eh}{t \cdot ew} \cdot \frac{eh}{t \cdot ew}}}\right| \]
    5. associate-/r*11.5%

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

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

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

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

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

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

Reproduce

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