Example 2 from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 34.6s
Alternatives: 6
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 6 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, N/A× speedup?

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

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

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = atan(((-1.0d0) * ((eh * tan(t)) / ew)))
    code = abs(((((-1.0d0) * (eh * sin(t))) * sin(t_1)) - (((-1.0d0) * (ew * cos(t))) * cos(t_1))))
end function
public static double code(double eh, double ew, double t) {
	double t_1 = Math.atan((-1.0 * ((eh * Math.tan(t)) / ew)));
	return Math.abs((((-1.0 * (eh * Math.sin(t))) * Math.sin(t_1)) - ((-1.0 * (ew * Math.cos(t))) * Math.cos(t_1))));
}
def code(eh, ew, t):
	t_1 = math.atan((-1.0 * ((eh * math.tan(t)) / ew)))
	return math.fabs((((-1.0 * (eh * math.sin(t))) * math.sin(t_1)) - ((-1.0 * (ew * math.cos(t))) * math.cos(t_1))))
function code(eh, ew, t)
	t_1 = atan(Float64(-1.0 * Float64(Float64(eh * tan(t)) / ew)))
	return abs(Float64(Float64(Float64(-1.0 * Float64(eh * sin(t))) * sin(t_1)) - Float64(Float64(-1.0 * Float64(ew * cos(t))) * cos(t_1))))
end
function tmp = code(eh, ew, t)
	t_1 = atan((-1.0 * ((eh * tan(t)) / ew)));
	tmp = abs((((-1.0 * (eh * sin(t))) * sin(t_1)) - ((-1.0 * (ew * cos(t))) * cos(t_1))));
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(-1.0 * N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(-1.0 * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 * N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

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

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

Alternative 2: 99.7% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_1 := \sin t \cdot eh\\
t_2 := \frac{-1}{\cos t} \cdot \frac{t\_1}{ew}\\
t_3 := \tanh \sinh^{-1} t\_2\\
t_4 := \cos \tan^{-1} t\_2\\
\mathbf{if}\;ew \leq -4 \cdot 10^{+24} \lor \neg \left(ew \leq 5 \cdot 10^{-30}\right):\\
\;\;\;\;\left|\mathsf{fma}\left(\frac{t\_1 \cdot t\_3}{ew}, -1, t\_4 \cdot \cos t\right) \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -3.9999999999999999e24 or 4.99999999999999972e-30 < ew

    1. Initial program 99.8%

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

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

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

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

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

    if -3.9999999999999999e24 < ew < 4.99999999999999972e-30

    1. Initial program 99.8%

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

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

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

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

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

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

Alternative 3: 99.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \tan^{-1} \left(-1 \cdot \frac{eh \cdot \tan t}{ew}\right)\\ \left|\left(-1 \cdot \left(eh \cdot \sin t\right)\right) \cdot \sin t\_1 + \left(\left(--1 \cdot ew\right) \cdot \mathsf{fma}\left(\cos t, \sin \left(0.5 \cdot \pi\right), \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot \sin t\right)\right) \cdot \cos t\_1\right| \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (atan (* -1.0 (/ (* eh (tan t)) ew)))))
   (fabs
    (+
     (* (* -1.0 (* eh (sin t))) (sin t_1))
     (*
      (*
       (- (* -1.0 ew))
       (fma
        (cos t)
        (sin (* 0.5 PI))
        (* (sin (fma 0.5 PI (/ PI 2.0))) (sin t))))
      (cos t_1))))))
