Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 10.9s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (/ eh ew) (tan t)))))
   (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((eh / ew) / tan(t)));
	return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\ \left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (/ eh ew) (tan t)))))
   (fabs (+ (* (* ew (sin t)) (cos t_1)) (* (* eh (cos t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((eh / ew) / tan(t)));
	return fabs((((ew * sin(t)) * cos(t_1)) + ((eh * cos(t)) * sin(t_1))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{eh}{ew}}{\tan t}\\ \left|\mathsf{fma}\left(\cos t \cdot eh, \tanh \sinh^{-1} t\_1, \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} t\_1\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ (/ eh ew) (tan t))))
   (fabs
    (fma
     (* (cos t) eh)
     (tanh (asinh t_1))
     (* (* (sin t) ew) (cos (atan t_1)))))))
double code(double eh, double ew, double t) {
	double t_1 = (eh / ew) / tan(t);
	return fabs(fma((cos(t) * eh), tanh(asinh(t_1)), ((sin(t) * ew) * cos(atan(t_1)))));
}
function code(eh, ew, t)
	t_1 = Float64(Float64(eh / ew) / tan(t))
	return abs(fma(Float64(cos(t) * eh), tanh(asinh(t_1)), Float64(Float64(sin(t) * ew) * cos(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[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[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|\mathsf{fma}\left(\cos t \cdot eh, \tanh \sinh^{-1} t\_1, \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} t\_1\right)\right|
\end{array}
\end{array}
Derivation
  1. Initial program 99.8%

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

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

Alternative 2: 89.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{eh}{ew}}{\tan t}\\ t_2 := \tanh \sinh^{-1} t\_1\\ t_3 := \tan^{-1} t\_1\\ t_4 := \cos t\_3\\ t_5 := \left(\sin t \cdot ew\right) \cdot t\_4\\ \mathbf{if}\;\left(ew \cdot \sin t\right) \cdot t\_4 + \left(eh \cdot \cos t\right) \cdot \sin t\_3 \leq -1 \cdot 10^{-262}:\\ \;\;\;\;\left|\mathsf{fma}\left(eh, t\_2, t\_5\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos t \cdot eh, t\_2, t\_5\right)\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ (/ eh ew) (tan t)))
        (t_2 (tanh (asinh t_1)))
        (t_3 (atan t_1))
        (t_4 (cos t_3))
        (t_5 (* (* (sin t) ew) t_4)))
   (if (<= (+ (* (* ew (sin t)) t_4) (* (* eh (cos t)) (sin t_3))) -1e-262)
     (fabs (fma eh t_2 t_5))
     (fma (* (cos t) eh) t_2 t_5))))
