Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 21.3s
Alternatives: 13
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 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.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{eh}{ew}}{\tan t}\\ \left|\sin t \cdot \frac{ew}{\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
    (+
     (* (sin t) (/ ew (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(((sin(t) * (ew / 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(((Math.sin(t) * (ew / 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(((math.sin(t) * (ew / 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(sin(t) * Float64(ew / 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(((sin(t) * (ew / 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[Sin[t], $MachinePrecision] * N[(ew / N[Sqrt[1.0 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $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|\sin t \cdot \frac{ew}{\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.7%

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

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

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

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

      \[\leadsto \left|\frac{ew \cdot \sin t}{\color{blue}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \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.7%

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

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

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

      \[\leadsto \left|\sin t \cdot \frac{ew}{\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| \]
  6. Simplified99.7%

    \[\leadsto \left|\color{blue}{\sin t \cdot \frac{ew}{\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| \]
  7. Add Preprocessing

Alternative 2: 99.1% accurate, 1.1× speedup?

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

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

Alternative 3: 98.5% accurate, 1.5× speedup?

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

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

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

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

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

      \[\leadsto \left|\frac{ew \cdot \sin t}{\color{blue}{\mathsf{hypot}\left(1, \frac{eh}{ew \cdot \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.7%

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

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

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

      \[\leadsto \left|\sin t \cdot \frac{ew}{\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| \]
  6. Simplified99.7%

    \[\leadsto \left|\color{blue}{\sin t \cdot \frac{ew}{\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| \]
  7. Taylor expanded in ew around inf 97.7%

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

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

Alternative 4: 75.0% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.8 \cdot 10^{+23} \lor \neg \left(ew \leq 1.8 \cdot 10^{+88}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.7999999999999999e23 or 1.8000000000000001e88 < ew

    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. associate-*l*99.7%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.7%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log90.7%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt43.6%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr43.6%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt43.6%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr43.6%

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

      \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log36.7%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. add-sqr-sqrt36.1%

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
    10. Step-by-step derivation
      1. unpow236.6%

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

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

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

    if -1.7999999999999999e23 < ew < 1.8000000000000001e88

    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. associate-*l*99.7%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.7%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in ew around 0 82.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*82.7%

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

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

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

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

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

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

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

Alternative 5: 74.9% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -1.02 \cdot 10^{+24} \lor \neg \left(ew \leq 9.8 \cdot 10^{+88}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -1.02000000000000004e24 or 9.8000000000000005e88 < ew

    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. associate-*l*99.7%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.7%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log90.7%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt43.6%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr43.6%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt43.6%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr43.6%

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

      \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log36.7%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. add-sqr-sqrt36.1%

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
    10. Step-by-step derivation
      1. unpow236.6%

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

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

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

    if -1.02000000000000004e24 < ew < 9.8000000000000005e88

    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. associate-*l*99.7%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.7%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in ew around 0 82.7%

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

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

Alternative 6: 67.7% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -0.06 \lor \neg \left(ew \leq 1.65 \cdot 10^{+85}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -0.059999999999999998 or 1.65e85 < ew

    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. associate-*l*99.7%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.7%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log90.8%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt43.7%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr43.7%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt43.7%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr43.7%

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

      \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log36.4%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. add-sqr-sqrt35.7%

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

        \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \sin t\right) \cdot \left(ew \cdot \sin t\right)}} \]
      4. pow237.1%

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
    10. Step-by-step derivation
      1. unpow237.1%

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

        \[\leadsto \color{blue}{\left|ew \cdot \sin t\right|} \]
    11. Simplified73.3%

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

    if -0.059999999999999998 < ew < 1.65e85

    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. associate-*l*99.7%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.7%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in ew around 0 83.5%

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

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

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

Alternative 7: 61.5% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{-43} \lor \neg \left(t \leq 3.8 \cdot 10^{-45}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.2000000000000001e-43 or 3.79999999999999997e-45 < t

    1. Initial program 99.5%

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

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.5%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log90.6%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt42.2%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr42.2%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt42.2%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr42.2%

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

      \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log27.1%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. add-sqr-sqrt26.2%

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
    10. Step-by-step derivation
      1. unpow227.4%

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

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

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

    if -4.2000000000000001e-43 < t < 3.79999999999999997e-45

    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. associate-*l*100.0%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*100.0%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Taylor expanded in ew around 0 74.8%

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

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

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

Alternative 8: 47.3% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.1 \cdot 10^{-139} \lor \neg \left(ew \leq 2.15 \cdot 10^{-98}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

\mathbf{else}:\\
\;\;\;\;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 ew < -2.10000000000000008e-139 or 2.14999999999999994e-98 < 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-/r*99.8%

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.8%

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh \cdot \left(\cos t \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \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{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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log91.0%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt45.4%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr45.4%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt45.4%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr45.4%

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

      \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log31.1%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. add-sqr-sqrt30.4%

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
    10. Step-by-step derivation
      1. unpow236.4%

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

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

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

    if -2.10000000000000008e-139 < ew < 2.14999999999999994e-98

    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. associate-*l*99.7%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.7%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log90.9%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt44.3%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr44.3%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt44.3%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr44.3%

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

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

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

Alternative 9: 47.1% accurate, 4.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq -2.4 \cdot 10^{-141} \lor \neg \left(ew \leq 2 \cdot 10^{-98}\right):\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.4000000000000001e-141 or 1.99999999999999988e-98 < 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-/r*99.8%

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.8%

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \tan t}\right), eh \cdot \left(\cos t \cdot \sin \tan^{-1} \color{blue}{\left(\frac{eh}{ew \cdot \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{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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log91.0%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt45.4%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr45.4%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt45.4%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr45.4%

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

      \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log31.1%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. add-sqr-sqrt30.4%

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
    10. Step-by-step derivation
      1. unpow236.4%

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

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

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

    if -2.4000000000000001e-141 < ew < 1.99999999999999988e-98

    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. associate-*l*99.7%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.7%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log90.9%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt44.3%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr44.3%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt44.3%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr44.3%

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

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

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

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

Alternative 10: 42.1% accurate, 4.5× speedup?

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

\\
\left|\sin t \cdot ew\right|
\end{array}
Derivation
  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. associate-*l*99.7%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
    5. associate-/r*99.7%

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

    \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-exp-log91.0%

      \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
    2. add-sqr-sqrt45.0%

      \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
    3. fabs-sqr45.0%

      \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
    4. add-sqr-sqrt45.0%

      \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
  6. Applied egg-rr45.0%

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

    \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
  8. Step-by-step derivation
    1. rem-exp-log22.4%

      \[\leadsto \color{blue}{ew \cdot \sin t} \]
    2. add-sqr-sqrt21.5%

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

      \[\leadsto \color{blue}{\sqrt{\left(ew \cdot \sin t\right) \cdot \left(ew \cdot \sin t\right)}} \]
    4. pow226.5%

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

    \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot \sin t\right)}^{2}}} \]
  10. Step-by-step derivation
    1. unpow226.5%

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

      \[\leadsto \color{blue}{\left|ew \cdot \sin t\right|} \]
  11. Simplified44.3%

    \[\leadsto \color{blue}{\left|ew \cdot \sin t\right|} \]
  12. Final simplification44.3%

    \[\leadsto \left|\sin t \cdot ew\right| \]
  13. Add Preprocessing

Alternative 11: 29.6% accurate, 8.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-5} \lor \neg \left(t \leq 5.6\right):\\
\;\;\;\;\sin t \cdot ew\\

\mathbf{else}:\\
\;\;\;\;\left|t \cdot ew\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.45e-5 or 5.5999999999999996 < t

    1. Initial program 99.5%

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

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*99.5%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log90.6%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt41.7%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr41.7%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt41.7%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr41.7%

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

      \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log25.2%

        \[\leadsto \color{blue}{ew \cdot \sin t} \]
      2. *-commutative25.2%

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

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

    if -1.45e-5 < t < 5.5999999999999996

    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. associate-*l*100.0%

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

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

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

        \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
      5. associate-/r*100.0%

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

      \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log91.3%

        \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
      2. add-sqr-sqrt48.2%

        \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
      3. fabs-sqr48.2%

        \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
      4. add-sqr-sqrt48.2%

        \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
    6. Applied egg-rr48.2%

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

      \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
    8. Taylor expanded in t around 0 19.7%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot t\right)}^{2}}} \]
    11. Step-by-step derivation
      1. unpow226.9%

        \[\leadsto \sqrt{\color{blue}{\left(ew \cdot t\right) \cdot \left(ew \cdot t\right)}} \]
      2. rem-sqrt-square34.1%

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

      \[\leadsto \color{blue}{\left|ew \cdot t\right|} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.45 \cdot 10^{-5} \lor \neg \left(t \leq 5.6\right):\\ \;\;\;\;\sin t \cdot ew\\ \mathbf{else}:\\ \;\;\;\;\left|t \cdot ew\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 19.3% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \left|t \cdot ew\right| \end{array} \]
(FPCore (eh ew t) :precision binary64 (fabs (* t ew)))
double code(double eh, double ew, double t) {
	return fabs((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((t * ew))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((t * ew));
}
def code(eh, ew, t):
	return math.fabs((t * ew))
function code(eh, ew, t)
	return abs(Float64(t * ew))
end
function tmp = code(eh, ew, t)
	tmp = abs((t * ew));
end
code[eh_, ew_, t_] := N[Abs[N[(t * ew), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|t \cdot ew\right|
\end{array}
Derivation
  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. associate-*l*99.7%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
    5. associate-/r*99.7%

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

    \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-exp-log91.0%

      \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
    2. add-sqr-sqrt45.0%

      \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
    3. fabs-sqr45.0%

      \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
    4. add-sqr-sqrt45.0%

      \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
  6. Applied egg-rr45.0%

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

    \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
  8. Taylor expanded in t around 0 12.4%

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{{\left(ew \cdot t\right)}^{2}}} \]
  11. Step-by-step derivation
    1. unpow216.9%

      \[\leadsto \sqrt{\color{blue}{\left(ew \cdot t\right) \cdot \left(ew \cdot t\right)}} \]
    2. rem-sqrt-square21.0%

      \[\leadsto \color{blue}{\left|ew \cdot t\right|} \]
  12. Simplified21.0%

    \[\leadsto \color{blue}{\left|ew \cdot t\right|} \]
  13. Final simplification21.0%

    \[\leadsto \left|t \cdot ew\right| \]
  14. Add Preprocessing

Alternative 13: 10.8% 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.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. associate-*l*99.7%

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

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

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

      \[\leadsto \left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\frac{eh}{ew \cdot \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| \]
    5. associate-/r*99.7%

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

    \[\leadsto \color{blue}{\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-exp-log91.0%

      \[\leadsto \color{blue}{e^{\log \left(\left|\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right|\right)}} \]
    2. add-sqr-sqrt45.0%

      \[\leadsto e^{\log \left(\left|\color{blue}{\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}}\right|\right)} \]
    3. fabs-sqr45.0%

      \[\leadsto e^{\log \color{blue}{\left(\sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)} \cdot \sqrt{\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)}\right)}} \]
    4. add-sqr-sqrt45.0%

      \[\leadsto e^{\log \color{blue}{\left(\mathsf{fma}\left(ew, \sin t \cdot \cos \tan^{-1} \left(\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)\right)}} \]
  6. Applied egg-rr45.0%

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

    \[\leadsto e^{\color{blue}{\log \left(ew \cdot \sin t\right)}} \]
  8. Taylor expanded in t around 0 12.4%

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

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

Reproduce

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