Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 13.5s
Alternatives: 8
Speedup: N/A×

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 8 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

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

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    code = abs((((eh * sin(t)) * sin(atan(((eh * tan(t)) / -ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * cos(t)) * ew)))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs((((eh * Math.sin(t)) * Math.sin(Math.atan(((eh * Math.tan(t)) / -ew)))) - ((Math.cos(Math.atan(((Math.tan(t) / ew) * eh))) * Math.cos(t)) * ew)));
}
def code(eh, ew, t):
	return math.fabs((((eh * math.sin(t)) * math.sin(math.atan(((eh * math.tan(t)) / -ew)))) - ((math.cos(math.atan(((math.tan(t) / ew) * eh))) * math.cos(t)) * ew)))
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(atan(Float64(Float64(tan(t) / ew) * eh))) * cos(t)) * ew)))
end
function tmp = code(eh, ew, t)
	tmp = abs((((eh * sin(t)) * sin(atan(((eh * tan(t)) / -ew)))) - ((cos(atan(((tan(t) / ew) * eh))) * cos(t)) * ew)));
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[N[ArcTan[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Cos[t], $MachinePrecision]), $MachinePrecision] * ew), $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) - \left(\cos \tan^{-1} \left(\frac{\tan t}{ew} \cdot eh\right) \cdot \cos t\right) \cdot ew\right|
\end{array}
Derivation
  1. Initial program 99.7%

    \[\left|\left(ew \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right) - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
  2. Add Preprocessing
  3. 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. 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| \]
    3. associate-*l*N/A

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

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

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

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

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

Alternative 2: 78.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(\frac{eh \cdot \tan t}{-ew}\right)\\ t_2 := \left|\left(eh \cdot \sin t\right) \cdot \sin t\_1 - \left(ew \cdot \cos t\right) \cdot \cos t\_1\right|\\ t_3 := \cos t \cdot ew\\ \mathbf{if}\;t\_2 \leq 10^{-105}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, \frac{\tan t}{ew} \cdot \left(eh \cdot eh\right), t\_3\right)}{1}\right|\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+129}:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \left(\left(-eh\right) \cdot \sin t\right) \cdot \tanh \left(t \cdot \mathsf{fma}\left(-1, \frac{eh}{ew}, 0\right)\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|t\_3\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (/ (* eh (tan t)) (- ew))))
        (t_2
         (fabs (- (* (* eh (sin t)) (sin t_1)) (* (* ew (cos t)) (cos t_1)))))
        (t_3 (* (cos t) ew)))
   (if (<= t_2 1e-105)
     (fabs (/ (fma (sin t) (* (/ (tan t) ew) (* eh eh)) t_3) 1.0))
     (if (<= t_2 5e+129)
       (fabs
        (fma
         (/ ew 1.0)
         (cos t)
         (* (* (- eh) (sin t)) (tanh (* t (fma -1.0 (/ eh ew) 0.0))))))
       (fabs t_3)))))
