Example 2 from Robby

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

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\\ \left|\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (* (- eh) (tan t)) ew))))
   (fabs (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((-eh * tan(t)) / ew));
	return fabs((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))));
}
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 9 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \left|\color{blue}{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 34.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\ t_2 := \frac{eh \cdot eh}{ew}\\ \mathbf{if}\;\left(ew \cdot \cos t\right) \cdot \cos t\_1 - \left(eh \cdot \sin t\right) \cdot \sin t\_1 \leq 4 \cdot 10^{-21}:\\ \;\;\;\;\left|\mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(-0.5, ew, t\_2\right) - 0.5 \cdot t\_2, ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(t \cdot ew\right) \cdot t, -0.5, ew\right)\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (* eh (tan t)) (- ew)))) (t_2 (/ (* eh eh) ew)))
   (if (<= (- (* (* ew (cos t)) (cos t_1)) (* (* eh (sin t)) (sin t_1))) 4e-21)
     (fabs (fma (* t t) (- (fma -0.5 ew t_2) (* 0.5 t_2)) ew))
     (fma (* (* t ew) t) -0.5 ew))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((eh * tan(t)) / -ew));
	double t_2 = (eh * eh) / ew;
	double tmp;
	if ((((ew * cos(t)) * cos(t_1)) - ((eh * sin(t)) * sin(t_1))) <= 4e-21) {
		tmp = fabs(fma((t * t), (fma(-0.5, ew, t_2) - (0.5 * t_2)), ew));
	} else {
		tmp = fma(((t * ew) * t), -0.5, ew);
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))
	t_2 = Float64(Float64(eh * eh) / ew)
	tmp = 0.0
	if (Float64(Float64(Float64(ew * cos(t)) * cos(t_1)) - Float64(Float64(eh * sin(t)) * sin(t_1))) <= 4e-21)
		tmp = abs(fma(Float64(t * t), Float64(fma(-0.5, ew, t_2) - Float64(0.5 * t_2)), ew));
	else
		tmp = fma(Float64(Float64(t * ew) * t), -0.5, ew);
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / (-ew)), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(eh * eh), $MachinePrecision] / ew), $MachinePrecision]}, If[LessEqual[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], 4e-21], N[Abs[N[(N[(t * t), $MachinePrecision] * N[(N[(-0.5 * ew + t$95$2), $MachinePrecision] - N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision] + ew), $MachinePrecision]], $MachinePrecision], N[(N[(N[(t * ew), $MachinePrecision] * t), $MachinePrecision] * -0.5 + ew), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(t \cdot ew\right) \cdot t, -0.5, ew\right)\\


\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))))) < 3.99999999999999963e-21

    1. Initial program 99.8%

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

        \[\leadsto \left|\color{blue}{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\color{blue}{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| \]
      4. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(\frac{-1}{2}, ew, \frac{eh \cdot eh}{ew}\right) - \frac{1}{2} \cdot \frac{\color{blue}{eh \cdot eh}}{ew}, ew\right)\right| \]
        13. lower-*.f6428.9

          \[\leadsto \left|\mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(-0.5, ew, \frac{eh \cdot eh}{ew}\right) - 0.5 \cdot \frac{\color{blue}{eh \cdot eh}}{ew}, ew\right)\right| \]
      5. Applied rewrites28.9%

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

      if 3.99999999999999963e-21 < (-.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.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 rewrites80.4%

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

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

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

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

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

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

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

          \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\color{blue}{\frac{-1}{2} \cdot ew} - \left(-1 \cdot \frac{{eh}^{2}}{ew} + \frac{1}{2} \cdot \frac{{eh}^{2}}{ew}\right)\right) \]
        7. distribute-rgt-outN/A

          \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \color{blue}{\frac{{eh}^{2}}{ew} \cdot \left(-1 + \frac{1}{2}\right)}\right) \]
        8. metadata-evalN/A

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

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

          \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \color{blue}{\frac{{eh}^{2}}{ew}} \cdot \frac{-1}{2}\right) \]
        11. unpow2N/A

          \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \frac{\color{blue}{eh \cdot eh}}{ew} \cdot \frac{-1}{2}\right) \]
        12. lower-*.f6423.5

          \[\leadsto ew + \left(t \cdot t\right) \cdot \left(-0.5 \cdot ew - \frac{\color{blue}{eh \cdot eh}}{ew} \cdot -0.5\right) \]
      6. Applied rewrites23.5%

        \[\leadsto \color{blue}{ew + \left(t \cdot t\right) \cdot \left(-0.5 \cdot ew - \frac{eh \cdot eh}{ew} \cdot -0.5\right)} \]
      7. Taylor expanded in eh around 0

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

          \[\leadsto \mathsf{fma}\left(\left(t \cdot t\right) \cdot ew, \color{blue}{-0.5}, ew\right) \]
        2. Step-by-step derivation
          1. Applied rewrites28.2%

            \[\leadsto \mathsf{fma}\left(\left(t \cdot ew\right) \cdot t, -0.5, ew\right) \]
        3. Recombined 2 regimes into one program.
        4. Final simplification28.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 4 \cdot 10^{-21}:\\ \;\;\;\;\left|\mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(-0.5, ew, \frac{eh \cdot eh}{ew}\right) - 0.5 \cdot \frac{eh \cdot eh}{ew}, ew\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(t \cdot ew\right) \cdot t, -0.5, ew\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 3: 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 4: 98.2% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot \left(\sin t \cdot eh\right)\right)\right| \end{array} \]
        (FPCore (eh ew t)
         :precision binary64
         (fabs
          (fma
           (/ ew 1.0)
           (cos t)
           (* (tanh (asinh (* (/ (tan t) ew) eh))) (* (sin t) eh)))))
        double code(double eh, double ew, double t) {
        	return fabs(fma((ew / 1.0), cos(t), (tanh(asinh(((tan(t) / ew) * eh))) * (sin(t) * eh))));
        }
        
        function code(eh, ew, t)
        	return abs(fma(Float64(ew / 1.0), cos(t), Float64(tanh(asinh(Float64(Float64(tan(t) / ew) * eh))) * Float64(sin(t) * eh))))
        end
        
        code[eh_, ew_, t_] := N[Abs[N[(N[(ew / 1.0), $MachinePrecision] * N[Cos[t], $MachinePrecision] + N[(N[Tanh[N[ArcSinh[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot \left(\sin t \cdot eh\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. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \left|\color{blue}{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 5: 97.9% accurate, 1.9× speedup?

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

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

              \[\leadsto \left|\color{blue}{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 6: 97.9% accurate, 2.5× speedup?

            \[\begin{array}{l} \\ \left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \tanh \left(\frac{eh \cdot t}{ew}\right) \cdot \left(\sin t \cdot eh\right)\right)\right| \end{array} \]
            (FPCore (eh ew t)
             :precision binary64
             (fabs (fma (/ ew 1.0) (cos t) (* (tanh (/ (* eh t) ew)) (* (sin t) eh)))))
            double code(double eh, double ew, double t) {
            	return fabs(fma((ew / 1.0), cos(t), (tanh(((eh * t) / ew)) * (sin(t) * eh))));
            }
            
            function code(eh, ew, t)
            	return abs(fma(Float64(ew / 1.0), cos(t), Float64(tanh(Float64(Float64(eh * t) / ew)) * Float64(sin(t) * eh))))
            end
            
            code[eh_, ew_, t_] := N[Abs[N[(N[(ew / 1.0), $MachinePrecision] * N[Cos[t], $MachinePrecision] + N[(N[Tanh[N[(N[(eh * t), $MachinePrecision] / ew), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \tanh \left(\frac{eh \cdot t}{ew}\right) \cdot \left(\sin t \cdot eh\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. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \left|\color{blue}{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 7: 62.1% accurate, 8.0× 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. Add Preprocessing
              3. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \left|\color{blue}{\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left|\color{blue}{ew \cdot \cos t}\right| \]
                2. lower-cos.f6462.2

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

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

              Alternative 8: 20.1% accurate, 50.7× speedup?

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

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

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

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

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

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

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

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

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

                  \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\color{blue}{\frac{-1}{2} \cdot ew} - \left(-1 \cdot \frac{{eh}^{2}}{ew} + \frac{1}{2} \cdot \frac{{eh}^{2}}{ew}\right)\right) \]
                7. distribute-rgt-outN/A

                  \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \color{blue}{\frac{{eh}^{2}}{ew} \cdot \left(-1 + \frac{1}{2}\right)}\right) \]
                8. metadata-evalN/A

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

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

                  \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \color{blue}{\frac{{eh}^{2}}{ew}} \cdot \frac{-1}{2}\right) \]
                11. unpow2N/A

                  \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \frac{\color{blue}{eh \cdot eh}}{ew} \cdot \frac{-1}{2}\right) \]
                12. lower-*.f6414.8

                  \[\leadsto ew + \left(t \cdot t\right) \cdot \left(-0.5 \cdot ew - \frac{\color{blue}{eh \cdot eh}}{ew} \cdot -0.5\right) \]
              6. Applied rewrites14.8%

                \[\leadsto \color{blue}{ew + \left(t \cdot t\right) \cdot \left(-0.5 \cdot ew - \frac{eh \cdot eh}{ew} \cdot -0.5\right)} \]
              7. Taylor expanded in eh around 0

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

                  \[\leadsto \mathsf{fma}\left(\left(t \cdot t\right) \cdot ew, \color{blue}{-0.5}, ew\right) \]
                2. Step-by-step derivation
                  1. Applied rewrites16.5%

                    \[\leadsto \mathsf{fma}\left(\left(t \cdot ew\right) \cdot t, -0.5, ew\right) \]
                  2. Add Preprocessing

                  Alternative 9: 3.3% accurate, 53.9× speedup?

                  \[\begin{array}{l} \\ -0.5 \cdot \left(ew \cdot \left(t \cdot t\right)\right) \end{array} \]
                  (FPCore (eh ew t) :precision binary64 (* -0.5 (* ew (* t t))))
                  double code(double eh, double ew, double t) {
                  	return -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 = (-0.5d0) * (ew * (t * t))
                  end function
                  
                  public static double code(double eh, double ew, double t) {
                  	return -0.5 * (ew * (t * t));
                  }
                  
                  def code(eh, ew, t):
                  	return -0.5 * (ew * (t * t))
                  
                  function code(eh, ew, t)
                  	return Float64(-0.5 * Float64(ew * Float64(t * t)))
                  end
                  
                  function tmp = code(eh, ew, t)
                  	tmp = -0.5 * (ew * (t * t));
                  end
                  
                  code[eh_, ew_, t_] := N[(-0.5 * N[(ew * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  -0.5 \cdot \left(ew \cdot \left(t \cdot t\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. Applied rewrites37.5%

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

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

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

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

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

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

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

                      \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\color{blue}{\frac{-1}{2} \cdot ew} - \left(-1 \cdot \frac{{eh}^{2}}{ew} + \frac{1}{2} \cdot \frac{{eh}^{2}}{ew}\right)\right) \]
                    7. distribute-rgt-outN/A

                      \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \color{blue}{\frac{{eh}^{2}}{ew} \cdot \left(-1 + \frac{1}{2}\right)}\right) \]
                    8. metadata-evalN/A

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

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

                      \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \color{blue}{\frac{{eh}^{2}}{ew}} \cdot \frac{-1}{2}\right) \]
                    11. unpow2N/A

                      \[\leadsto ew + \left(t \cdot t\right) \cdot \left(\frac{-1}{2} \cdot ew - \frac{\color{blue}{eh \cdot eh}}{ew} \cdot \frac{-1}{2}\right) \]
                    12. lower-*.f6414.8

                      \[\leadsto ew + \left(t \cdot t\right) \cdot \left(-0.5 \cdot ew - \frac{\color{blue}{eh \cdot eh}}{ew} \cdot -0.5\right) \]
                  6. Applied rewrites14.8%

                    \[\leadsto \color{blue}{ew + \left(t \cdot t\right) \cdot \left(-0.5 \cdot ew - \frac{eh \cdot eh}{ew} \cdot -0.5\right)} \]
                  7. Taylor expanded in eh around 0

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

                      \[\leadsto \mathsf{fma}\left(\left(t \cdot t\right) \cdot ew, \color{blue}{-0.5}, ew\right) \]
                    2. Taylor expanded in t around inf

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

                        \[\leadsto -0.5 \cdot \left(ew \cdot \color{blue}{\left(t \cdot t\right)}\right) \]
                      2. Add Preprocessing

                      Reproduce

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