Example 2 from Robby

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\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{\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}
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

Alternative 2: 99.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan t \cdot \frac{eh}{ew}\\ \left|\frac{\cos t}{\mathsf{hypot}\left(t\_1, 1\right)} \cdot ew - -1 \cdot \left(\left(eh \cdot \sin t\right) \cdot \tanh \sinh^{-1} t\_1\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* (tan t) (/ eh ew))))
   (fabs
    (-
     (* (/ (cos t) (hypot t_1 1.0)) ew)
     (* -1.0 (* (* eh (sin t)) (tanh (asinh t_1))))))))
double code(double eh, double ew, double t) {
	double t_1 = tan(t) * (eh / ew);
	return fabs((((cos(t) / hypot(t_1, 1.0)) * ew) - (-1.0 * ((eh * sin(t)) * tanh(asinh(t_1))))));
}
def code(eh, ew, t):
	t_1 = math.tan(t) * (eh / ew)
	return math.fabs((((math.cos(t) / math.hypot(t_1, 1.0)) * ew) - (-1.0 * ((eh * math.sin(t)) * math.tanh(math.asinh(t_1))))))
function code(eh, ew, t)
	t_1 = Float64(tan(t) * Float64(eh / ew))
	return abs(Float64(Float64(Float64(cos(t) / hypot(t_1, 1.0)) * ew) - Float64(-1.0 * Float64(Float64(eh * sin(t)) * tanh(asinh(t_1))))))
end
function tmp = code(eh, ew, t)
	t_1 = tan(t) * (eh / ew);
	tmp = abs((((cos(t) / hypot(t_1, 1.0)) * ew) - (-1.0 * ((eh * sin(t)) * tanh(asinh(t_1))))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] / N[Sqrt[t$95$1 ^ 2 + 1.0 ^ 2], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision] - N[(-1.0 * N[(N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

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

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

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

Alternative 3: 99.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan t \cdot \frac{eh}{ew}\\ \left|\frac{\cos t}{\mathsf{hypot}\left(t\_1, 1\right)} \cdot ew - \left(\tanh \sinh^{-1} t\_1 \cdot eh\right) \cdot \sin \left(-t\right)\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* (tan t) (/ eh ew))))
   (fabs
    (-
     (* (/ (cos t) (hypot t_1 1.0)) ew)
     (* (* (tanh (asinh t_1)) eh) (sin (- t)))))))
double code(double eh, double ew, double t) {
	double t_1 = tan(t) * (eh / ew);
	return fabs((((cos(t) / hypot(t_1, 1.0)) * ew) - ((tanh(asinh(t_1)) * eh) * sin(-t))));
}
def code(eh, ew, t):
	t_1 = math.tan(t) * (eh / ew)
	return math.fabs((((math.cos(t) / math.hypot(t_1, 1.0)) * ew) - ((math.tanh(math.asinh(t_1)) * eh) * math.sin(-t))))
function code(eh, ew, t)
	t_1 = Float64(tan(t) * Float64(eh / ew))
	return abs(Float64(Float64(Float64(cos(t) / hypot(t_1, 1.0)) * ew) - Float64(Float64(tanh(asinh(t_1)) * eh) * sin(Float64(-t)))))
