Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 15.8s
Alternatives: 14
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}

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 14 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 := \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}
Derivation
  1. Initial program 99.8%

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

Alternative 2: 97.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{eh}{\tan t}}{ew}\\ t_2 := \frac{\frac{eh}{ew}}{t}\\ \mathbf{if}\;eh \leq -7.4 \cdot 10^{-109} \lor \neg \left(eh \leq 3.8 \cdot 10^{-141}\right):\\ \;\;\;\;\left|\left(ew \cdot \mathsf{fma}\left(\cos t, \frac{\sin \tan^{-1} \left(\frac{\frac{eh \cdot \cos t}{ew}}{\sin t}\right)}{ew}, \frac{1}{\sqrt{1 + t\_2 \cdot t\_2}} \cdot \frac{\sin t}{eh}\right)\right) \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ (/ eh (tan t)) ew)) (t_2 (/ (/ eh ew) t)))
   (if (or (<= eh -7.4e-109) (not (<= eh 3.8e-141)))
     (fabs
      (*
       (*
        ew
        (fma
         (cos t)
         (/ (sin (atan (/ (/ (* eh (cos t)) ew) (sin t)))) ew)
         (* (/ 1.0 (sqrt (+ 1.0 (* t_2 t_2)))) (/ (sin t) eh))))
       eh))
     (fabs (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) (cosh (asinh t_1)))))))