double code(double eh, double ew, double t) {
	double t_1 = atan((-1.0 * ((eh * tan(t)) / ew)));
	return fabs((((-1.0 * (eh * sin(t))) * sin(t_1)) + ((-(-1.0 * ew) * fma(cos(t), sin((0.5 * ((double) M_PI))), (sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0))) * sin(t)))) * cos(t_1))));
}
function code(eh, ew, t)
	t_1 = atan(Float64(-1.0 * Float64(Float64(eh * tan(t)) / ew)))
	return abs(Float64(Float64(Float64(-1.0 * Float64(eh * sin(t))) * sin(t_1)) + Float64(Float64(Float64(-Float64(-1.0 * ew)) * fma(cos(t), sin(Float64(0.5 * pi)), Float64(sin(fma(0.5, pi, Float64(pi / 2.0))) * sin(t)))) * cos(t_1))))
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[ArcTan[N[(-1.0 * N[(N[(eh * N[Tan[t], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[Abs[N[(N[(N[(-1.0 * N[(eh * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision] + N[(N[((-N[(-1.0 * ew), $MachinePrecision]) * N[(N[Cos[t], $MachinePrecision] * N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

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

      \[\leadsto \left|\left(ew \cdot \color{blue}{\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. sin-+PI/2-revN/A

      \[\leadsto \left|\left(ew \cdot \color{blue}{\sin \left(t + \frac{\mathsf{PI}\left(\right)}{2}\right)}\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. sin-sumN/A

      \[\leadsto \left|\left(ew \cdot \color{blue}{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) + \cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}\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| \]
    4. lower-fma.f64N/A

      \[\leadsto \left|\left(ew \cdot \color{blue}{\mathsf{fma}\left(\sin t, \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right), \cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}\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| \]
    5. lift-sin.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\color{blue}{\sin t}, \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right), \cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\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| \]
    6. lower-cos.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\sin t, \color{blue}{\cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}, \cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\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| \]
    7. lower-/.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\sin t, \cos \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}, \cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\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| \]
    8. lower-PI.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\sin t, \cos \left(\frac{\color{blue}{\pi}}{2}\right), \cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\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| \]
    9. lower-*.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\sin t, \cos \left(\frac{\pi}{2}\right), \color{blue}{\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}\right)\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| \]
    10. lift-cos.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\sin t, \cos \left(\frac{\pi}{2}\right), \color{blue}{\cos t} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\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| \]
    11. lower-sin.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\sin t, \cos \left(\frac{\pi}{2}\right), \cos t \cdot \color{blue}{\sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}\right)\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| \]
    12. lower-/.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\sin t, \cos \left(\frac{\pi}{2}\right), \cos t \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}\right)\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| \]
    13. lower-PI.f6499.6

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\sin t, \cos \left(\frac{\pi}{2}\right), \cos t \cdot \sin \left(\frac{\color{blue}{\pi}}{2}\right)\right)\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| \]
  4. Applied rewrites99.6%

    \[\leadsto \left|\left(ew \cdot \color{blue}{\mathsf{fma}\left(\sin t, \cos \left(\frac{\pi}{2}\right), \cos t \cdot \sin \left(\frac{\pi}{2}\right)\right)}\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| \]
  5. Taylor expanded in t around inf

    \[\leadsto \left|\left(ew \cdot \color{blue}{\left(\cos t \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) + \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin t\right)}\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| \]
  6. Step-by-step derivation
    1. lower-fma.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \color{blue}{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}, \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin t\right)\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-cos.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \color{blue}{\left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}, \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin t\right)\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. lower-sin.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right), \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin t\right)\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| \]
    4. lower-*.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right), \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin t\right)\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| \]
    5. lift-PI.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \pi\right), \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin t\right)\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| \]
    6. lower-*.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \pi\right), \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin t\right)\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| \]
    7. sin-+PI/2-revN/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \pi\right), \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \sin t\right)\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| \]
    8. lower-sin.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \pi\right), \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \sin t\right)\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| \]
    9. lift-/.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \pi\right), \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \sin t\right)\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| \]
    10. lift-PI.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \pi\right), \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + \frac{\pi}{2}\right) \cdot \sin t\right)\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| \]
    11. lower-fma.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \pi\right), \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), \frac{\pi}{2}\right)\right) \cdot \sin t\right)\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| \]
    12. lift-PI.f64N/A

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(\frac{1}{2} \cdot \pi\right), \sin \left(\mathsf{fma}\left(\frac{1}{2}, \pi, \frac{\pi}{2}\right)\right) \cdot \sin t\right)\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| \]
    13. lift-sin.f6499.5

      \[\leadsto \left|\left(ew \cdot \mathsf{fma}\left(\cos t, \sin \left(0.5 \cdot \pi\right), \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot \sin t\right)\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| \]
  7. Applied rewrites99.5%

    \[\leadsto \left|\left(ew \cdot \color{blue}{\mathsf{fma}\left(\cos t, \sin \left(0.5 \cdot \pi\right), \sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot \sin t\right)}\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| \]
  8. Final simplification99.5%

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

Alternative 4: 87.7% accurate, N/A× speedup?

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

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

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

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

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

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

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

Alternative 5: 46.9% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(-1 \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\left(-1 \cdot \frac{eh}{ew}\right) \cdot \tan t\right)\\ t_2 := e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-1 \cdot eh}\right)}^{-1}\right)}\\ t_3 := {t\_2}^{-1}\\ \mathbf{if}\;ew \leq -3.5 \cdot 10^{-116} \lor \neg \left(ew \leq 2.05 \cdot 10^{-177}\right):\\ \;\;\;\;\left|\left(ew \cdot \mathsf{fma}\left(\frac{eh}{ew \cdot ew}, \frac{{\sin t}^{2}}{\cos t}, \frac{t\_1}{-1 \cdot eh}\right)\right) \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(-1 \cdot eh\right) \cdot \left(\frac{t\_1}{eh} + \frac{\sin t}{ew} \cdot \frac{t\_2 - t\_3}{t\_2 + t\_3}\right)\right) \cdot ew\right|\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* (* -1.0 (cos t)) (cos (atan (* (* -1.0 (/ eh ew)) (tan t))))))
        (t_2
         (*
          (exp (+ (log 2.0) (log (/ (sin t) (* ew (cos t))))))
          (exp (log (pow (/ 1.0 (* -1.0 eh)) -1.0)))))
        (t_3 (pow t_2 -1.0)))
   (if (or (<= ew -3.5e-116) (not (<= ew 2.05e-177)))
     (fabs
      (*
       (*
        ew
        (fma
         (/ eh (* ew ew))
         (/ (pow (sin t) 2.0) (cos t))
         (/ t_1 (* -1.0 eh))))
       eh))
     (fabs
      (*
       (*
        (* -1.0 eh)
        (+ (/ t_1 eh) (* (/ (sin t) ew) (/ (- t_2 t_3) (+ t_2 t_3)))))
       ew)))))