end
function tmp = code(eh, ew, t)
	t_1 = tan(t) * (eh / ew);
	tmp = abs((((cos(t) / hypot(t_1, 1.0)) * ew) - ((tanh(asinh(t_1)) * eh) * sin(-t))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]}, N[Abs[N[(N[(N[(N[Cos[t], $MachinePrecision] / N[Sqrt[t$95$1 ^ 2 + 1.0 ^ 2], $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision] - N[(N[(N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision] * N[Sin[(-t)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

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

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

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

Alternative 4: 93.5% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := eh \cdot \sin t\\ t_2 := \tan^{-1} \left(\frac{-1 \cdot \left(eh \cdot t\right)}{ew}\right)\\ \mathbf{if}\;ew \leq 2.4 \cdot 10^{-84}:\\ \;\;\;\;\left|\left(ew \cdot \cos t\right) \cdot \cos t\_2 - t\_1 \cdot \sin t\_2\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\cos t \cdot ew - t\_1 \cdot \left(\frac{eh}{\left|\tan t \cdot \frac{eh}{ew}\right| - 1} \cdot \frac{\tan t}{ew}\right)\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* eh (sin t))) (t_2 (atan (/ (* -1.0 (* eh t)) ew))))
   (if (<= ew 2.4e-84)
     (fabs (- (* (* ew (cos t)) (cos t_2)) (* t_1 (sin t_2))))
     (fabs
      (-
       (* (cos t) ew)
       (*
        t_1
        (* (/ eh (- (fabs (* (tan t) (/ eh ew))) 1.0)) (/ (tan t) ew))))))))
double code(double eh, double ew, double t) {
	double t_1 = eh * sin(t);
	double t_2 = atan(((-1.0 * (eh * t)) / ew));
	double tmp;
	if (ew <= 2.4e-84) {
		tmp = fabs((((ew * cos(t)) * cos(t_2)) - (t_1 * sin(t_2))));
	} else {
		tmp = fabs(((cos(t) * ew) - (t_1 * ((eh / (fabs((tan(t) * (eh / ew))) - 1.0)) * (tan(t) / ew)))));
	}
	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 = atan((((-1.0d0) * (eh * t)) / ew))
    if (ew <= 2.4d-84) then
        tmp = abs((((ew * cos(t)) * cos(t_2)) - (t_1 * sin(t_2))))
    else
        tmp = abs(((cos(t) * ew) - (t_1 * ((eh / (abs((tan(t) * (eh / ew))) - 1.0d0)) * (tan(t) / ew)))))
    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 = Math.atan(((-1.0 * (eh * t)) / ew));
	double tmp;
	if (ew <= 2.4e-84) {
		tmp = Math.abs((((ew * Math.cos(t)) * Math.cos(t_2)) - (t_1 * Math.sin(t_2))));
	} else {
		tmp = Math.abs(((Math.cos(t) * ew) - (t_1 * ((eh / (Math.abs((Math.tan(t) * (eh / ew))) - 1.0)) * (Math.tan(t) / ew)))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = eh * math.sin(t)
	t_2 = math.atan(((-1.0 * (eh * t)) / ew))
	tmp = 0
	if ew <= 2.4e-84:
		tmp = math.fabs((((ew * math.cos(t)) * math.cos(t_2)) - (t_1 * math.sin(t_2))))
	else:
		tmp = math.fabs(((math.cos(t) * ew) - (t_1 * ((eh / (math.fabs((math.tan(t) * (eh / ew))) - 1.0)) * (math.tan(t) / ew)))))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(eh * sin(t))
	t_2 = atan(Float64(Float64(-1.0 * Float64(eh * t)) / ew))
	tmp = 0.0
	if (ew <= 2.4e-84)
		tmp = abs(Float64(Float64(Float64(ew * cos(t)) * cos(t_2)) - Float64(t_1 * sin(t_2))));
	else
		tmp = abs(Float64(Float64(cos(t) * ew) - Float64(t_1 * Float64(Float64(eh / Float64(abs(Float64(tan(t) * Float64(eh / ew))) - 1.0)) * Float64(tan(t) / ew)))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = eh * sin(t);
	t_2 = atan(((-1.0 * (eh * t)) / ew));
	tmp = 0.0;
	if (ew <= 2.4e-84)
		tmp = abs((((ew * cos(t)) * cos(t_2)) - (t_1 * sin(t_2))));
	else
		tmp = abs(((cos(t) * ew) - (t_1 * ((eh / (abs((tan(t) * (eh / ew))) - 1.0)) * (tan(t) / ew)))));
	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[ArcTan[N[(N[(-1.0 * N[(eh * t), $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, 2.4e-84], N[Abs[N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision] - N[(t$95$1 * N[(N[(eh / N[(N[Abs[N[(N[Tan[t], $MachinePrecision] * N[(eh / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < 2.40000000000000017e-84

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

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

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

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

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

    if 2.40000000000000017e-84 < 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. Applied rewrites99.8%

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

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

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

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

Alternative 5: 66.1% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq 1.6 \cdot 10^{-202}:\\
\;\;\;\;\left|-1 \cdot \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right)\right)\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < 1.6000000000000001e-202

    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. 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| \]
    3. Applied rewrites40.8%

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

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

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

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

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

    if 1.6000000000000001e-202 < 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. Applied rewrites99.8%

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

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

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

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

Alternative 6: 62.5% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;ew \leq 1.02 \cdot 10^{-149}:\\
\;\;\;\;\left|-1 \cdot \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right)\right)\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < 1.0200000000000001e-149

    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. 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| \]
    3. Applied rewrites40.8%

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

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

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

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

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

    if 1.0200000000000001e-149 < 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. Applied rewrites99.8%

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

      \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
    4. Applied rewrites62.5%

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

Alternative 7: 61.4% accurate, 4.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.5 \cdot 10^{-6}:\\
\;\;\;\;\left|ew \cdot \left(\left|\tan t \cdot \frac{eh}{ew}\right| - 1\right)\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 3.49999999999999995e-6

    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. 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| \]
    3. Applied rewrites42.8%

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

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

    if 3.49999999999999995e-6 < t

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

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

      \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
    4. Applied rewrites62.5%

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

Alternative 8: 57.7% accurate, 5.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;ew \leq 2.4 \cdot 10^{-263}:\\ \;\;\;\;\left|\frac{{eh}^{2} \cdot t}{\sqrt{{eh}^{2}}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= ew 2.4e-263)
   (fabs (/ (* (pow eh 2.0) t) (sqrt (pow eh 2.0))))
   (fabs (* ew (cos t)))))
double code(double eh, double ew, double t) {
	double tmp;
	if (ew <= 2.4e-263) {
		tmp = fabs(((pow(eh, 2.0) * t) / sqrt(pow(eh, 2.0))));
	} else {
		tmp = fabs((ew * 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 <= 2.4d-263) then
        tmp = abs((((eh ** 2.0d0) * t) / sqrt((eh ** 2.0d0))))
    else
        tmp = abs((ew * cos(t)))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if (ew <= 2.4e-263) {
		tmp = Math.abs(((Math.pow(eh, 2.0) * t) / Math.sqrt(Math.pow(eh, 2.0))));
	} else {
		tmp = Math.abs((ew * Math.cos(t)));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if ew <= 2.4e-263:
		tmp = math.fabs(((math.pow(eh, 2.0) * t) / math.sqrt(math.pow(eh, 2.0))))
	else:
		tmp = math.fabs((ew * math.cos(t)))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if (ew <= 2.4e-263)
		tmp = abs(Float64(Float64((eh ^ 2.0) * t) / sqrt((eh ^ 2.0))));
	else
		tmp = abs(Float64(ew * cos(t)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if (ew <= 2.4e-263)
		tmp = abs((((eh ^ 2.0) * t) / sqrt((eh ^ 2.0))));
	else
		tmp = abs((ew * cos(t)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[ew, 2.4e-263], N[Abs[N[(N[(N[Power[eh, 2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[Power[eh, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;ew \leq 2.4 \cdot 10^{-263}:\\
\;\;\;\;\left|\frac{{eh}^{2} \cdot t}{\sqrt{{eh}^{2}}}\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < 2.4e-263

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

      \[\leadsto \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 \color{blue}{\left(\frac{eh}{ew} \cdot \frac{\tan \left(-t\right)}{\mathsf{hypot}\left(\tan t \cdot \frac{eh}{ew}, 1\right)}\right)}\right| \]
    3. Taylor expanded in ew around 0

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

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

      \[\leadsto \left|\frac{{eh}^{2} \cdot t}{\color{blue}{\sqrt{{eh}^{2}}}}\right| \]
    6. Applied rewrites8.3%

      \[\leadsto \left|\frac{{eh}^{2} \cdot t}{\color{blue}{\sqrt{{eh}^{2}}}}\right| \]

    if 2.4e-263 < 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. Applied rewrites99.8%

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

      \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
    4. Applied rewrites62.5%

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

Alternative 9: 43.0% accurate, 6.7× speedup?

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

\\
\left|ew \cdot \cos t\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. Applied rewrites99.8%

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

    \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
  4. Applied rewrites62.5%

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

Alternative 10: 36.2% accurate, 112.6× speedup?

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

\\
\left|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. 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| \]
  3. Applied rewrites92.4%

    \[\leadsto \left|\color{blue}{ew \cdot \mathsf{fma}\left(-1, \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 rewrites79.3%

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

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

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

    \[\leadsto \color{blue}{\left|ew\right|} \]
  8. Add Preprocessing

Alternative 11: 5.5% accurate, 246.9× speedup?

\[\begin{array}{l} \\ eh \end{array} \]
(FPCore (eh ew t) :precision binary64 eh)
double code(double eh, double ew, double t) {
	return eh;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = eh
end function
public static double code(double eh, double ew, double t) {
	return eh;
}
def code(eh, ew, t):
	return eh
function code(eh, ew, t)
	return eh
end
function tmp = code(eh, ew, t)
	tmp = eh;
end
code[eh_, ew_, t_] := eh
\begin{array}{l}

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

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

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

    \[\leadsto \color{blue}{eh} \]
  5. Add Preprocessing

Alternative 12: 5.5% accurate, 246.9× speedup?

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

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

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

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

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

Alternative 13: 5.5% accurate, 246.9× speedup?

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  5. Add Preprocessing

Alternative 14: 2.9% accurate, 246.9× speedup?

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

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

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

    \[\leadsto \left|\frac{\cos t}{\mathsf{hypot}\left(\tan t \cdot \frac{eh}{ew}, 1\right)} \cdot ew - \color{blue}{-1 \cdot \left(\left(eh \cdot \sin t\right) \cdot \tanh \sinh^{-1} \left(\tan t \cdot \frac{eh}{ew}\right)\right)}\right| \]
  4. Applied rewrites2.9%

    \[\leadsto \color{blue}{0} \]
  5. Add Preprocessing

Reproduce

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