double code(double eh, double ew, double t) {
	double t_1 = atan(((eh * tan(t)) / -ew));
	double t_2 = fabs((((eh * sin(t)) * sin(t_1)) - ((ew * cos(t)) * cos(t_1))));
	double t_3 = cos(t) * ew;
	double tmp;
	if (t_2 <= 1e-105) {
		tmp = fabs((fma(sin(t), ((tan(t) / ew) * (eh * eh)), t_3) / 1.0));
	} else if (t_2 <= 5e+129) {
		tmp = fabs(fma((ew / 1.0), cos(t), ((-eh * sin(t)) * tanh((t * fma(-1.0, (eh / ew), 0.0))))));
	} else {
		tmp = fabs(t_3);
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = atan(Float64(Float64(eh * tan(t)) / Float64(-ew)))
	t_2 = abs(Float64(Float64(Float64(eh * sin(t)) * sin(t_1)) - Float64(Float64(ew * cos(t)) * cos(t_1))))
	t_3 = Float64(cos(t) * ew)
	tmp = 0.0
	if (t_2 <= 1e-105)
		tmp = abs(Float64(fma(sin(t), Float64(Float64(tan(t) / ew) * Float64(eh * eh)), t_3) / 1.0));
	elseif (t_2 <= 5e+129)
		tmp = abs(fma(Float64(ew / 1.0), cos(t), Float64(Float64(Float64(-eh) * sin(t)) * tanh(Float64(t * fma(-1.0, Float64(eh / ew), 0.0))))));
	else
		tmp = abs(t_3);
	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[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]}, Block[{t$95$3 = N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]}, If[LessEqual[t$95$2, 1e-105], N[Abs[N[(N[(N[Sin[t], $MachinePrecision] * N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * N[(eh * eh), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision] / 1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$2, 5e+129], N[Abs[N[(N[(ew / 1.0), $MachinePrecision] * N[Cos[t], $MachinePrecision] + N[(N[((-eh) * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Tanh[N[(t * N[(-1.0 * N[(eh / ew), $MachinePrecision] + 0.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[t$95$3], $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+129}:\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \left(\left(-eh\right) \cdot \sin t\right) \cdot \tanh \left(t \cdot \mathsf{fma}\left(-1, \frac{eh}{ew}, 0\right)\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;\left|t\_3\right|\\


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

    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 rewrites87.0%

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

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

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

      if 9.99999999999999965e-106 < (fabs.f64 (-.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)))))) < 5.0000000000000003e129

      1. Initial program 99.7%

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

        \[\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 rewrites98.5%

          \[\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. Step-by-step derivation
          1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \left(\left(-eh\right) \cdot \sin t\right) \cdot \tanh \left(t \cdot \mathsf{fma}\left(-1, \color{blue}{\frac{eh}{ew}}, \frac{1}{2} \cdot \left(t \cdot \left(-1 \cdot \frac{{eh}^{2}}{{ew}^{2}} + \frac{{eh}^{2}}{{ew}^{2}}\right)\right)\right)\right)\right)\right| \]
          4. associate-*r*N/A

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

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

            \[\leadsto \left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \left(\left(-eh\right) \cdot \sin t\right) \cdot \tanh \left(t \cdot \mathsf{fma}\left(-1, \frac{eh}{ew}, \color{blue}{\left(\frac{1}{2} \cdot t\right)} \cdot \left(-1 \cdot \frac{{eh}^{2}}{{ew}^{2}} + \frac{{eh}^{2}}{{ew}^{2}}\right)\right)\right)\right)\right| \]
          7. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

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

        if 5.0000000000000003e129 < (fabs.f64 (-.f64 (*.f64 (*.f64 ew (cos.f64 t)) (cos.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew)))) (*.f64 (*.f64 eh (sin.f64 t)) (sin.f64 (atan.f64 (/.f64 (*.f64 (neg.f64 eh) (tan.f64 t)) ew))))))

        1. Initial program 99.7%

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

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

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

            \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
          2. lower-*.f64N/A

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

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

          \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
      7. Recombined 3 regimes into one program.
      8. Final simplification77.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\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| \leq 10^{-105}:\\ \;\;\;\;\left|\frac{\mathsf{fma}\left(\sin t, \frac{\tan t}{ew} \cdot \left(eh \cdot eh\right), \cos t \cdot ew\right)}{1}\right|\\ \mathbf{elif}\;\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| \leq 5 \cdot 10^{+129}:\\ \;\;\;\;\left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \left(\left(-eh\right) \cdot \sin t\right) \cdot \tanh \left(t \cdot \mathsf{fma}\left(-1, \frac{eh}{ew}, 0\right)\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\cos t \cdot ew\right|\\ \end{array} \]
      9. Add Preprocessing

      Alternative 3: 98.5% accurate, 1.6× 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}{1}\right| \end{array} \]
      (FPCore (eh ew t)
       :precision binary64
       (fabs
        (-
         (* (* eh (sin t)) (sin (atan (/ (* eh (tan t)) (- ew)))))
         (/ (* (cos t) ew) 1.0))))
      double code(double eh, double ew, double t) {
      	return fabs((((eh * sin(t)) * sin(atan(((eh * tan(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 * tan(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 * Math.tan(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 * math.tan(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(eh * tan(t)) / Float64(-ew))))) - Float64(Float64(cos(t) * ew) / 1.0)))
      end
      
      function tmp = code(eh, ew, t)
      	tmp = abs((((eh * sin(t)) * sin(atan(((eh * tan(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 * N[Tan[t], $MachinePrecision]), $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{eh \cdot \tan t}{-ew}\right) - \frac{\cos t \cdot ew}{1}\right|
      \end{array}
      
      Derivation
      1. Initial program 99.7%

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

        \[\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 rewrites98.6%

          \[\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. Final simplification98.6%

          \[\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}{1}\right| \]
        3. Add Preprocessing

        Alternative 4: 98.3% accurate, 1.9× speedup?

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

          1. Initial program 99.5%

            \[\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.5%

            \[\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 rewrites97.6%

              \[\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. Step-by-step derivation
              1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \left(\left(-eh\right) \cdot \sin t\right) \cdot \tanh \left(t \cdot \mathsf{fma}\left(-1, \color{blue}{\frac{eh}{ew}}, \frac{1}{2} \cdot \left(t \cdot \left(-1 \cdot \frac{{eh}^{2}}{{ew}^{2}} + \frac{{eh}^{2}}{{ew}^{2}}\right)\right)\right)\right)\right)\right| \]
              4. associate-*r*N/A

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

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

                \[\leadsto \left|\mathsf{fma}\left(\frac{ew}{1}, \cos t, \left(\left(-eh\right) \cdot \sin t\right) \cdot \tanh \left(t \cdot \mathsf{fma}\left(-1, \frac{eh}{ew}, \color{blue}{\left(\frac{1}{2} \cdot t\right)} \cdot \left(-1 \cdot \frac{{eh}^{2}}{{ew}^{2}} + \frac{{eh}^{2}}{{ew}^{2}}\right)\right)\right)\right)\right| \]
              7. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

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

            if -3.8999999999999999e-5 < t < 3.9999999999999998e-7

            1. Initial program 100.0%

              \[\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 rewrites100.0%

              \[\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 t around 0

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

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

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

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

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

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

          Alternative 5: 98.3% 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.7%

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

            \[\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 rewrites98.6%

              \[\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.2

                \[\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.2%

              \[\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.2%

              \[\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: 60.6% accurate, 8.0× speedup?

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

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

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

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

                \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
              2. lower-*.f64N/A

                \[\leadsto \left|\color{blue}{\cos t \cdot ew}\right| \]
              3. lower-cos.f6459.7

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

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

            Alternative 7: 38.0% accurate, 45.4× speedup?

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

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

              \[\leadsto \color{blue}{\left|\frac{\mathsf{fma}\left(\sin t, \frac{\tan t}{ew} \cdot \left(eh \cdot eh\right), \cos t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)}\right|} \]
            4. 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| \]
            5. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 8: 37.9% accurate, 45.4× speedup?

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

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

                  \[\leadsto \color{blue}{\left|\frac{\mathsf{fma}\left(\sin t, \frac{\tan t}{ew} \cdot \left(eh \cdot eh\right), \cos t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot eh\right)}\right|} \]
                4. 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| \]
                5. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Reproduce

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