double code(double eh, double ew, double t) {
	double t_1 = (eh / ew) / tan(t);
	double t_2 = tanh(asinh(t_1));
	double t_3 = atan(t_1);
	double t_4 = cos(t_3);
	double t_5 = (sin(t) * ew) * t_4;
	double tmp;
	if ((((ew * sin(t)) * t_4) + ((eh * cos(t)) * sin(t_3))) <= -1e-262) {
		tmp = fabs(fma(eh, t_2, t_5));
	} else {
		tmp = fma((cos(t) * eh), t_2, t_5);
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = Float64(Float64(eh / ew) / tan(t))
	t_2 = tanh(asinh(t_1))
	t_3 = atan(t_1)
	t_4 = cos(t_3)
	t_5 = Float64(Float64(sin(t) * ew) * t_4)
	tmp = 0.0
	if (Float64(Float64(Float64(ew * sin(t)) * t_4) + Float64(Float64(eh * cos(t)) * sin(t_3))) <= -1e-262)
		tmp = abs(fma(eh, t_2, t_5));
	else
		tmp = fma(Float64(cos(t) * eh), t_2, t_5);
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[ArcTan[t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[Cos[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * t$95$4), $MachinePrecision]}, If[LessEqual[N[(N[(N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision] + N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-262], N[Abs[N[(eh * t$95$2 + t$95$5), $MachinePrecision]], $MachinePrecision], N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * t$95$2 + t$95$5), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{ew}}{\tan t}\\
t_2 := \tanh \sinh^{-1} t\_1\\
t_3 := \tan^{-1} t\_1\\
t_4 := \cos t\_3\\
t_5 := \left(\sin t \cdot ew\right) \cdot t\_4\\
\mathbf{if}\;\left(ew \cdot \sin t\right) \cdot t\_4 + \left(eh \cdot \cos t\right) \cdot \sin t\_3 \leq -1 \cdot 10^{-262}:\\
\;\;\;\;\left|\mathsf{fma}\left(eh, t\_2, t\_5\right)\right|\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos t \cdot eh, t\_2, t\_5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t)))))) < -1.00000000000000001e-262

    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. Applied rewrites99.8%

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

      \[\leadsto \left|\mathsf{fma}\left(\color{blue}{eh}, \tanh \sinh^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right), \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right| \]
    4. Step-by-step derivation
      1. Applied rewrites79.7%

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

      if -1.00000000000000001e-262 < (+.f64 (*.f64 (*.f64 ew (sin.f64 t)) (cos.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))) (*.f64 (*.f64 eh (cos.f64 t)) (sin.f64 (atan.f64 (/.f64 (/.f64 eh ew) (tan.f64 t))))))

      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. Applied rewrites99.8%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos t \cdot eh, \tanh \sinh^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right), \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)} \]
    5. Recombined 2 regimes into one program.
    6. Add Preprocessing

    Alternative 3: 86.6% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + -0.5 \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right|\\ t_2 := \frac{\frac{eh}{ew}}{\tan t}\\ \mathbf{if}\;eh \leq -5.1 \cdot 10^{+157}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 2.3 \cdot 10^{+54}:\\ \;\;\;\;\left|\mathsf{fma}\left(eh, \tanh \sinh^{-1} t\_2, \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} t\_2\right)\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (eh ew t)
     :precision binary64
     (let* ((t_1
             (fabs
              (*
               (* (cos t) eh)
               (tanh (asinh (* (/ (+ 1.0 (* -0.5 (* t t))) ew) (/ eh (sin t))))))))
            (t_2 (/ (/ eh ew) (tan t))))
       (if (<= eh -5.1e+157)
         t_1
         (if (<= eh 2.3e+54)
           (fabs (fma eh (tanh (asinh t_2)) (* (* (sin t) ew) (cos (atan t_2)))))
           t_1))))
    double code(double eh, double ew, double t) {
    	double t_1 = fabs(((cos(t) * eh) * tanh(asinh((((1.0 + (-0.5 * (t * t))) / ew) * (eh / sin(t)))))));
    	double t_2 = (eh / ew) / tan(t);
    	double tmp;
    	if (eh <= -5.1e+157) {
    		tmp = t_1;
    	} else if (eh <= 2.3e+54) {
    		tmp = fabs(fma(eh, tanh(asinh(t_2)), ((sin(t) * ew) * cos(atan(t_2)))));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(eh, ew, t)
    	t_1 = abs(Float64(Float64(cos(t) * eh) * tanh(asinh(Float64(Float64(Float64(1.0 + Float64(-0.5 * Float64(t * t))) / ew) * Float64(eh / sin(t)))))))
    	t_2 = Float64(Float64(eh / ew) / tan(t))
    	tmp = 0.0
    	if (eh <= -5.1e+157)
    		tmp = t_1;
    	elseif (eh <= 2.3e+54)
    		tmp = abs(fma(eh, tanh(asinh(t_2)), Float64(Float64(sin(t) * ew) * cos(atan(t_2)))));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Tanh[N[ArcSinh[N[(N[(N[(1.0 + N[(-0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(eh / ew), $MachinePrecision] / N[Tan[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -5.1e+157], t$95$1, If[LessEqual[eh, 2.3e+54], N[Abs[N[(eh * N[Tanh[N[ArcSinh[t$95$2], $MachinePrecision]], $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision] * N[Cos[N[ArcTan[t$95$2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + -0.5 \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right|\\
    t_2 := \frac{\frac{eh}{ew}}{\tan t}\\
    \mathbf{if}\;eh \leq -5.1 \cdot 10^{+157}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;eh \leq 2.3 \cdot 10^{+54}:\\
    \;\;\;\;\left|\mathsf{fma}\left(eh, \tanh \sinh^{-1} t\_2, \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} t\_2\right)\right|\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if eh < -5.09999999999999999e157 or 2.29999999999999994e54 < eh

      1. Initial program 99.8%

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

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

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

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

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

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

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

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \frac{\frac{eh \cdot \cos t}{ew \cdot \sin t}}{\color{blue}{\sqrt{1 + \frac{eh \cdot \cos t}{ew \cdot \sin t} \cdot \frac{eh \cdot \cos t}{ew \cdot \sin t}}}}\right| \]
        7. tanh-asinh-revN/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
        8. lower-tanh.f64N/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
        9. lower-asinh.f64N/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
        10. *-commutativeN/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t \cdot eh}{ew \cdot \sin t}\right)\right| \]
        11. times-fracN/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        12. lower-*.f64N/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        13. lower-/.f64N/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        14. lift-cos.f64N/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        15. lower-/.f64N/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
      4. Applied rewrites88.5%

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

        \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + \frac{-1}{2} \cdot {t}^{2}}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
      6. Step-by-step derivation
        1. lower-+.f64N/A

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

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + \frac{-1}{2} \cdot {t}^{2}}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        3. unpow2N/A

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + \frac{-1}{2} \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        4. lower-*.f6488.7

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + -0.5 \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
      7. Applied rewrites88.7%

        \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + -0.5 \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]

      if -5.09999999999999999e157 < eh < 2.29999999999999994e54

      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. Applied rewrites99.8%

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

        \[\leadsto \left|\mathsf{fma}\left(\color{blue}{eh}, \tanh \sinh^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right), \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right| \]
      4. Step-by-step derivation
        1. Applied rewrites85.6%

          \[\leadsto \left|\mathsf{fma}\left(\color{blue}{eh}, \tanh \sinh^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right), \left(\sin t \cdot ew\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right)\right| \]
      5. Recombined 2 regimes into one program.
      6. Add Preprocessing

      Alternative 4: 74.8% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + -0.5 \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right|\\ \mathbf{if}\;eh \leq -1.7 \cdot 10^{-21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 10^{-83}:\\ \;\;\;\;\left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (eh ew t)
       :precision binary64
       (let* ((t_1
               (fabs
                (*
                 (* (cos t) eh)
                 (tanh
                  (asinh (* (/ (+ 1.0 (* -0.5 (* t t))) ew) (/ eh (sin t)))))))))
         (if (<= eh -1.7e-21)
           t_1
           (if (<= eh 1e-83)
             (fabs (* (* (cos (atan (/ eh (* ew t)))) ew) (sin t)))
             t_1))))
      double code(double eh, double ew, double t) {
      	double t_1 = fabs(((cos(t) * eh) * tanh(asinh((((1.0 + (-0.5 * (t * t))) / ew) * (eh / sin(t)))))));
      	double tmp;
      	if (eh <= -1.7e-21) {
      		tmp = t_1;
      	} else if (eh <= 1e-83) {
      		tmp = fabs(((cos(atan((eh / (ew * t)))) * ew) * sin(t)));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(eh, ew, t):
      	t_1 = math.fabs(((math.cos(t) * eh) * math.tanh(math.asinh((((1.0 + (-0.5 * (t * t))) / ew) * (eh / math.sin(t)))))))
      	tmp = 0
      	if eh <= -1.7e-21:
      		tmp = t_1
      	elif eh <= 1e-83:
      		tmp = math.fabs(((math.cos(math.atan((eh / (ew * t)))) * ew) * math.sin(t)))
      	else:
      		tmp = t_1
      	return tmp
      
      function code(eh, ew, t)
      	t_1 = abs(Float64(Float64(cos(t) * eh) * tanh(asinh(Float64(Float64(Float64(1.0 + Float64(-0.5 * Float64(t * t))) / ew) * Float64(eh / sin(t)))))))
      	tmp = 0.0
      	if (eh <= -1.7e-21)
      		tmp = t_1;
      	elseif (eh <= 1e-83)
      		tmp = abs(Float64(Float64(cos(atan(Float64(eh / Float64(ew * t)))) * ew) * sin(t)));
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(eh, ew, t)
      	t_1 = abs(((cos(t) * eh) * tanh(asinh((((1.0 + (-0.5 * (t * t))) / ew) * (eh / sin(t)))))));
      	tmp = 0.0;
      	if (eh <= -1.7e-21)
      		tmp = t_1;
      	elseif (eh <= 1e-83)
      		tmp = abs(((cos(atan((eh / (ew * t)))) * ew) * sin(t)));
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Tanh[N[ArcSinh[N[(N[(N[(1.0 + N[(-0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -1.7e-21], t$95$1, If[LessEqual[eh, 1e-83], N[Abs[N[(N[(N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + -0.5 \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right|\\
      \mathbf{if}\;eh \leq -1.7 \cdot 10^{-21}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;eh \leq 10^{-83}:\\
      \;\;\;\;\left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right|\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if eh < -1.7e-21 or 1e-83 < eh

        1. Initial program 99.8%

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

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

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

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

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

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

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

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \frac{\frac{eh \cdot \cos t}{ew \cdot \sin t}}{\color{blue}{\sqrt{1 + \frac{eh \cdot \cos t}{ew \cdot \sin t} \cdot \frac{eh \cdot \cos t}{ew \cdot \sin t}}}}\right| \]
          7. tanh-asinh-revN/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
          8. lower-tanh.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
          9. lower-asinh.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
          10. *-commutativeN/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t \cdot eh}{ew \cdot \sin t}\right)\right| \]
          11. times-fracN/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          12. lower-*.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          13. lower-/.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          14. lift-cos.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          15. lower-/.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        4. Applied rewrites79.6%

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

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + \frac{-1}{2} \cdot {t}^{2}}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        6. Step-by-step derivation
          1. lower-+.f64N/A

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

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + \frac{-1}{2} \cdot {t}^{2}}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          3. unpow2N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + \frac{-1}{2} \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          4. lower-*.f6479.8

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + -0.5 \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        7. Applied rewrites79.8%

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1 + -0.5 \cdot \left(t \cdot t\right)}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]

        if -1.7e-21 < eh < 1e-83

        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. Taylor expanded in eh around 0

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

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

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

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

          \[\leadsto \left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right| \]
        6. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right| \]
          2. lower-*.f6467.6

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

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

      Alternative 5: 74.7% accurate, 1.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1}{ew} \cdot \frac{eh}{\sin t}\right)\right|\\ \mathbf{if}\;eh \leq -1.7 \cdot 10^{-21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;eh \leq 1.95 \cdot 10^{-83}:\\ \;\;\;\;\left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (eh ew t)
       :precision binary64
       (let* ((t_1
               (fabs
                (* (* (cos t) eh) (tanh (asinh (* (/ 1.0 ew) (/ eh (sin t)))))))))
         (if (<= eh -1.7e-21)
           t_1
           (if (<= eh 1.95e-83)
             (fabs (* (* (cos (atan (/ eh (* ew t)))) ew) (sin t)))
             t_1))))
      double code(double eh, double ew, double t) {
      	double t_1 = fabs(((cos(t) * eh) * tanh(asinh(((1.0 / ew) * (eh / sin(t)))))));
      	double tmp;
      	if (eh <= -1.7e-21) {
      		tmp = t_1;
      	} else if (eh <= 1.95e-83) {
      		tmp = fabs(((cos(atan((eh / (ew * t)))) * ew) * sin(t)));
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(eh, ew, t):
      	t_1 = math.fabs(((math.cos(t) * eh) * math.tanh(math.asinh(((1.0 / ew) * (eh / math.sin(t)))))))
      	tmp = 0
      	if eh <= -1.7e-21:
      		tmp = t_1
      	elif eh <= 1.95e-83:
      		tmp = math.fabs(((math.cos(math.atan((eh / (ew * t)))) * ew) * math.sin(t)))
      	else:
      		tmp = t_1
      	return tmp
      
      function code(eh, ew, t)
      	t_1 = abs(Float64(Float64(cos(t) * eh) * tanh(asinh(Float64(Float64(1.0 / ew) * Float64(eh / sin(t)))))))
      	tmp = 0.0
      	if (eh <= -1.7e-21)
      		tmp = t_1;
      	elseif (eh <= 1.95e-83)
      		tmp = abs(Float64(Float64(cos(atan(Float64(eh / Float64(ew * t)))) * ew) * sin(t)));
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(eh, ew, t)
      	t_1 = abs(((cos(t) * eh) * tanh(asinh(((1.0 / ew) * (eh / sin(t)))))));
      	tmp = 0.0;
      	if (eh <= -1.7e-21)
      		tmp = t_1;
      	elseif (eh <= 1.95e-83)
      		tmp = abs(((cos(atan((eh / (ew * t)))) * ew) * sin(t)));
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision] * N[Tanh[N[ArcSinh[N[(N[(1.0 / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eh, -1.7e-21], t$95$1, If[LessEqual[eh, 1.95e-83], N[Abs[N[(N[(N[Cos[N[ArcTan[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1}{ew} \cdot \frac{eh}{\sin t}\right)\right|\\
      \mathbf{if}\;eh \leq -1.7 \cdot 10^{-21}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;eh \leq 1.95 \cdot 10^{-83}:\\
      \;\;\;\;\left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right|\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if eh < -1.7e-21 or 1.95e-83 < eh

        1. Initial program 99.8%

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

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

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

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

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

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

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

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \frac{\frac{eh \cdot \cos t}{ew \cdot \sin t}}{\color{blue}{\sqrt{1 + \frac{eh \cdot \cos t}{ew \cdot \sin t} \cdot \frac{eh \cdot \cos t}{ew \cdot \sin t}}}}\right| \]
          7. tanh-asinh-revN/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
          8. lower-tanh.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
          9. lower-asinh.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)\right| \]
          10. *-commutativeN/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t \cdot eh}{ew \cdot \sin t}\right)\right| \]
          11. times-fracN/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          12. lower-*.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          13. lower-/.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          14. lift-cos.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
          15. lower-/.f64N/A

            \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        4. Applied rewrites79.6%

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

          \[\leadsto \left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{1}{ew} \cdot \frac{eh}{\sin t}\right)\right| \]
        6. Step-by-step derivation
          1. Applied rewrites79.6%

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

          if -1.7e-21 < eh < 1.95e-83

          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. Taylor expanded in eh around 0

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

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

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

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

            \[\leadsto \left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right| \]
          6. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right| \]
            2. lower-*.f6467.6

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

            \[\leadsto \left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right| \]
        7. Recombined 2 regimes into one program.
        8. Add Preprocessing

        Alternative 6: 61.4% accurate, 1.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{eh}{ew \cdot t}\\ t_2 := \left|\left(\cos \tan^{-1} t\_1 \cdot ew\right) \cdot \sin t\right|\\ \mathbf{if}\;t \leq -6.5 \cdot 10^{-63}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq 3.7 \cdot 10^{-37}:\\ \;\;\;\;\left|\tanh t\_1 \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (let* ((t_1 (/ eh (* ew t))) (t_2 (fabs (* (* (cos (atan t_1)) ew) (sin t)))))
           (if (<= t -6.5e-63) t_2 (if (<= t 3.7e-37) (fabs (* (tanh t_1) eh)) t_2))))
        double code(double eh, double ew, double t) {
        	double t_1 = eh / (ew * t);
        	double t_2 = fabs(((cos(atan(t_1)) * ew) * sin(t)));
        	double tmp;
        	if (t <= -6.5e-63) {
        		tmp = t_2;
        	} else if (t <= 3.7e-37) {
        		tmp = fabs((tanh(t_1) * eh));
        	} else {
        		tmp = t_2;
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(eh, ew, t)
        use fmin_fmax_functions
            real(8), intent (in) :: eh
            real(8), intent (in) :: ew
            real(8), intent (in) :: t
            real(8) :: t_1
            real(8) :: t_2
            real(8) :: tmp
            t_1 = eh / (ew * t)
            t_2 = abs(((cos(atan(t_1)) * ew) * sin(t)))
            if (t <= (-6.5d-63)) then
                tmp = t_2
            else if (t <= 3.7d-37) then
                tmp = abs((tanh(t_1) * eh))
            else
                tmp = t_2
            end if
            code = tmp
        end function
        
        public static double code(double eh, double ew, double t) {
        	double t_1 = eh / (ew * t);
        	double t_2 = Math.abs(((Math.cos(Math.atan(t_1)) * ew) * Math.sin(t)));
        	double tmp;
        	if (t <= -6.5e-63) {
        		tmp = t_2;
        	} else if (t <= 3.7e-37) {
        		tmp = Math.abs((Math.tanh(t_1) * eh));
        	} else {
        		tmp = t_2;
        	}
        	return tmp;
        }
        
        def code(eh, ew, t):
        	t_1 = eh / (ew * t)
        	t_2 = math.fabs(((math.cos(math.atan(t_1)) * ew) * math.sin(t)))
        	tmp = 0
        	if t <= -6.5e-63:
        		tmp = t_2
        	elif t <= 3.7e-37:
        		tmp = math.fabs((math.tanh(t_1) * eh))
        	else:
        		tmp = t_2
        	return tmp
        
        function code(eh, ew, t)
        	t_1 = Float64(eh / Float64(ew * t))
        	t_2 = abs(Float64(Float64(cos(atan(t_1)) * ew) * sin(t)))
        	tmp = 0.0
        	if (t <= -6.5e-63)
        		tmp = t_2;
        	elseif (t <= 3.7e-37)
        		tmp = abs(Float64(tanh(t_1) * eh));
        	else
        		tmp = t_2;
        	end
        	return tmp
        end
        
        function tmp_2 = code(eh, ew, t)
        	t_1 = eh / (ew * t);
        	t_2 = abs(((cos(atan(t_1)) * ew) * sin(t)));
        	tmp = 0.0;
        	if (t <= -6.5e-63)
        		tmp = t_2;
        	elseif (t <= 3.7e-37)
        		tmp = abs((tanh(t_1) * eh));
        	else
        		tmp = t_2;
        	end
        	tmp_2 = tmp;
        end
        
        code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(N[(N[Cos[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision] * ew), $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -6.5e-63], t$95$2, If[LessEqual[t, 3.7e-37], N[Abs[N[(N[Tanh[t$95$1], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], t$95$2]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{eh}{ew \cdot t}\\
        t_2 := \left|\left(\cos \tan^{-1} t\_1 \cdot ew\right) \cdot \sin t\right|\\
        \mathbf{if}\;t \leq -6.5 \cdot 10^{-63}:\\
        \;\;\;\;t\_2\\
        
        \mathbf{elif}\;t \leq 3.7 \cdot 10^{-37}:\\
        \;\;\;\;\left|\tanh t\_1 \cdot eh\right|\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_2\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if t < -6.4999999999999998e-63 or 3.7e-37 < t

          1. Initial program 99.7%

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

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

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

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

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

            \[\leadsto \left|\left(\cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot ew\right) \cdot \sin t\right| \]
          6. Step-by-step derivation
            1. lower-/.f64N/A

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

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

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

          if -6.4999999999999998e-63 < t < 3.7e-37

          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. Taylor expanded in t around 0

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

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

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

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

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          6. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
            2. lower-*.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
            3. lift-cos.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
            4. lower-*.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
            5. lift-sin.f6475.6

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          7. Applied rewrites75.6%

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          8. Taylor expanded in t around 0

            \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
          9. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
            2. lift-*.f6475.6

              \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
          10. Applied rewrites75.6%

            \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 7: 42.0% accurate, 2.8× speedup?

        \[\begin{array}{l} \\ \left|\tanh \left(\frac{eh}{ew \cdot \sin t}\right) \cdot eh\right| \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (fabs (* (tanh (/ eh (* ew (sin t)))) eh)))
        double code(double eh, double ew, double t) {
        	return fabs((tanh((eh / (ew * sin(t)))) * eh));
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(eh, ew, t)
        use fmin_fmax_functions
            real(8), intent (in) :: eh
            real(8), intent (in) :: ew
            real(8), intent (in) :: t
            code = abs((tanh((eh / (ew * sin(t)))) * eh))
        end function
        
        public static double code(double eh, double ew, double t) {
        	return Math.abs((Math.tanh((eh / (ew * Math.sin(t)))) * eh));
        }
        
        def code(eh, ew, t):
        	return math.fabs((math.tanh((eh / (ew * math.sin(t)))) * eh))
        
        function code(eh, ew, t)
        	return abs(Float64(tanh(Float64(eh / Float64(ew * sin(t)))) * eh))
        end
        
        function tmp = code(eh, ew, t)
        	tmp = abs((tanh((eh / (ew * sin(t)))) * eh));
        end
        
        code[eh_, ew_, t_] := N[Abs[N[(N[Tanh[N[(eh / N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \left|\tanh \left(\frac{eh}{ew \cdot \sin t}\right) \cdot eh\right|
        \end{array}
        
        Derivation
        1. Initial program 99.8%

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

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

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

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

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

          \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
        6. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          2. lower-*.f64N/A

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          3. lift-cos.f64N/A

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          4. lower-*.f64N/A

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          5. lift-sin.f6442.0

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
        7. Applied rewrites42.0%

          \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
        8. Taylor expanded in t around 0

          \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot \sin t}\right) \cdot eh\right| \]
        9. Step-by-step derivation
          1. Applied rewrites42.0%

            \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot \sin t}\right) \cdot eh\right| \]
          2. Add Preprocessing

          Alternative 8: 40.1% accurate, 3.1× speedup?

          \[\begin{array}{l} \\ \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \end{array} \]
          (FPCore (eh ew t) :precision binary64 (fabs (* (tanh (/ eh (* ew t))) eh)))
          double code(double eh, double ew, double t) {
          	return fabs((tanh((eh / (ew * t))) * eh));
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(eh, ew, t)
          use fmin_fmax_functions
              real(8), intent (in) :: eh
              real(8), intent (in) :: ew
              real(8), intent (in) :: t
              code = abs((tanh((eh / (ew * t))) * eh))
          end function
          
          public static double code(double eh, double ew, double t) {
          	return Math.abs((Math.tanh((eh / (ew * t))) * eh));
          }
          
          def code(eh, ew, t):
          	return math.fabs((math.tanh((eh / (ew * t))) * eh))
          
          function code(eh, ew, t)
          	return abs(Float64(tanh(Float64(eh / Float64(ew * t))) * eh))
          end
          
          function tmp = code(eh, ew, t)
          	tmp = abs((tanh((eh / (ew * t))) * eh));
          end
          
          code[eh_, ew_, t_] := N[Abs[N[(N[Tanh[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right|
          \end{array}
          
          Derivation
          1. Initial program 99.8%

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

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

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

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

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

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          6. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
            2. lower-*.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
            3. lift-cos.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
            4. lower-*.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
            5. lift-sin.f6442.0

              \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          7. Applied rewrites42.0%

            \[\leadsto \left|\tanh \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot eh\right| \]
          8. Taylor expanded in t around 0

            \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
          9. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
            2. lift-*.f6440.1

              \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
          10. Applied rewrites40.1%

            \[\leadsto \left|\tanh \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
          11. Add Preprocessing

          Reproduce

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