Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 15.3s
Alternatives: 9
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. Final simplification99.8%

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

Alternative 2: 99.8% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.1% accurate, 1.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\cos t \cdot \color{blue}{\frac{ew}{\sqrt{{\left(\frac{\mathsf{neg}\left(ew\right)}{\tan t \cdot eh}\right)}^{-2} + 1}}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
    4. clear-numN/A

      \[\leadsto \left|\cos t \cdot \color{blue}{\frac{1}{\frac{\sqrt{{\left(\frac{\mathsf{neg}\left(ew\right)}{\tan t \cdot eh}\right)}^{-2} + 1}}{ew}}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
    5. un-div-invN/A

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

      \[\leadsto \left|\color{blue}{\frac{\cos t}{\frac{\sqrt{{\left(\frac{\mathsf{neg}\left(ew\right)}{\tan t \cdot eh}\right)}^{-2} + 1}}{ew}}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(\mathsf{neg}\left(eh\right)\right) \cdot \tan t}{ew}\right)\right| \]
    7. lower-/.f6499.7

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

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

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

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

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

    Alternative 4: 74.2% accurate, 2.3× speedup?

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

      1. Initial program 99.7%

        \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
      2. Add Preprocessing
      3. Applied rewrites70.4%

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

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

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

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

          \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{{\sin t}^{2}}{ew \cdot \cos t} + \frac{{\sin t}^{2}}{ew \cdot \cos t}, {eh}^{2}, ew \cdot \cos t\right)}}\right|} \]
        4. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\mathsf{fma}\left(0.5 \cdot \frac{{\sin t}^{2}}{\cos t \cdot ew}, eh \cdot eh, \cos t \cdot ew\right)}}\right|} \]
      7. Step-by-step derivation
        1. Applied rewrites55.8%

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

        if -8.49999999999999953e-4 < t < 4.69999999999999986e-4

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 5: 43.7% accurate, 6.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{1}{\left|\frac{1}{ew}\right|}\\ \mathbf{if}\;ew \leq -1.55 \cdot 10^{-25}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 1.3 \cdot 10^{-307}:\\ \;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\ \mathbf{elif}\;ew \leq 2.3 \cdot 10^{-176}:\\ \;\;\;\;\sin t \cdot eh\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (eh ew t)
       :precision binary64
       (let* ((t_1 (/ 1.0 (fabs (/ 1.0 ew)))))
         (if (<= ew -1.55e-25)
           t_1
           (if (<= ew 1.3e-307)
             (/ 1.0 (fabs (/ 1.0 (* eh t))))
             (if (<= ew 2.3e-176) (* (sin t) eh) t_1)))))
      double code(double eh, double ew, double t) {
      	double t_1 = 1.0 / fabs((1.0 / ew));
      	double tmp;
      	if (ew <= -1.55e-25) {
      		tmp = t_1;
      	} else if (ew <= 1.3e-307) {
      		tmp = 1.0 / fabs((1.0 / (eh * t)));
      	} else if (ew <= 2.3e-176) {
      		tmp = sin(t) * eh;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      real(8) function code(eh, ew, t)
          real(8), intent (in) :: eh
          real(8), intent (in) :: ew
          real(8), intent (in) :: t
          real(8) :: t_1
          real(8) :: tmp
          t_1 = 1.0d0 / abs((1.0d0 / ew))
          if (ew <= (-1.55d-25)) then
              tmp = t_1
          else if (ew <= 1.3d-307) then
              tmp = 1.0d0 / abs((1.0d0 / (eh * t)))
          else if (ew <= 2.3d-176) then
              tmp = sin(t) * eh
          else
              tmp = t_1
          end if
          code = tmp
      end function
      
      public static double code(double eh, double ew, double t) {
      	double t_1 = 1.0 / Math.abs((1.0 / ew));
      	double tmp;
      	if (ew <= -1.55e-25) {
      		tmp = t_1;
      	} else if (ew <= 1.3e-307) {
      		tmp = 1.0 / Math.abs((1.0 / (eh * t)));
      	} else if (ew <= 2.3e-176) {
      		tmp = Math.sin(t) * eh;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(eh, ew, t):
      	t_1 = 1.0 / math.fabs((1.0 / ew))
      	tmp = 0
      	if ew <= -1.55e-25:
      		tmp = t_1
      	elif ew <= 1.3e-307:
      		tmp = 1.0 / math.fabs((1.0 / (eh * t)))
      	elif ew <= 2.3e-176:
      		tmp = math.sin(t) * eh
      	else:
      		tmp = t_1
      	return tmp
      
      function code(eh, ew, t)
      	t_1 = Float64(1.0 / abs(Float64(1.0 / ew)))
      	tmp = 0.0
      	if (ew <= -1.55e-25)
      		tmp = t_1;
      	elseif (ew <= 1.3e-307)
      		tmp = Float64(1.0 / abs(Float64(1.0 / Float64(eh * t))));
      	elseif (ew <= 2.3e-176)
      		tmp = Float64(sin(t) * eh);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(eh, ew, t)
      	t_1 = 1.0 / abs((1.0 / ew));
      	tmp = 0.0;
      	if (ew <= -1.55e-25)
      		tmp = t_1;
      	elseif (ew <= 1.3e-307)
      		tmp = 1.0 / abs((1.0 / (eh * t)));
      	elseif (ew <= 2.3e-176)
      		tmp = sin(t) * eh;
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[eh_, ew_, t_] := Block[{t$95$1 = N[(1.0 / N[Abs[N[(1.0 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, -1.55e-25], t$95$1, If[LessEqual[ew, 1.3e-307], N[(1.0 / N[Abs[N[(1.0 / N[(eh * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[ew, 2.3e-176], N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision], t$95$1]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \frac{1}{\left|\frac{1}{ew}\right|}\\
      \mathbf{if}\;ew \leq -1.55 \cdot 10^{-25}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;ew \leq 1.3 \cdot 10^{-307}:\\
      \;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\
      
      \mathbf{elif}\;ew \leq 2.3 \cdot 10^{-176}:\\
      \;\;\;\;\sin t \cdot eh\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if ew < -1.54999999999999997e-25 or 2.3000000000000001e-176 < ew

        1. Initial program 99.8%

          \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
        2. Add Preprocessing
        3. Applied rewrites90.3%

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

          \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]
        5. Step-by-step derivation
          1. lower-/.f6452.0

            \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]
        6. Applied rewrites52.0%

          \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]

        if -1.54999999999999997e-25 < ew < 1.29999999999999998e-307

        1. Initial program 99.9%

          \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
        2. Add Preprocessing
        3. Applied rewrites56.0%

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

          \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{eh \cdot \sin t}}\right|} \]
        5. Step-by-step derivation
          1. *-commutativeN/A

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

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
          3. lower-sin.f6470.9

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t} \cdot eh}\right|} \]
        6. Applied rewrites70.9%

          \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
        7. Taylor expanded in t around 0

          \[\leadsto \frac{1}{\left|\frac{1}{eh \cdot \color{blue}{t}}\right|} \]
        8. Step-by-step derivation
          1. Applied rewrites41.8%

            \[\leadsto \frac{1}{\left|\frac{1}{eh \cdot \color{blue}{t}}\right|} \]

          if 1.29999999999999998e-307 < ew < 2.3000000000000001e-176

          1. Initial program 99.9%

            \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
          2. Add Preprocessing
          3. Applied rewrites43.1%

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

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{eh \cdot \sin t}}\right|} \]
          5. Step-by-step derivation
            1. *-commutativeN/A

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

              \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
            3. lower-sin.f6481.9

              \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t} \cdot eh}\right|} \]
          6. Applied rewrites81.9%

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
          7. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{1}{\left|\frac{1}{\sin t \cdot eh}\right|}} \]
            2. lift-fabs.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\left|\frac{1}{\sin t \cdot eh}\right|}} \]
            3. lift-/.f64N/A

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{\sin t \cdot eh}}\right|} \]
            4. inv-powN/A

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

            \[\leadsto \color{blue}{\sin t \cdot eh} \]
        9. Recombined 3 regimes into one program.
        10. Add Preprocessing

        Alternative 6: 74.7% accurate, 7.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\cos t \cdot ew\right|\\ \mathbf{if}\;ew \leq -3.35 \cdot 10^{-25}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 3.5 \cdot 10^{-115}:\\ \;\;\;\;\left|\sin t \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (let* ((t_1 (fabs (* (cos t) ew))))
           (if (<= ew -3.35e-25) t_1 (if (<= ew 3.5e-115) (fabs (* (sin t) eh)) t_1))))
        double code(double eh, double ew, double t) {
        	double t_1 = fabs((cos(t) * ew));
        	double tmp;
        	if (ew <= -3.35e-25) {
        		tmp = t_1;
        	} else if (ew <= 3.5e-115) {
        		tmp = fabs((sin(t) * eh));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        real(8) function code(eh, ew, t)
            real(8), intent (in) :: eh
            real(8), intent (in) :: ew
            real(8), intent (in) :: t
            real(8) :: t_1
            real(8) :: tmp
            t_1 = abs((cos(t) * ew))
            if (ew <= (-3.35d-25)) then
                tmp = t_1
            else if (ew <= 3.5d-115) then
                tmp = abs((sin(t) * eh))
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double eh, double ew, double t) {
        	double t_1 = Math.abs((Math.cos(t) * ew));
        	double tmp;
        	if (ew <= -3.35e-25) {
        		tmp = t_1;
        	} else if (ew <= 3.5e-115) {
        		tmp = Math.abs((Math.sin(t) * eh));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(eh, ew, t):
        	t_1 = math.fabs((math.cos(t) * ew))
        	tmp = 0
        	if ew <= -3.35e-25:
        		tmp = t_1
        	elif ew <= 3.5e-115:
        		tmp = math.fabs((math.sin(t) * eh))
        	else:
        		tmp = t_1
        	return tmp
        
        function code(eh, ew, t)
        	t_1 = abs(Float64(cos(t) * ew))
        	tmp = 0.0
        	if (ew <= -3.35e-25)
        		tmp = t_1;
        	elseif (ew <= 3.5e-115)
        		tmp = abs(Float64(sin(t) * eh));
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(eh, ew, t)
        	t_1 = abs((cos(t) * ew));
        	tmp = 0.0;
        	if (ew <= -3.35e-25)
        		tmp = t_1;
        	elseif (ew <= 3.5e-115)
        		tmp = abs((sin(t) * eh));
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -3.35e-25], t$95$1, If[LessEqual[ew, 3.5e-115], N[Abs[N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], t$95$1]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left|\cos t \cdot ew\right|\\
        \mathbf{if}\;ew \leq -3.35 \cdot 10^{-25}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;ew \leq 3.5 \cdot 10^{-115}:\\
        \;\;\;\;\left|\sin t \cdot eh\right|\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if ew < -3.35000000000000016e-25 or 3.5000000000000002e-115 < ew

          1. Initial program 99.8%

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

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

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

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

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

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

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

            \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
          6. Step-by-step derivation
            1. *-commutativeN/A

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

              \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
            3. lower-cos.f6479.9

              \[\leadsto \left|\color{blue}{\cos t} \cdot ew\right| \]
          7. Applied rewrites79.9%

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

          if -3.35000000000000016e-25 < ew < 3.5000000000000002e-115

          1. Initial program 99.9%

            \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
          2. Add Preprocessing
          3. Applied rewrites55.0%

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

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{eh \cdot \sin t}}\right|} \]
          5. Step-by-step derivation
            1. *-commutativeN/A

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

              \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
            3. lower-sin.f6472.1

              \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t} \cdot eh}\right|} \]
          6. Applied rewrites72.1%

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
          7. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{1}{\left|\frac{1}{\sin t \cdot eh}\right|}} \]
            2. lift-fabs.f64N/A

              \[\leadsto \frac{1}{\color{blue}{\left|\frac{1}{\sin t \cdot eh}\right|}} \]
            3. lift-/.f64N/A

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{\sin t \cdot eh}}\right|} \]
            4. fabs-divN/A

              \[\leadsto \frac{1}{\color{blue}{\frac{\left|1\right|}{\left|\sin t \cdot eh\right|}}} \]
            5. metadata-evalN/A

              \[\leadsto \frac{1}{\frac{\color{blue}{1}}{\left|\sin t \cdot eh\right|}} \]
          8. Applied rewrites72.2%

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

        Alternative 7: 62.0% accurate, 7.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq 1.6 \cdot 10^{+195}:\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\ \end{array} \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (if (<= eh 1.6e+195) (fabs (* (cos t) ew)) (/ 1.0 (fabs (/ 1.0 (* eh t))))))
        double code(double eh, double ew, double t) {
        	double tmp;
        	if (eh <= 1.6e+195) {
        		tmp = fabs((cos(t) * ew));
        	} else {
        		tmp = 1.0 / fabs((1.0 / (eh * 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 (eh <= 1.6d+195) then
                tmp = abs((cos(t) * ew))
            else
                tmp = 1.0d0 / abs((1.0d0 / (eh * t)))
            end if
            code = tmp
        end function
        
        public static double code(double eh, double ew, double t) {
        	double tmp;
        	if (eh <= 1.6e+195) {
        		tmp = Math.abs((Math.cos(t) * ew));
        	} else {
        		tmp = 1.0 / Math.abs((1.0 / (eh * t)));
        	}
        	return tmp;
        }
        
        def code(eh, ew, t):
        	tmp = 0
        	if eh <= 1.6e+195:
        		tmp = math.fabs((math.cos(t) * ew))
        	else:
        		tmp = 1.0 / math.fabs((1.0 / (eh * t)))
        	return tmp
        
        function code(eh, ew, t)
        	tmp = 0.0
        	if (eh <= 1.6e+195)
        		tmp = abs(Float64(cos(t) * ew));
        	else
        		tmp = Float64(1.0 / abs(Float64(1.0 / Float64(eh * t))));
        	end
        	return tmp
        end
        
        function tmp_2 = code(eh, ew, t)
        	tmp = 0.0;
        	if (eh <= 1.6e+195)
        		tmp = abs((cos(t) * ew));
        	else
        		tmp = 1.0 / abs((1.0 / (eh * t)));
        	end
        	tmp_2 = tmp;
        end
        
        code[eh_, ew_, t_] := If[LessEqual[eh, 1.6e+195], N[Abs[N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[Abs[N[(1.0 / N[(eh * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;eh \leq 1.6 \cdot 10^{+195}:\\
        \;\;\;\;\left|\cos t \cdot ew\right|\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if eh < 1.59999999999999991e195

          1. Initial program 99.8%

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

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

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

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

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

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

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

            \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
          6. Step-by-step derivation
            1. *-commutativeN/A

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

              \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
            3. lower-cos.f6467.1

              \[\leadsto \left|\color{blue}{\cos t} \cdot ew\right| \]
          7. Applied rewrites67.1%

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

          if 1.59999999999999991e195 < eh

          1. Initial program 99.8%

            \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
          2. Add Preprocessing
          3. Applied rewrites28.5%

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

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{eh \cdot \sin t}}\right|} \]
          5. Step-by-step derivation
            1. *-commutativeN/A

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

              \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
            3. lower-sin.f6489.0

              \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t} \cdot eh}\right|} \]
          6. Applied rewrites89.0%

            \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
          7. Taylor expanded in t around 0

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

              \[\leadsto \frac{1}{\left|\frac{1}{eh \cdot \color{blue}{t}}\right|} \]
          9. Recombined 2 regimes into one program.
          10. Add Preprocessing

          Alternative 8: 43.2% accurate, 20.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{1}{\left|\frac{1}{ew}\right|}\\ \mathbf{if}\;ew \leq -1.55 \cdot 10^{-25}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 1.1 \cdot 10^{-161}:\\ \;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          (FPCore (eh ew t)
           :precision binary64
           (let* ((t_1 (/ 1.0 (fabs (/ 1.0 ew)))))
             (if (<= ew -1.55e-25)
               t_1
               (if (<= ew 1.1e-161) (/ 1.0 (fabs (/ 1.0 (* eh t)))) t_1))))
          double code(double eh, double ew, double t) {
          	double t_1 = 1.0 / fabs((1.0 / ew));
          	double tmp;
          	if (ew <= -1.55e-25) {
          		tmp = t_1;
          	} else if (ew <= 1.1e-161) {
          		tmp = 1.0 / fabs((1.0 / (eh * t)));
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          real(8) function code(eh, ew, t)
              real(8), intent (in) :: eh
              real(8), intent (in) :: ew
              real(8), intent (in) :: t
              real(8) :: t_1
              real(8) :: tmp
              t_1 = 1.0d0 / abs((1.0d0 / ew))
              if (ew <= (-1.55d-25)) then
                  tmp = t_1
              else if (ew <= 1.1d-161) then
                  tmp = 1.0d0 / abs((1.0d0 / (eh * t)))
              else
                  tmp = t_1
              end if
              code = tmp
          end function
          
          public static double code(double eh, double ew, double t) {
          	double t_1 = 1.0 / Math.abs((1.0 / ew));
          	double tmp;
          	if (ew <= -1.55e-25) {
          		tmp = t_1;
          	} else if (ew <= 1.1e-161) {
          		tmp = 1.0 / Math.abs((1.0 / (eh * t)));
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          def code(eh, ew, t):
          	t_1 = 1.0 / math.fabs((1.0 / ew))
          	tmp = 0
          	if ew <= -1.55e-25:
          		tmp = t_1
          	elif ew <= 1.1e-161:
          		tmp = 1.0 / math.fabs((1.0 / (eh * t)))
          	else:
          		tmp = t_1
          	return tmp
          
          function code(eh, ew, t)
          	t_1 = Float64(1.0 / abs(Float64(1.0 / ew)))
          	tmp = 0.0
          	if (ew <= -1.55e-25)
          		tmp = t_1;
          	elseif (ew <= 1.1e-161)
          		tmp = Float64(1.0 / abs(Float64(1.0 / Float64(eh * t))));
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          function tmp_2 = code(eh, ew, t)
          	t_1 = 1.0 / abs((1.0 / ew));
          	tmp = 0.0;
          	if (ew <= -1.55e-25)
          		tmp = t_1;
          	elseif (ew <= 1.1e-161)
          		tmp = 1.0 / abs((1.0 / (eh * t)));
          	else
          		tmp = t_1;
          	end
          	tmp_2 = tmp;
          end
          
          code[eh_, ew_, t_] := Block[{t$95$1 = N[(1.0 / N[Abs[N[(1.0 / ew), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ew, -1.55e-25], t$95$1, If[LessEqual[ew, 1.1e-161], N[(1.0 / N[Abs[N[(1.0 / N[(eh * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := \frac{1}{\left|\frac{1}{ew}\right|}\\
          \mathbf{if}\;ew \leq -1.55 \cdot 10^{-25}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;ew \leq 1.1 \cdot 10^{-161}:\\
          \;\;\;\;\frac{1}{\left|\frac{1}{eh \cdot t}\right|}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if ew < -1.54999999999999997e-25 or 1.10000000000000001e-161 < ew

            1. Initial program 99.8%

              \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
            2. Add Preprocessing
            3. Applied rewrites90.0%

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

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]
            5. Step-by-step derivation
              1. lower-/.f6453.0

                \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]
            6. Applied rewrites53.0%

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]

            if -1.54999999999999997e-25 < ew < 1.10000000000000001e-161

            1. Initial program 99.9%

              \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
            2. Add Preprocessing
            3. Applied rewrites55.2%

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

              \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{eh \cdot \sin t}}\right|} \]
            5. Step-by-step derivation
              1. *-commutativeN/A

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

                \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
              3. lower-sin.f6472.9

                \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t} \cdot eh}\right|} \]
            6. Applied rewrites72.9%

              \[\leadsto \frac{1}{\left|\frac{1}{\color{blue}{\sin t \cdot eh}}\right|} \]
            7. Taylor expanded in t around 0

              \[\leadsto \frac{1}{\left|\frac{1}{eh \cdot \color{blue}{t}}\right|} \]
            8. Step-by-step derivation
              1. Applied rewrites37.4%

                \[\leadsto \frac{1}{\left|\frac{1}{eh \cdot \color{blue}{t}}\right|} \]
            9. Recombined 2 regimes into one program.
            10. Add Preprocessing

            Alternative 9: 41.7% accurate, 34.5× speedup?

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

              \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
            2. Add Preprocessing
            3. Applied rewrites77.4%

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

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]
            5. Step-by-step derivation
              1. lower-/.f6441.5

                \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]
            6. Applied rewrites41.5%

              \[\leadsto \frac{1}{\left|\color{blue}{\frac{1}{ew}}\right|} \]
            7. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024235 
            (FPCore (eh ew t)
              :name "Example 2 from Robby"
              :precision binary64
              (fabs (- (* (* ew (cos t)) (cos (atan (/ (* (- eh) (tan t)) ew)))) (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))