double code(double eh, double ew, double t) {
	double t_1 = (eh / tan(t)) / ew;
	double t_2 = (eh / ew) / t;
	double tmp;
	if ((eh <= -7.4e-109) || !(eh <= 3.8e-141)) {
		tmp = fabs(((ew * fma(cos(t), (sin(atan((((eh * cos(t)) / ew) / sin(t)))) / ew), ((1.0 / sqrt((1.0 + (t_2 * t_2)))) * (sin(t) / eh)))) * eh));
	} else {
		tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / cosh(asinh(t_1))));
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = Float64(Float64(eh / tan(t)) / ew)
	t_2 = Float64(Float64(eh / ew) / t)
	tmp = 0.0
	if ((eh <= -7.4e-109) || !(eh <= 3.8e-141))
		tmp = abs(Float64(Float64(ew * fma(cos(t), Float64(sin(atan(Float64(Float64(Float64(eh * cos(t)) / ew) / sin(t)))) / ew), Float64(Float64(1.0 / sqrt(Float64(1.0 + Float64(t_2 * t_2)))) * Float64(sin(t) / eh)))) * eh));
	else
		tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / cosh(asinh(t_1))));
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]}, If[Or[LessEqual[eh, -7.4e-109], N[Not[LessEqual[eh, 3.8e-141]], $MachinePrecision]], N[Abs[N[(N[(ew * N[(N[Cos[t], $MachinePrecision] * N[(N[Sin[N[ArcTan[N[(N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision] / N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / ew), $MachinePrecision] + N[(N[(1.0 / N[Sqrt[N[(1.0 + N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] / eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
t_2 := \frac{\frac{eh}{ew}}{t}\\
\mathbf{if}\;eh \leq -7.4 \cdot 10^{-109} \lor \neg \left(eh \leq 3.8 \cdot 10^{-141}\right):\\
\;\;\;\;\left|\left(ew \cdot \mathsf{fma}\left(\cos t, \frac{\sin \tan^{-1} \left(\frac{\frac{eh \cdot \cos t}{ew}}{\sin t}\right)}{ew}, \frac{1}{\sqrt{1 + t\_2 \cdot t\_2}} \cdot \frac{\sin t}{eh}\right)\right) \cdot eh\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -7.39999999999999961e-109 or 3.79999999999999987e-141 < 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. Add Preprocessing
    3. 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) + \frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}\right)}\right| \]
    4. Step-by-step derivation
      1. Applied rewrites99.8%

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

        \[\leadsto \left|\left(ew \cdot \left(\frac{\cos t \cdot \sin \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right)}{ew} + \frac{\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t}{eh}\right)\right) \cdot eh\right| \]
      3. Step-by-step derivation
        1. Applied rewrites99.4%

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

          \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \frac{\sin \tan^{-1} \left(\frac{\frac{eh \cdot \cos t}{ew}}{\sin t}\right)}{ew}, \cos \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot \frac{\sin t}{eh}\right)\right) \cdot eh\right| \]
        3. Step-by-step derivation
          1. Applied rewrites98.9%

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

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

            if -7.39999999999999961e-109 < eh < 3.79999999999999987e-141

            1. Initial program 99.8%

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -7.4 \cdot 10^{-109} \lor \neg \left(eh \leq 3.8 \cdot 10^{-141}\right):\\ \;\;\;\;\left|\left(ew \cdot \mathsf{fma}\left(\cos t, \frac{\sin \tan^{-1} \left(\frac{\frac{eh \cdot \cos t}{ew}}{\sin t}\right)}{ew}, \frac{1}{\sqrt{1 + \frac{\frac{eh}{ew}}{t} \cdot \frac{\frac{eh}{ew}}{t}}} \cdot \frac{\sin t}{eh}\right)\right) \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\ \end{array} \]
          5. Add Preprocessing

          Alternative 3: 88.1% accurate, 1.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{eh}{\tan t}}{ew}\\ \mathbf{if}\;eh \leq -2.7 \cdot 10^{+22} \lor \neg \left(eh \leq 8.2 \cdot 10^{+52}\right):\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\ \end{array} \end{array} \]
          (FPCore (eh ew t)
           :precision binary64
           (let* ((t_1 (/ (/ eh (tan t)) ew)))
             (if (or (<= eh -2.7e+22) (not (<= eh 8.2e+52)))
               (fabs (* (sin (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (cos t) eh)))
               (fabs (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) (cosh (asinh t_1)))))))
          double code(double eh, double ew, double t) {
          	double t_1 = (eh / tan(t)) / ew;
          	double tmp;
          	if ((eh <= -2.7e+22) || !(eh <= 8.2e+52)) {
          		tmp = fabs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)));
          	} else {
          		tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / cosh(asinh(t_1))));
          	}
          	return tmp;
          }
          
          function code(eh, ew, t)
          	t_1 = Float64(Float64(eh / tan(t)) / ew)
          	tmp = 0.0
          	if ((eh <= -2.7e+22) || !(eh <= 8.2e+52))
          		tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(cos(t) * eh)));
          	else
          		tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / cosh(asinh(t_1))));
          	end
          	return tmp
          end
          
          code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -2.7e+22], N[Not[LessEqual[eh, 8.2e+52]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
          \mathbf{if}\;eh \leq -2.7 \cdot 10^{+22} \lor \neg \left(eh \leq 8.2 \cdot 10^{+52}\right):\\
          \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
          
          \mathbf{else}:\\
          \;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if eh < -2.7000000000000002e22 or 8.1999999999999999e52 < 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. Add Preprocessing
            3. 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| \]
            4. Step-by-step derivation
              1. Applied rewrites92.3%

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

              if -2.7000000000000002e22 < eh < 8.1999999999999999e52

              1. Initial program 99.7%

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -2.7 \cdot 10^{+22} \lor \neg \left(eh \leq 8.2 \cdot 10^{+52}\right):\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\ \end{array} \]
            7. Add Preprocessing

            Alternative 4: 83.3% accurate, 1.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{eh}{\tan t}}{ew}\\ \mathbf{if}\;eh \leq -520000 \lor \neg \left(eh \leq 1700000\right):\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\sqrt{\mathsf{fma}\left(t\_1, t\_1, 1\right)}}\right|\\ \end{array} \end{array} \]
            (FPCore (eh ew t)
             :precision binary64
             (let* ((t_1 (/ (/ eh (tan t)) ew)))
               (if (or (<= eh -520000.0) (not (<= eh 1700000.0)))
                 (fabs (* (sin (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (cos t) eh)))
                 (fabs
                  (/ (fma (* (cos t) t_1) eh (* (sin t) ew)) (sqrt (fma t_1 t_1 1.0)))))))
            double code(double eh, double ew, double t) {
            	double t_1 = (eh / tan(t)) / ew;
            	double tmp;
            	if ((eh <= -520000.0) || !(eh <= 1700000.0)) {
            		tmp = fabs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)));
            	} else {
            		tmp = fabs((fma((cos(t) * t_1), eh, (sin(t) * ew)) / sqrt(fma(t_1, t_1, 1.0))));
            	}
            	return tmp;
            }
            
            function code(eh, ew, t)
            	t_1 = Float64(Float64(eh / tan(t)) / ew)
            	tmp = 0.0
            	if ((eh <= -520000.0) || !(eh <= 1700000.0))
            		tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(cos(t) * eh)));
            	else
            		tmp = abs(Float64(fma(Float64(cos(t) * t_1), eh, Float64(sin(t) * ew)) / sqrt(fma(t_1, t_1, 1.0))));
            	end
            	return tmp
            end
            
            code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]}, If[Or[LessEqual[eh, -520000.0], N[Not[LessEqual[eh, 1700000.0]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] * t$95$1), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(t$95$1 * t$95$1 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_1 := \frac{\frac{eh}{\tan t}}{ew}\\
            \mathbf{if}\;eh \leq -520000 \lor \neg \left(eh \leq 1700000\right):\\
            \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
            
            \mathbf{else}:\\
            \;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot t\_1, eh, \sin t \cdot ew\right)}{\sqrt{\mathsf{fma}\left(t\_1, t\_1, 1\right)}}\right|\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if eh < -5.2e5 or 1.7e6 < 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. Add Preprocessing
              3. 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| \]
              4. Step-by-step derivation
                1. Applied rewrites90.1%

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

                if -5.2e5 < eh < 1.7e6

                1. Initial program 99.8%

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

                  \[\leadsto \left|\color{blue}{\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}}\right| \]
                4. Step-by-step derivation
                  1. lift-cosh.f64N/A

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

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

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

                    \[\leadsto \left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\color{blue}{\sqrt{\frac{\frac{eh}{\tan t}}{ew} \cdot \frac{\frac{eh}{\tan t}}{ew} + 1}}}\right| \]
                  5. lower-fma.f6486.4

                    \[\leadsto \left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\sqrt{\color{blue}{\mathsf{fma}\left(\frac{\frac{eh}{\tan t}}{ew}, \frac{\frac{eh}{\tan t}}{ew}, 1\right)}}}\right| \]
                5. Applied rewrites86.4%

                  \[\leadsto \left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\color{blue}{\sqrt{\mathsf{fma}\left(\frac{\frac{eh}{\tan t}}{ew}, \frac{\frac{eh}{\tan t}}{ew}, 1\right)}}}\right| \]
              5. Recombined 2 regimes into one program.
              6. Final simplification88.2%

                \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -520000 \lor \neg \left(eh \leq 1700000\right):\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\sqrt{\mathsf{fma}\left(\frac{\frac{eh}{\tan t}}{ew}, \frac{\frac{eh}{\tan t}}{ew}, 1\right)}}\right|\\ \end{array} \]
              7. Add Preprocessing

              Alternative 5: 82.0% accurate, 1.6× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -2.55 \cdot 10^{-33} \lor \neg \left(eh \leq 1800000\right):\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\ \end{array} \end{array} \]
              (FPCore (eh ew t)
               :precision binary64
               (if (or (<= eh -2.55e-33) (not (<= eh 1800000.0)))
                 (fabs (* (sin (atan (* (/ (cos t) ew) (/ eh (sin t))))) (* (cos t) eh)))
                 (fabs
                  (/
                   (fma (/ (/ eh ew) t) eh (* (sin t) ew))
                   (cosh (asinh (/ (/ eh (tan t)) ew)))))))
              double code(double eh, double ew, double t) {
              	double tmp;
              	if ((eh <= -2.55e-33) || !(eh <= 1800000.0)) {
              		tmp = fabs((sin(atan(((cos(t) / ew) * (eh / sin(t))))) * (cos(t) * eh)));
              	} else {
              		tmp = fabs((fma(((eh / ew) / t), eh, (sin(t) * ew)) / cosh(asinh(((eh / tan(t)) / ew)))));
              	}
              	return tmp;
              }
              
              function code(eh, ew, t)
              	tmp = 0.0
              	if ((eh <= -2.55e-33) || !(eh <= 1800000.0))
              		tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / sin(t))))) * Float64(cos(t) * eh)));
              	else
              		tmp = abs(Float64(fma(Float64(Float64(eh / ew) / t), eh, Float64(sin(t) * ew)) / cosh(asinh(Float64(Float64(eh / tan(t)) / ew)))));
              	end
              	return tmp
              end
              
              code[eh_, ew_, t_] := If[Or[LessEqual[eh, -2.55e-33], N[Not[LessEqual[eh, 1800000.0]], $MachinePrecision]], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;eh \leq -2.55 \cdot 10^{-33} \lor \neg \left(eh \leq 1800000\right):\\
              \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\
              
              \mathbf{else}:\\
              \;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if eh < -2.55000000000000004e-33 or 1.8e6 < 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. Add Preprocessing
                3. 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| \]
                4. Step-by-step derivation
                  1. Applied rewrites88.5%

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

                  if -2.55000000000000004e-33 < eh < 1.8e6

                  1. Initial program 99.8%

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

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

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

                      \[\leadsto \left|\frac{\mathsf{fma}\left(\color{blue}{\frac{\frac{eh}{ew}}{t}}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right| \]
                  6. Recombined 2 regimes into one program.
                  7. Final simplification87.0%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -2.55 \cdot 10^{-33} \lor \neg \left(eh \leq 1800000\right):\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \left(\cos t \cdot eh\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\ \end{array} \]
                  8. Add Preprocessing

                  Alternative 6: 76.3% accurate, 1.8× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{eh}{ew}}{t}\\ \mathbf{if}\;eh \leq -1.05 \cdot 10^{+18} \lor \neg \left(eh \leq 1800000\right):\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\ \end{array} \end{array} \]
                  (FPCore (eh ew t)
                   :precision binary64
                   (let* ((t_1 (/ (/ eh ew) t)))
                     (if (or (<= eh -1.05e+18) (not (<= eh 1800000.0)))
                       (fabs (* (* eh (cos t)) (sin (atan t_1))))
                       (fabs
                        (/ (fma t_1 eh (* (sin t) ew)) (cosh (asinh (/ (/ eh (tan t)) ew))))))))
                  double code(double eh, double ew, double t) {
                  	double t_1 = (eh / ew) / t;
                  	double tmp;
                  	if ((eh <= -1.05e+18) || !(eh <= 1800000.0)) {
                  		tmp = fabs(((eh * cos(t)) * sin(atan(t_1))));
                  	} else {
                  		tmp = fabs((fma(t_1, eh, (sin(t) * ew)) / cosh(asinh(((eh / tan(t)) / ew)))));
                  	}
                  	return tmp;
                  }
                  
                  function code(eh, ew, t)
                  	t_1 = Float64(Float64(eh / ew) / t)
                  	tmp = 0.0
                  	if ((eh <= -1.05e+18) || !(eh <= 1800000.0))
                  		tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(t_1))));
                  	else
                  		tmp = abs(Float64(fma(t_1, eh, Float64(sin(t) * ew)) / cosh(asinh(Float64(Float64(eh / tan(t)) / ew)))));
                  	end
                  	return tmp
                  end
                  
                  code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]}, If[Or[LessEqual[eh, -1.05e+18], N[Not[LessEqual[eh, 1800000.0]], $MachinePrecision]], N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(t$95$1 * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Cosh[N[ArcSinh[N[(N[(eh / N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_1 := \frac{\frac{eh}{ew}}{t}\\
                  \mathbf{if}\;eh \leq -1.05 \cdot 10^{+18} \lor \neg \left(eh \leq 1800000\right):\\
                  \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} t\_1\right|\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\left|\frac{\mathsf{fma}\left(t\_1, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if eh < -1.05e18 or 1.8e6 < 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. Add Preprocessing
                    3. 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) + \frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}\right)}\right| \]
                    4. Step-by-step derivation
                      1. Applied rewrites99.8%

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

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

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

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

                          if -1.05e18 < eh < 1.8e6

                          1. Initial program 99.7%

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

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

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

                              \[\leadsto \left|\frac{\mathsf{fma}\left(\color{blue}{\frac{\frac{eh}{ew}}{t}}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right| \]
                          6. Recombined 2 regimes into one program.
                          7. Final simplification81.0%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -1.05 \cdot 10^{+18} \lor \neg \left(eh \leq 1800000\right):\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\frac{eh}{\tan t}}{ew}\right)}\right|\\ \end{array} \]
                          8. Add Preprocessing

                          Alternative 7: 66.0% accurate, 2.3× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} t_1 := eh \cdot \cos t\\ \mathbf{if}\;eh \leq -5.2 \cdot 10^{+79}:\\ \;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right|\\ \mathbf{elif}\;eh \leq -8.2 \cdot 10^{-109} \lor \neg \left(eh \leq 3.25 \cdot 10^{-93}\right):\\ \;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{eh}{ew} \cdot -0.3333333333333333, t \cdot t, \frac{eh}{ew}\right)}{t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \end{array} \end{array} \]
                          (FPCore (eh ew t)
                           :precision binary64
                           (let* ((t_1 (* eh (cos t))))
                             (if (<= eh -5.2e+79)
                               (fabs (* t_1 (sin (atan (/ (/ eh ew) t)))))
                               (if (or (<= eh -8.2e-109) (not (<= eh 3.25e-93)))
                                 (fabs
                                  (*
                                   t_1
                                   (sin
                                    (atan
                                     (/ (fma (* (/ eh ew) -0.3333333333333333) (* t t) (/ eh ew)) t)))))
                                 (fabs (* ew (sin t)))))))
                          double code(double eh, double ew, double t) {
                          	double t_1 = eh * cos(t);
                          	double tmp;
                          	if (eh <= -5.2e+79) {
                          		tmp = fabs((t_1 * sin(atan(((eh / ew) / t)))));
                          	} else if ((eh <= -8.2e-109) || !(eh <= 3.25e-93)) {
                          		tmp = fabs((t_1 * sin(atan((fma(((eh / ew) * -0.3333333333333333), (t * t), (eh / ew)) / t)))));
                          	} else {
                          		tmp = fabs((ew * sin(t)));
                          	}
                          	return tmp;
                          }
                          
                          function code(eh, ew, t)
                          	t_1 = Float64(eh * cos(t))
                          	tmp = 0.0
                          	if (eh <= -5.2e+79)
                          		tmp = abs(Float64(t_1 * sin(atan(Float64(Float64(eh / ew) / t)))));
                          	elseif ((eh <= -8.2e-109) || !(eh <= 3.25e-93))
                          		tmp = abs(Float64(t_1 * sin(atan(Float64(fma(Float64(Float64(eh / ew) * -0.3333333333333333), Float64(t * t), Float64(eh / ew)) / t)))));
                          	else
                          		tmp = abs(Float64(ew * sin(t)));
                          	end
                          	return tmp
                          end
                          
                          code[eh_, ew_, t_] := Block[{t$95$1 = N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eh, -5.2e+79], N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[eh, -8.2e-109], N[Not[LessEqual[eh, 3.25e-93]], $MachinePrecision]], N[Abs[N[(t$95$1 * N[Sin[N[ArcTan[N[(N[(N[(N[(eh / ew), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] * N[(t * t), $MachinePrecision] + N[(eh / ew), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          t_1 := eh \cdot \cos t\\
                          \mathbf{if}\;eh \leq -5.2 \cdot 10^{+79}:\\
                          \;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right|\\
                          
                          \mathbf{elif}\;eh \leq -8.2 \cdot 10^{-109} \lor \neg \left(eh \leq 3.25 \cdot 10^{-93}\right):\\
                          \;\;\;\;\left|t\_1 \cdot \sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{eh}{ew} \cdot -0.3333333333333333, t \cdot t, \frac{eh}{ew}\right)}{t}\right)\right|\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\left|ew \cdot \sin t\right|\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if eh < -5.20000000000000029e79

                            1. Initial program 99.9%

                              \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
                            2. Add Preprocessing
                            3. Taylor expanded in 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) + \frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}\right)}\right| \]
                            4. Step-by-step derivation
                              1. Applied rewrites99.9%

                                \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right), \cos t, \cos \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \frac{\sin t \cdot ew}{eh}\right) \cdot eh}\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. Applied rewrites94.5%

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

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

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

                                  if -5.20000000000000029e79 < eh < -8.2000000000000004e-109 or 3.25e-93 < eh

                                  1. Initial program 99.7%

                                    \[\left|\left(ew \cdot \sin t\right) \cdot \cos \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right) + \left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\right| \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in 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) + \frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}\right)}\right| \]
                                  4. Step-by-step derivation
                                    1. Applied rewrites99.7%

                                      \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right), \cos t, \cos \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \frac{\sin t \cdot ew}{eh}\right) \cdot eh}\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. Applied rewrites75.1%

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

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

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

                                        if -8.2000000000000004e-109 < eh < 3.25e-93

                                        1. Initial program 99.8%

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

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

                                          \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
                                        5. Step-by-step derivation
                                          1. Applied rewrites77.4%

                                            \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
                                        6. Recombined 3 regimes into one program.
                                        7. Final simplification74.3%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;eh \leq -5.2 \cdot 10^{+79}:\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right|\\ \mathbf{elif}\;eh \leq -8.2 \cdot 10^{-109} \lor \neg \left(eh \leq 3.25 \cdot 10^{-93}\right):\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\mathsf{fma}\left(\frac{eh}{ew} \cdot -0.3333333333333333, t \cdot t, \frac{eh}{ew}\right)}{t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \end{array} \]
                                        8. Add Preprocessing

                                        Alternative 8: 67.0% accurate, 2.5× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -520000 \lor \neg \left(eh \leq 3.2 \cdot 10^{-26}\right):\\ \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \sin t\right|\\ \end{array} \end{array} \]
                                        (FPCore (eh ew t)
                                         :precision binary64
                                         (if (or (<= eh -520000.0) (not (<= eh 3.2e-26)))
                                           (fabs (* (* eh (cos t)) (sin (atan (/ (/ eh ew) t)))))
                                           (fabs (* ew (sin t)))))
                                        double code(double eh, double ew, double t) {
                                        	double tmp;
                                        	if ((eh <= -520000.0) || !(eh <= 3.2e-26)) {
                                        		tmp = fabs(((eh * cos(t)) * sin(atan(((eh / ew) / t)))));
                                        	} else {
                                        		tmp = fabs((ew * sin(t)));
                                        	}
                                        	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) :: tmp
                                            if ((eh <= (-520000.0d0)) .or. (.not. (eh <= 3.2d-26))) then
                                                tmp = abs(((eh * cos(t)) * sin(atan(((eh / ew) / t)))))
                                            else
                                                tmp = abs((ew * sin(t)))
                                            end if
                                            code = tmp
                                        end function
                                        
                                        public static double code(double eh, double ew, double t) {
                                        	double tmp;
                                        	if ((eh <= -520000.0) || !(eh <= 3.2e-26)) {
                                        		tmp = Math.abs(((eh * Math.cos(t)) * Math.sin(Math.atan(((eh / ew) / t)))));
                                        	} else {
                                        		tmp = Math.abs((ew * Math.sin(t)));
                                        	}
                                        	return tmp;
                                        }
                                        
                                        def code(eh, ew, t):
                                        	tmp = 0
                                        	if (eh <= -520000.0) or not (eh <= 3.2e-26):
                                        		tmp = math.fabs(((eh * math.cos(t)) * math.sin(math.atan(((eh / ew) / t)))))
                                        	else:
                                        		tmp = math.fabs((ew * math.sin(t)))
                                        	return tmp
                                        
                                        function code(eh, ew, t)
                                        	tmp = 0.0
                                        	if ((eh <= -520000.0) || !(eh <= 3.2e-26))
                                        		tmp = abs(Float64(Float64(eh * cos(t)) * sin(atan(Float64(Float64(eh / ew) / t)))));
                                        	else
                                        		tmp = abs(Float64(ew * sin(t)));
                                        	end
                                        	return tmp
                                        end
                                        
                                        function tmp_2 = code(eh, ew, t)
                                        	tmp = 0.0;
                                        	if ((eh <= -520000.0) || ~((eh <= 3.2e-26)))
                                        		tmp = abs(((eh * cos(t)) * sin(atan(((eh / ew) / t)))));
                                        	else
                                        		tmp = abs((ew * sin(t)));
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        code[eh_, ew_, t_] := If[Or[LessEqual[eh, -520000.0], N[Not[LessEqual[eh, 3.2e-26]], $MachinePrecision]], N[Abs[N[(N[(eh * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Sin[N[ArcTan[N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Sin[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;eh \leq -520000 \lor \neg \left(eh \leq 3.2 \cdot 10^{-26}\right):\\
                                        \;\;\;\;\left|\left(eh \cdot \cos t\right) \cdot \sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right)\right|\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\left|ew \cdot \sin t\right|\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if eh < -5.2e5 or 3.2000000000000001e-26 < 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. Add Preprocessing
                                          3. 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) + \frac{ew \cdot \left(\cos \tan^{-1} \left(\frac{eh \cdot \cos t}{ew \cdot \sin t}\right) \cdot \sin t\right)}{eh}\right)}\right| \]
                                          4. Step-by-step derivation
                                            1. Applied rewrites99.8%

                                              \[\leadsto \left|\color{blue}{\mathsf{fma}\left(\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right), \cos t, \cos \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{\sin t}\right) \cdot \frac{\sin t \cdot ew}{eh}\right) \cdot eh}\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. Applied rewrites88.5%

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

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

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

                                                if -5.2e5 < eh < 3.2000000000000001e-26

                                                1. Initial program 99.8%

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

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

                                                  \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
                                                5. Step-by-step derivation
                                                  1. Applied rewrites66.2%

                                                    \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
                                                6. Recombined 2 regimes into one program.
                                                7. Final simplification71.3%

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

                                                Alternative 9: 62.8% accurate, 2.5× speedup?

                                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -620000 \lor \neg \left(t \leq 0.62\right):\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{1}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{t}\right) \cdot eh\right|\\ \end{array} \end{array} \]
                                                (FPCore (eh ew t)
                                                 :precision binary64
                                                 (if (or (<= t -620000.0) (not (<= t 0.62)))
                                                   (fabs (/ (fma (/ (/ eh ew) t) eh (* (sin t) ew)) 1.0))
                                                   (fabs (* (sin (atan (* (/ (cos t) ew) (/ eh t)))) eh))))
                                                double code(double eh, double ew, double t) {
                                                	double tmp;
                                                	if ((t <= -620000.0) || !(t <= 0.62)) {
                                                		tmp = fabs((fma(((eh / ew) / t), eh, (sin(t) * ew)) / 1.0));
                                                	} else {
                                                		tmp = fabs((sin(atan(((cos(t) / ew) * (eh / t)))) * eh));
                                                	}
                                                	return tmp;
                                                }
                                                
                                                function code(eh, ew, t)
                                                	tmp = 0.0
                                                	if ((t <= -620000.0) || !(t <= 0.62))
                                                		tmp = abs(Float64(fma(Float64(Float64(eh / ew) / t), eh, Float64(sin(t) * ew)) / 1.0));
                                                	else
                                                		tmp = abs(Float64(sin(atan(Float64(Float64(cos(t) / ew) * Float64(eh / t)))) * eh));
                                                	end
                                                	return tmp
                                                end
                                                
                                                code[eh_, ew_, t_] := If[Or[LessEqual[t, -620000.0], N[Not[LessEqual[t, 0.62]], $MachinePrecision]], N[Abs[N[(N[(N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[N[(N[(N[Cos[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]
                                                
                                                \begin{array}{l}
                                                
                                                \\
                                                \begin{array}{l}
                                                \mathbf{if}\;t \leq -620000 \lor \neg \left(t \leq 0.62\right):\\
                                                \;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{1}\right|\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{t}\right) \cdot eh\right|\\
                                                
                                                
                                                \end{array}
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 2 regimes
                                                2. if t < -6.2e5 or 0.619999999999999996 < t

                                                  1. Initial program 99.6%

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

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

                                                    \[\leadsto \left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\color{blue}{1}}\right| \]
                                                  5. Step-by-step derivation
                                                    1. Applied rewrites54.0%

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

                                                      \[\leadsto \left|\frac{\mathsf{fma}\left(\color{blue}{\frac{eh}{ew \cdot t}}, eh, \sin t \cdot ew\right)}{1}\right| \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites54.3%

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

                                                      if -6.2e5 < t < 0.619999999999999996

                                                      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. Add Preprocessing
                                                      3. 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| \]
                                                      4. Step-by-step derivation
                                                        1. Applied rewrites75.5%

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

                                                          \[\leadsto \left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{t}\right) \cdot eh\right| \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites75.5%

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

                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -620000 \lor \neg \left(t \leq 0.62\right):\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{1}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\cos t}{ew} \cdot \frac{eh}{t}\right) \cdot eh\right|\\ \end{array} \]
                                                        6. Add Preprocessing

                                                        Alternative 10: 62.8% accurate, 3.6× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{\frac{eh}{ew}}{t}\\ \mathbf{if}\;t \leq -620000 \lor \neg \left(t \leq 0.62\right):\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(t\_1, eh, \sin t \cdot ew\right)}{1}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\sin \tan^{-1} t\_1 \cdot eh\right|\\ \end{array} \end{array} \]
                                                        (FPCore (eh ew t)
                                                         :precision binary64
                                                         (let* ((t_1 (/ (/ eh ew) t)))
                                                           (if (or (<= t -620000.0) (not (<= t 0.62)))
                                                             (fabs (/ (fma t_1 eh (* (sin t) ew)) 1.0))
                                                             (fabs (* (sin (atan t_1)) eh)))))
                                                        double code(double eh, double ew, double t) {
                                                        	double t_1 = (eh / ew) / t;
                                                        	double tmp;
                                                        	if ((t <= -620000.0) || !(t <= 0.62)) {
                                                        		tmp = fabs((fma(t_1, eh, (sin(t) * ew)) / 1.0));
                                                        	} else {
                                                        		tmp = fabs((sin(atan(t_1)) * eh));
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        function code(eh, ew, t)
                                                        	t_1 = Float64(Float64(eh / ew) / t)
                                                        	tmp = 0.0
                                                        	if ((t <= -620000.0) || !(t <= 0.62))
                                                        		tmp = abs(Float64(fma(t_1, eh, Float64(sin(t) * ew)) / 1.0));
                                                        	else
                                                        		tmp = abs(Float64(sin(atan(t_1)) * eh));
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision]}, If[Or[LessEqual[t, -620000.0], N[Not[LessEqual[t, 0.62]], $MachinePrecision]], N[Abs[N[(N[(t$95$1 * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[Sin[N[ArcTan[t$95$1], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]]]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \begin{array}{l}
                                                        t_1 := \frac{\frac{eh}{ew}}{t}\\
                                                        \mathbf{if}\;t \leq -620000 \lor \neg \left(t \leq 0.62\right):\\
                                                        \;\;\;\;\left|\frac{\mathsf{fma}\left(t\_1, eh, \sin t \cdot ew\right)}{1}\right|\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\left|\sin \tan^{-1} t\_1 \cdot eh\right|\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if t < -6.2e5 or 0.619999999999999996 < t

                                                          1. Initial program 99.6%

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

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

                                                            \[\leadsto \left|\frac{\mathsf{fma}\left(\cos t \cdot \frac{\frac{eh}{\tan t}}{ew}, eh, \sin t \cdot ew\right)}{\color{blue}{1}}\right| \]
                                                          5. Step-by-step derivation
                                                            1. Applied rewrites54.0%

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

                                                              \[\leadsto \left|\frac{\mathsf{fma}\left(\color{blue}{\frac{eh}{ew \cdot t}}, eh, \sin t \cdot ew\right)}{1}\right| \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites54.3%

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

                                                              if -6.2e5 < t < 0.619999999999999996

                                                              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. Add Preprocessing
                                                              3. 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| \]
                                                              4. Step-by-step derivation
                                                                1. Applied rewrites75.5%

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

                                                                  \[\leadsto \left|\sin \tan^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh\right| \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites75.5%

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

                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -620000 \lor \neg \left(t \leq 0.62\right):\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{1}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\sin \tan^{-1} \left(\frac{\frac{eh}{ew}}{t}\right) \cdot eh\right|\\ \end{array} \]
                                                                6. Add Preprocessing

                                                                Alternative 11: 42.3% accurate, 5.9× speedup?

                                                                \[\begin{array}{l} \\ \left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{1}\right| \end{array} \]
                                                                (FPCore (eh ew t)
                                                                 :precision binary64
                                                                 (fabs (/ (fma (/ (/ eh ew) t) eh (* (sin t) ew)) 1.0)))
                                                                double code(double eh, double ew, double t) {
                                                                	return fabs((fma(((eh / ew) / t), eh, (sin(t) * ew)) / 1.0));
                                                                }
                                                                
                                                                function code(eh, ew, t)
                                                                	return abs(Float64(fma(Float64(Float64(eh / ew) / t), eh, Float64(sin(t) * ew)) / 1.0))
                                                                end
                                                                
                                                                code[eh_, ew_, t_] := N[Abs[N[(N[(N[(N[(eh / ew), $MachinePrecision] / t), $MachinePrecision] * eh + N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                \left|\frac{\mathsf{fma}\left(\frac{\frac{eh}{ew}}{t}, eh, \sin t \cdot ew\right)}{1}\right|
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Initial program 99.8%

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

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

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

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

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

                                                                      \[\leadsto \left|\frac{\mathsf{fma}\left(\color{blue}{\frac{\frac{eh}{ew}}{t}}, eh, \sin t \cdot ew\right)}{1}\right| \]
                                                                    2. Add Preprocessing

                                                                    Alternative 12: 41.3% accurate, 8.1× speedup?

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

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

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

                                                                      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
                                                                    5. Step-by-step derivation
                                                                      1. Applied rewrites39.6%

                                                                        \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
                                                                      2. Add Preprocessing

                                                                      Alternative 13: 19.1% accurate, 21.2× speedup?

                                                                      \[\begin{array}{l} \\ \left|\frac{\mathsf{fma}\left(eh \cdot \frac{eh}{ew}, -0.8333333333333334, ew\right) \cdot t}{1}\right| \end{array} \]
                                                                      (FPCore (eh ew t)
                                                                       :precision binary64
                                                                       (fabs (/ (* (fma (* eh (/ eh ew)) -0.8333333333333334 ew) t) 1.0)))
                                                                      double code(double eh, double ew, double t) {
                                                                      	return fabs(((fma((eh * (eh / ew)), -0.8333333333333334, ew) * t) / 1.0));
                                                                      }
                                                                      
                                                                      function code(eh, ew, t)
                                                                      	return abs(Float64(Float64(fma(Float64(eh * Float64(eh / ew)), -0.8333333333333334, ew) * t) / 1.0))
                                                                      end
                                                                      
                                                                      code[eh_, ew_, t_] := N[Abs[N[(N[(N[(N[(eh * N[(eh / ew), $MachinePrecision]), $MachinePrecision] * -0.8333333333333334 + ew), $MachinePrecision] * t), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \left|\frac{\mathsf{fma}\left(eh \cdot \frac{eh}{ew}, -0.8333333333333334, ew\right) \cdot t}{1}\right|
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 99.8%

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

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

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

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

                                                                          \[\leadsto \left|\frac{\color{blue}{\frac{{t}^{2} \cdot \left(\left(ew + \frac{-1}{2} \cdot \frac{{eh}^{2}}{ew}\right) - \frac{1}{3} \cdot \frac{{eh}^{2}}{ew}\right) + \frac{{eh}^{2}}{ew}}{t}}}{1}\right| \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites11.7%

                                                                            \[\leadsto \left|\frac{\color{blue}{\frac{\mathsf{fma}\left(ew + \frac{eh \cdot eh}{ew} \cdot -0.8333333333333334, t \cdot t, \frac{eh \cdot eh}{ew}\right)}{t}}}{1}\right| \]
                                                                          2. Taylor expanded in t around inf

                                                                            \[\leadsto \left|\frac{t \cdot \color{blue}{\left(ew + \frac{-5}{6} \cdot \frac{{eh}^{2}}{ew}\right)}}{1}\right| \]
                                                                          3. Step-by-step derivation
                                                                            1. Applied rewrites17.4%

                                                                              \[\leadsto \left|\frac{\mathsf{fma}\left(eh \cdot \frac{eh}{ew}, -0.8333333333333334, ew\right) \cdot \color{blue}{t}}{1}\right| \]
                                                                            2. Add Preprocessing

                                                                            Alternative 14: 18.5% accurate, 108.8× speedup?

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

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

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

                                                                              \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
                                                                            5. Step-by-step derivation
                                                                              1. Applied rewrites39.6%

                                                                                \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
                                                                              2. Taylor expanded in t around 0

                                                                                \[\leadsto \left|ew \cdot t\right| \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites16.6%

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

                                                                                Reproduce

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