Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 15.5s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 56.8% accurate, 0.7× speedup?

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

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

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = ew * cos(t)
    t_2 = atan(((eh * tan(t)) / -ew))
    if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= (-1d-299)) then
        tmp = abs((t_1 * cos(atan(-((eh * t) / ew)))))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double t_1 = ew * Math.cos(t);
	double t_2 = Math.atan(((eh * Math.tan(t)) / -ew));
	double tmp;
	if (((t_1 * Math.cos(t_2)) - ((eh * Math.sin(t)) * Math.sin(t_2))) <= -1e-299) {
		tmp = Math.abs((t_1 * Math.cos(Math.atan(-((eh * t) / ew)))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = ew * math.cos(t)
	t_2 = math.atan(((eh * math.tan(t)) / -ew))
	tmp = 0
	if ((t_1 * math.cos(t_2)) - ((eh * math.sin(t)) * math.sin(t_2))) <= -1e-299:
		tmp = math.fabs((t_1 * math.cos(math.atan(-((eh * t) / ew)))))
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = Float64(ew * cos(t))
	t_2 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))
	tmp = 0.0
	if (Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) <= -1e-299)
		tmp = abs(Float64(t_1 * cos(atan(Float64(-Float64(Float64(eh * t) / ew))))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = ew * cos(t);
	t_2 = atan(((eh * tan(t)) / -ew));
	tmp = 0.0;
	if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= -1e-299)
		tmp = abs((t_1 * cos(atan(-((eh * t) / ew)))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-299], N[Abs[N[(t$95$1 * N[Cos[N[ArcTan[(-N[(N[(eh * t), $MachinePrecision] / ew), $MachinePrecision])], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

        if -9.99999999999999992e-300 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))))

        1. Initial program 99.7%

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

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

          \[\leadsto \color{blue}{ew \cdot \cos t} \]
        5. Step-by-step derivation
          1. Applied rewrites63.2%

            \[\leadsto \color{blue}{ew \cdot \cos t} \]
        6. Recombined 2 regimes into one program.
        7. Final simplification58.3%

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

        Alternative 3: 51.1% accurate, 0.8× speedup?

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

          1. Initial program 99.8%

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

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

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

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

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

              if -9.99999999999999992e-300 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))))

              1. Initial program 99.7%

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

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

                \[\leadsto \color{blue}{ew \cdot \cos t} \]
              5. Step-by-step derivation
                1. Applied rewrites63.2%

                  \[\leadsto \color{blue}{ew \cdot \cos t} \]
              6. Recombined 2 regimes into one program.
              7. Final simplification51.7%

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

              Alternative 4: 42.3% accurate, 0.8× speedup?

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

                1. Initial program 99.8%

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

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

                  \[\leadsto e^{\log \color{blue}{\left({ew}^{2}\right)} \cdot \frac{1}{2}} \]
                5. Step-by-step derivation
                  1. Applied rewrites23.1%

                    \[\leadsto e^{\log \color{blue}{\left(ew \cdot ew\right)} \cdot 0.5} \]

                  if -9.99999999999999992e-300 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))))

                  1. Initial program 99.7%

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

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

                    \[\leadsto \color{blue}{ew \cdot \cos t} \]
                  5. Step-by-step derivation
                    1. Applied rewrites63.2%

                      \[\leadsto \color{blue}{ew \cdot \cos t} \]
                  6. Recombined 2 regimes into one program.
                  7. Final simplification41.0%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right) \leq -1 \cdot 10^{-299}:\\ \;\;\;\;e^{\log \left(ew \cdot ew\right) \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;ew \cdot \cos t\\ \end{array} \]
                  8. Add Preprocessing

                  Alternative 5: 42.0% accurate, 0.9× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_1 := ew \cdot \cos t\\ t_2 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\ \mathbf{if}\;t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2 \leq -1 \cdot 10^{-299}:\\ \;\;\;\;\sqrt{{\left(\mathsf{fma}\left(-0.5 \cdot ew, t \cdot t, ew\right)\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                  (FPCore (eh ew t)
                   :precision binary64
                   (let* ((t_1 (* ew (cos t))) (t_2 (atan (/ (* eh (tan t)) (- ew)))))
                     (if (<= (- (* t_1 (cos t_2)) (* (* eh (sin t)) (sin t_2))) -1e-299)
                       (sqrt (pow (fma (* -0.5 ew) (* t t) ew) 2.0))
                       t_1)))
                  double code(double eh, double ew, double t) {
                  	double t_1 = ew * cos(t);
                  	double t_2 = atan(((eh * tan(t)) / -ew));
                  	double tmp;
                  	if (((t_1 * cos(t_2)) - ((eh * sin(t)) * sin(t_2))) <= -1e-299) {
                  		tmp = sqrt(pow(fma((-0.5 * ew), (t * t), ew), 2.0));
                  	} else {
                  		tmp = t_1;
                  	}
                  	return tmp;
                  }
                  
                  function code(eh, ew, t)
                  	t_1 = Float64(ew * cos(t))
                  	t_2 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))
                  	tmp = 0.0
                  	if (Float64(Float64(t_1 * cos(t_2)) - Float64(Float64(eh * sin(t)) * sin(t_2))) <= -1e-299)
                  		tmp = sqrt((fma(Float64(-0.5 * ew), Float64(t * t), ew) ^ 2.0));
                  	else
                  		tmp = t_1;
                  	end
                  	return tmp
                  end
                  
                  code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-299], N[Sqrt[N[Power[N[(N[(-0.5 * ew), $MachinePrecision] * N[(t * t), $MachinePrecision] + ew), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], t$95$1]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_1 := ew \cdot \cos t\\
                  t_2 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\
                  \mathbf{if}\;t\_1 \cdot \cos t\_2 - \left(eh \cdot \sin t\right) \cdot \sin t\_2 \leq -1 \cdot 10^{-299}:\\
                  \;\;\;\;\sqrt{{\left(\mathsf{fma}\left(-0.5 \cdot ew, t \cdot t, ew\right)\right)}^{2}}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_1\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))) < -9.99999999999999992e-300

                    1. Initial program 99.8%

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

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

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

                        \[\leadsto e^{\log \left({\color{blue}{\left(ew + \left(t \cdot t\right) \cdot \left(\mathsf{fma}\left(-0.5, ew, \frac{eh \cdot eh}{ew}\right) - 0.5 \cdot \frac{eh \cdot eh}{ew}\right)\right)}}^{2}\right) \cdot 0.5} \]
                      2. Taylor expanded in eh around 0

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

                          \[\leadsto e^{\log \left({\left(ew + \left(t \cdot t\right) \cdot \left(-0.5 \cdot \color{blue}{ew}\right)\right)}^{2}\right) \cdot 0.5} \]
                        2. Step-by-step derivation
                          1. lift-exp.f64N/A

                            \[\leadsto \color{blue}{e^{\log \left({\left(ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew\right)\right)}^{2}\right) \cdot \frac{1}{2}}} \]
                          2. lift-*.f64N/A

                            \[\leadsto e^{\color{blue}{\log \left({\left(ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew\right)\right)}^{2}\right) \cdot \frac{1}{2}}} \]
                          3. lift-log.f64N/A

                            \[\leadsto e^{\color{blue}{\log \left({\left(ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew\right)\right)}^{2}\right)} \cdot \frac{1}{2}} \]
                        3. Applied rewrites22.2%

                          \[\leadsto \color{blue}{\sqrt{{\left(\mathsf{fma}\left(-0.5 \cdot ew, t \cdot t, ew\right)\right)}^{2}}} \]

                        if -9.99999999999999992e-300 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))))

                        1. Initial program 99.7%

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

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

                          \[\leadsto \color{blue}{ew \cdot \cos t} \]
                        5. Step-by-step derivation
                          1. Applied rewrites63.2%

                            \[\leadsto \color{blue}{ew \cdot \cos t} \]
                        6. Recombined 2 regimes into one program.
                        7. Final simplification40.5%

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

                        Alternative 6: 32.4% accurate, 0.9× speedup?

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

                          1. Initial program 99.8%

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

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

                            \[\leadsto \color{blue}{ew} \]
                          5. Step-by-step derivation
                            1. Applied rewrites5.2%

                              \[\leadsto \color{blue}{ew} \]

                            if -2.0000000000000001e-196 < (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))))

                            1. Initial program 99.7%

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

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

                              \[\leadsto \color{blue}{ew \cdot \cos t} \]
                            5. Step-by-step derivation
                              1. Applied rewrites59.5%

                                \[\leadsto \color{blue}{ew \cdot \cos t} \]
                            6. Recombined 2 regimes into one program.
                            7. Final simplification31.1%

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

                            Alternative 7: 91.0% accurate, 1.3× speedup?

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

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

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

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

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

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

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

                                  \[\leadsto \left|\mathsf{fma}\left(\frac{\sin t}{-ew}, eh \cdot \tanh \left(-\frac{eh \cdot t}{ew}\right), \cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot \cos t\right) \cdot ew\right| \]
                                2. Final simplification93.8%

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

                                Alternative 8: 74.7% accurate, 1.6× speedup?

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

                                  1. Initial program 99.8%

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

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

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

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

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

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

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

                                      if -3.70000000000000008e-105 < ew < 2.25e-61

                                      1. Initial program 99.8%

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

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

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

                                        \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -3.7 \cdot 10^{-105} \lor \neg \left(ew \leq 2.25 \cdot 10^{-61}\right):\\ \;\;\;\;\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \sin t}{ew + -0.5 \cdot \left(ew \cdot \left(t \cdot t\right)\right)}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\sin t \cdot \left(-eh\right)\right) \cdot \sin \tan^{-1} \left(\frac{\sin t}{-ew} \cdot \frac{eh}{\cos t}\right)\right|\\ \end{array} \]
                                      7. Add Preprocessing

                                      Alternative 9: 74.7% accurate, 1.6× speedup?

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

                                        1. Initial program 99.8%

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

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

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

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

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

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

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

                                            if -3.70000000000000008e-105 < ew < 2.25e-61

                                            1. Initial program 99.8%

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

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

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

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

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

                                              \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -3.7 \cdot 10^{-105} \lor \neg \left(ew \leq 2.25 \cdot 10^{-61}\right):\\ \;\;\;\;\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \sin t}{ew + -0.5 \cdot \left(ew \cdot \left(t \cdot t\right)\right)}\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(-eh\right) \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \sin t}{ew \cdot \cos t}\right)\right|\\ \end{array} \]
                                            9. Add Preprocessing

                                            Alternative 10: 64.6% accurate, 1.6× speedup?

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

                                              1. Initial program 99.8%

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

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

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

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

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

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

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

                                                  if -4.09999999999999973e-232 < ew < 8.6000000000000004e-193

                                                  1. Initial program 99.7%

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

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

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

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

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

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

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

                                                  Alternative 11: 61.7% accurate, 1.9× speedup?

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

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

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

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

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

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

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

                                                        \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(-\frac{eh \cdot \sin t}{ew + -0.5 \cdot \left(ew \cdot \left(t \cdot t\right)\right)}\right)\right| \]
                                                      2. Final simplification63.5%

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

                                                      Alternative 12: 61.6% accurate, 2.0× speedup?

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

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

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

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

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

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

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

                                                          Alternative 13: 21.5% accurate, 862.0× speedup?

                                                          \[\begin{array}{l} \\ ew \end{array} \]
                                                          (FPCore (eh ew t) :precision binary64 ew)
                                                          double code(double eh, double ew, double t) {
                                                          	return ew;
                                                          }
                                                          
                                                          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 = ew
                                                          end function
                                                          
                                                          public static double code(double eh, double ew, double t) {
                                                          	return ew;
                                                          }
                                                          
                                                          def code(eh, ew, t):
                                                          	return ew
                                                          
                                                          function code(eh, ew, t)
                                                          	return ew
                                                          end
                                                          
                                                          function tmp = code(eh, ew, t)
                                                          	tmp = ew;
                                                          end
                                                          
                                                          code[eh_, ew_, t_] := ew
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          ew
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Initial program 99.8%

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

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

                                                            \[\leadsto \color{blue}{ew} \]
                                                          5. Step-by-step derivation
                                                            1. Applied rewrites21.1%

                                                              \[\leadsto \color{blue}{ew} \]
                                                            2. Add Preprocessing

                                                            Reproduce

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