double code(double eh, double ew, double t) {
	double t_1 = (-1.0 * cos(t)) * cos(atan(((-1.0 * (eh / ew)) * tan(t))));
	double t_2 = exp((log(2.0) + log((sin(t) / (ew * cos(t)))))) * exp(log(pow((1.0 / (-1.0 * eh)), -1.0)));
	double t_3 = pow(t_2, -1.0);
	double tmp;
	if ((ew <= -3.5e-116) || !(ew <= 2.05e-177)) {
		tmp = fabs(((ew * fma((eh / (ew * ew)), (pow(sin(t), 2.0) / cos(t)), (t_1 / (-1.0 * eh)))) * eh));
	} else {
		tmp = fabs((((-1.0 * eh) * ((t_1 / eh) + ((sin(t) / ew) * ((t_2 - t_3) / (t_2 + t_3))))) * ew));
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = Float64(Float64(-1.0 * cos(t)) * cos(atan(Float64(Float64(-1.0 * Float64(eh / ew)) * tan(t)))))
	t_2 = Float64(exp(Float64(log(2.0) + log(Float64(sin(t) / Float64(ew * cos(t)))))) * exp(log((Float64(1.0 / Float64(-1.0 * eh)) ^ -1.0))))
	t_3 = t_2 ^ -1.0
	tmp = 0.0
	if ((ew <= -3.5e-116) || !(ew <= 2.05e-177))
		tmp = abs(Float64(Float64(ew * fma(Float64(eh / Float64(ew * ew)), Float64((sin(t) ^ 2.0) / cos(t)), Float64(t_1 / Float64(-1.0 * eh)))) * eh));
	else
		tmp = abs(Float64(Float64(Float64(-1.0 * eh) * Float64(Float64(t_1 / eh) + Float64(Float64(sin(t) / ew) * Float64(Float64(t_2 - t_3) / Float64(t_2 + t_3))))) * ew));
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(-1.0 * N[Cos[t], $MachinePrecision]), $MachinePrecision] * N[Cos[N[ArcTan[N[(N[(-1.0 * N[(eh / ew), $MachinePrecision]), $MachinePrecision] * N[Tan[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[N[(N[Log[2.0], $MachinePrecision] + N[Log[N[(N[Sin[t], $MachinePrecision] / N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[Log[N[Power[N[(1.0 / N[(-1.0 * eh), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$2, -1.0], $MachinePrecision]}, If[Or[LessEqual[ew, -3.5e-116], N[Not[LessEqual[ew, 2.05e-177]], $MachinePrecision]], N[Abs[N[(N[(ew * N[(N[(eh / N[(ew * ew), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Sin[t], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[t], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(-1.0 * eh), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(-1.0 * eh), $MachinePrecision] * N[(N[(t$95$1 / eh), $MachinePrecision] + N[(N[(N[Sin[t], $MachinePrecision] / ew), $MachinePrecision] * N[(N[(t$95$2 - t$95$3), $MachinePrecision] / N[(t$95$2 + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(-1 \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\left(-1 \cdot \frac{eh}{ew}\right) \cdot \tan t\right)\\
t_2 := e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-1 \cdot eh}\right)}^{-1}\right)}\\
t_3 := {t\_2}^{-1}\\
\mathbf{if}\;ew \leq -3.5 \cdot 10^{-116} \lor \neg \left(ew \leq 2.05 \cdot 10^{-177}\right):\\
\;\;\;\;\left|\left(ew \cdot \mathsf{fma}\left(\frac{eh}{ew \cdot ew}, \frac{{\sin t}^{2}}{\cos t}, \frac{t\_1}{-1 \cdot eh}\right)\right) \cdot eh\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\left(\left(-1 \cdot eh\right) \cdot \left(\frac{t\_1}{eh} + \frac{\sin t}{ew} \cdot \frac{t\_2 - t\_3}{t\_2 + t\_3}\right)\right) \cdot ew\right|\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -3.49999999999999984e-116 or 2.05e-177 < ew

    1. Initial program 99.8%

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

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

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

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

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

      \[\leadsto \left|\left(ew \cdot \left(\frac{eh \cdot {\sin t}^{2}}{{ew}^{2} \cdot \cos t} + \frac{\cos t \cdot \cos \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}{eh}\right)\right) \cdot eh\right| \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left|\left(ew \cdot \left(\frac{eh \cdot {\sin t}^{2}}{{ew}^{2} \cdot \cos t} + \frac{\cos t \cdot \cos \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}{eh}\right)\right) \cdot eh\right| \]
      2. times-fracN/A

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

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

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

    if -3.49999999999999984e-116 < ew < 2.05e-177

    1. Initial program 99.7%

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

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

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

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

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

      \[\leadsto \left|\left(-1 \cdot \left(eh \cdot \left(-1 \cdot \frac{\cos t \cdot \cos \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}{eh} + \frac{\sin t \cdot \left(e^{\log \left(2 \cdot \frac{\sin t}{ew \cdot \cos t}\right) + -1 \cdot \log \left(\frac{-1}{eh}\right)} - \frac{1}{e^{\log \left(2 \cdot \frac{\sin t}{ew \cdot \cos t}\right) + -1 \cdot \log \left(\frac{-1}{eh}\right)}}\right)}{ew \cdot \left(e^{\log \left(2 \cdot \frac{\sin t}{ew \cdot \cos t}\right) + -1 \cdot \log \left(\frac{-1}{eh}\right)} + \frac{1}{e^{\log \left(2 \cdot \frac{\sin t}{ew \cdot \cos t}\right) + -1 \cdot \log \left(\frac{-1}{eh}\right)}}\right)}\right)\right)\right) \cdot ew\right| \]
    7. Applied rewrites24.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;ew \leq -3.5 \cdot 10^{-116} \lor \neg \left(ew \leq 2.05 \cdot 10^{-177}\right):\\ \;\;\;\;\left|\left(ew \cdot \mathsf{fma}\left(\frac{eh}{ew \cdot ew}, \frac{{\sin t}^{2}}{\cos t}, \frac{\left(-1 \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\left(-1 \cdot \frac{eh}{ew}\right) \cdot \tan t\right)}{-1 \cdot eh}\right)\right) \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\left(-1 \cdot eh\right) \cdot \left(\frac{\left(-1 \cdot \cos t\right) \cdot \cos \tan^{-1} \left(\left(-1 \cdot \frac{eh}{ew}\right) \cdot \tan t\right)}{eh} + \frac{\sin t}{ew} \cdot \frac{e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-1 \cdot eh}\right)}^{-1}\right)} - {\left(e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-1 \cdot eh}\right)}^{-1}\right)}\right)}^{-1}}{e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-1 \cdot eh}\right)}^{-1}\right)} + {\left(e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-1 \cdot eh}\right)}^{-1}\right)}\right)}^{-1}}\right)\right) \cdot ew\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 15.9% accurate, N/A× speedup?

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

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

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

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

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

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

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

    \[\leadsto \left|\left(-1 \cdot \left(eh \cdot \left(-1 \cdot \frac{\cos t \cdot \cos \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}{eh} + \frac{\sin t \cdot \left(e^{\log \left(2 \cdot \frac{\sin t}{ew \cdot \cos t}\right) + -1 \cdot \log \left(\frac{-1}{eh}\right)} - \frac{1}{e^{\log \left(2 \cdot \frac{\sin t}{ew \cdot \cos t}\right) + -1 \cdot \log \left(\frac{-1}{eh}\right)}}\right)}{ew \cdot \left(e^{\log \left(2 \cdot \frac{\sin t}{ew \cdot \cos t}\right) + -1 \cdot \log \left(\frac{-1}{eh}\right)} + \frac{1}{e^{\log \left(2 \cdot \frac{\sin t}{ew \cdot \cos t}\right) + -1 \cdot \log \left(\frac{-1}{eh}\right)}}\right)}\right)\right)\right) \cdot ew\right| \]
  7. Applied rewrites14.1%

    \[\leadsto \left|\left(-1 \cdot \left(eh \cdot \left(-1 \cdot \frac{\cos t \cdot \cos \tan^{-1} \left(-1 \cdot \left(\frac{eh}{ew} \cdot \tan t\right)\right)}{eh} + \frac{\sin t}{ew} \cdot \frac{e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-eh}\right)}^{-1}\right)} - {\left(e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-eh}\right)}^{-1}\right)}\right)}^{-1}}{e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-eh}\right)}^{-1}\right)} + {\left(e^{\log 2 + \log \left(\frac{\sin t}{ew \cdot \cos t}\right)} \cdot e^{\log \left({\left(\frac{1}{-eh}\right)}^{-1}\right)}\right)}^{-1}}\right)\right)\right) \cdot ew\right| \]
  8. Final simplification14.1%

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

Reproduce

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