Example 2 from Robby

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

Specification

?
\[\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} \]
(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}
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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} 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} \]
(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}
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}

Alternative 1: 99.7% accurate, 1.1× speedup?

\[\left|\frac{1}{\frac{\sqrt{{\left(\frac{\tan t \cdot eh}{ew}\right)}^{2} - -1}}{\cos t \cdot ew}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right| \]
(FPCore (eh ew t)
 :precision binary64
 (fabs
  (-
   (/ 1.0 (/ (sqrt (- (pow (/ (* (tan t) eh) ew) 2.0) -1.0)) (* (cos t) ew)))
   (* (* eh (sin t)) (sin (atan (/ (* (- eh) (tan t)) ew)))))))
double code(double eh, double ew, double t) {
	return fabs(((1.0 / (sqrt((pow(((tan(t) * eh) / ew), 2.0) - -1.0)) / (cos(t) * ew))) - ((eh * sin(t)) * sin(atan(((-eh * tan(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(((1.0d0 / (sqrt(((((tan(t) * eh) / ew) ** 2.0d0) - (-1.0d0))) / (cos(t) * ew))) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew))))))
end function
public static double code(double eh, double ew, double t) {
	return Math.abs(((1.0 / (Math.sqrt((Math.pow(((Math.tan(t) * eh) / ew), 2.0) - -1.0)) / (Math.cos(t) * ew))) - ((eh * Math.sin(t)) * Math.sin(Math.atan(((-eh * Math.tan(t)) / ew))))));
}
def code(eh, ew, t):
	return math.fabs(((1.0 / (math.sqrt((math.pow(((math.tan(t) * eh) / ew), 2.0) - -1.0)) / (math.cos(t) * ew))) - ((eh * math.sin(t)) * math.sin(math.atan(((-eh * math.tan(t)) / ew))))))
function code(eh, ew, t)
	return abs(Float64(Float64(1.0 / Float64(sqrt(Float64((Float64(Float64(tan(t) * eh) / ew) ^ 2.0) - -1.0)) / Float64(cos(t) * ew))) - Float64(Float64(eh * sin(t)) * sin(atan(Float64(Float64(Float64(-eh) * tan(t)) / ew))))))
end
function tmp = code(eh, ew, t)
	tmp = abs(((1.0 / (sqrt(((((tan(t) * eh) / ew) ^ 2.0) - -1.0)) / (cos(t) * ew))) - ((eh * sin(t)) * sin(atan(((-eh * tan(t)) / ew))))));
end
code[eh_, ew_, t_] := N[Abs[N[(N[(1.0 / N[(N[Sqrt[N[(N[Power[N[(N[(N[Tan[t], $MachinePrecision] * eh), $MachinePrecision] / ew), $MachinePrecision], 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision] / N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 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]), $MachinePrecision]], $MachinePrecision]
\left|\frac{1}{\frac{\sqrt{{\left(\frac{\tan t \cdot eh}{ew}\right)}^{2} - -1}}{\cos t \cdot ew}} - \left(eh \cdot \sin t\right) \cdot \sin \tan^{-1} \left(\frac{\left(-eh\right) \cdot \tan t}{ew}\right)\right|
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. 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-cos.f64N/A

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\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. lift-atan.f64N/A

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \cos \color{blue}{\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. cos-atanN/A

      \[\leadsto \left|\left(ew \cdot \cos t\right) \cdot \color{blue}{\frac{1}{\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| \]
    5. mult-flip-revN/A

      \[\leadsto \left|\color{blue}{\frac{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| \]
    6. div-flipN/A

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

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

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

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

Alternative 2: 98.6% accurate, 1.2× speedup?

\[\begin{array}{l} t_1 := \frac{\tan t}{ew}\\ t_2 := -\left|eh\right|\\ \mathbf{if}\;\left|eh\right| \leq 1.35 \cdot 10^{-48}:\\ \;\;\;\;\left|\frac{\left(\tan t \cdot t\_2\right) \cdot \left(\frac{1}{ew} \cdot \left(\left|eh\right| \cdot \sin t\right)\right) - \cos t \cdot ew}{\sqrt{{\left(\frac{\tan t \cdot \left|eh\right|}{ew}\right)}^{2} - -1}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{\cos t}{\sqrt{{\left(t\_1 \cdot \left|eh\right|\right)}^{2} - -1}} \cdot \frac{ew}{\left|eh\right|} - \tanh \sinh^{-1} \left(t\_1 \cdot t\_2\right) \cdot \sin t\right) \cdot \left|eh\right|\right|\\ \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ (tan t) ew)) (t_2 (- (fabs eh))))
   (if (<= (fabs eh) 1.35e-48)
     (fabs
      (/
       (-
        (* (* (tan t) t_2) (* (/ 1.0 ew) (* (fabs eh) (sin t))))
        (* (cos t) ew))
       (sqrt (- (pow (/ (* (tan t) (fabs eh)) ew) 2.0) -1.0))))
     (fabs
      (*
       (-
        (*
         (/ (cos t) (sqrt (- (pow (* t_1 (fabs eh)) 2.0) -1.0)))
         (/ ew (fabs eh)))
        (* (tanh (asinh (* t_1 t_2))) (sin t)))
       (fabs eh))))))
double code(double eh, double ew, double t) {
	double t_1 = tan(t) / ew;
	double t_2 = -fabs(eh);
	double tmp;
	if (fabs(eh) <= 1.35e-48) {
		tmp = fabs(((((tan(t) * t_2) * ((1.0 / ew) * (fabs(eh) * sin(t)))) - (cos(t) * ew)) / sqrt((pow(((tan(t) * fabs(eh)) / ew), 2.0) - -1.0))));
	} else {
		tmp = fabs(((((cos(t) / sqrt((pow((t_1 * fabs(eh)), 2.0) - -1.0))) * (ew / fabs(eh))) - (tanh(asinh((t_1 * t_2))) * sin(t))) * fabs(eh)));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.tan(t) / ew
	t_2 = -math.fabs(eh)
	tmp = 0
	if math.fabs(eh) <= 1.35e-48:
		tmp = math.fabs(((((math.tan(t) * t_2) * ((1.0 / ew) * (math.fabs(eh) * math.sin(t)))) - (math.cos(t) * ew)) / math.sqrt((math.pow(((math.tan(t) * math.fabs(eh)) / ew), 2.0) - -1.0))))
	else:
		tmp = math.fabs(((((math.cos(t) / math.sqrt((math.pow((t_1 * math.fabs(eh)), 2.0) - -1.0))) * (ew / math.fabs(eh))) - (math.tanh(math.asinh((t_1 * t_2))) * math.sin(t))) * math.fabs(eh)))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(tan(t) / ew)
	t_2 = Float64(-abs(eh))
	tmp = 0.0
	if (abs(eh) <= 1.35e-48)
		tmp = abs(Float64(Float64(Float64(Float64(tan(t) * t_2) * Float64(Float64(1.0 / ew) * Float64(abs(eh) * sin(t)))) - Float64(cos(t) * ew)) / sqrt(Float64((Float64(Float64(tan(t) * abs(eh)) / ew) ^ 2.0) - -1.0))));
	else
		tmp = abs(Float64(Float64(Float64(Float64(cos(t) / sqrt(Float64((Float64(t_1 * abs(eh)) ^ 2.0) - -1.0))) * Float64(ew / abs(eh))) - Float64(tanh(asinh(Float64(t_1 * t_2))) * sin(t))) * abs(eh)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = tan(t) / ew;
	t_2 = -abs(eh);
	tmp = 0.0;
	if (abs(eh) <= 1.35e-48)
		tmp = abs(((((tan(t) * t_2) * ((1.0 / ew) * (abs(eh) * sin(t)))) - (cos(t) * ew)) / sqrt(((((tan(t) * abs(eh)) / ew) ^ 2.0) - -1.0))));
	else
		tmp = abs(((((cos(t) / sqrt((((t_1 * abs(eh)) ^ 2.0) - -1.0))) * (ew / abs(eh))) - (tanh(asinh((t_1 * t_2))) * sin(t))) * abs(eh)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = (-N[Abs[eh], $MachinePrecision])}, If[LessEqual[N[Abs[eh], $MachinePrecision], 1.35e-48], N[Abs[N[(N[(N[(N[(N[Tan[t], $MachinePrecision] * t$95$2), $MachinePrecision] * N[(N[(1.0 / ew), $MachinePrecision] * N[(N[Abs[eh], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[N[(N[(N[Tan[t], $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision], 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(N[Cos[t], $MachinePrecision] / N[Sqrt[N[(N[Power[N[(t$95$1 * N[Abs[eh], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(ew / N[Abs[eh], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Tanh[N[ArcSinh[N[(t$95$1 * t$95$2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := -\left|eh\right|\\
\mathbf{if}\;\left|eh\right| \leq 1.35 \cdot 10^{-48}:\\
\;\;\;\;\left|\frac{\left(\tan t \cdot t\_2\right) \cdot \left(\frac{1}{ew} \cdot \left(\left|eh\right| \cdot \sin t\right)\right) - \cos t \cdot ew}{\sqrt{{\left(\frac{\tan t \cdot \left|eh\right|}{ew}\right)}^{2} - -1}}\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\left(\frac{\cos t}{\sqrt{{\left(t\_1 \cdot \left|eh\right|\right)}^{2} - -1}} \cdot \frac{ew}{\left|eh\right|} - \tanh \sinh^{-1} \left(t\_1 \cdot t\_2\right) \cdot \sin t\right) \cdot \left|eh\right|\right|\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 1.3500000000000001e-48

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3500000000000001e-48 < eh

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

Alternative 3: 97.9% accurate, 1.3× speedup?

\[\begin{array}{l} t_1 := -\left|eh\right|\\ \mathbf{if}\;\left|eh\right| \leq 1.35 \cdot 10^{-48}:\\ \;\;\;\;\left|\frac{\left(\tan t \cdot t\_1\right) \cdot \left(\frac{1}{ew} \cdot \left(\left|eh\right| \cdot \sin t\right)\right) - \cos t \cdot ew}{\sqrt{{\left(\frac{\tan t \cdot \left|eh\right|}{ew}\right)}^{2} - -1}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{ew \cdot \cos t}{\left|eh\right|} - \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot t\_1\right) \cdot \sin t\right) \cdot \left|eh\right|\right|\\ \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (- (fabs eh))))
   (if (<= (fabs eh) 1.35e-48)
     (fabs
      (/
       (-
        (* (* (tan t) t_1) (* (/ 1.0 ew) (* (fabs eh) (sin t))))
        (* (cos t) ew))
       (sqrt (- (pow (/ (* (tan t) (fabs eh)) ew) 2.0) -1.0))))
     (fabs
      (*
       (-
        (/ (* ew (cos t)) (fabs eh))
        (* (tanh (asinh (* (/ (tan t) ew) t_1))) (sin t)))
       (fabs eh))))))
double code(double eh, double ew, double t) {
	double t_1 = -fabs(eh);
	double tmp;
	if (fabs(eh) <= 1.35e-48) {
		tmp = fabs(((((tan(t) * t_1) * ((1.0 / ew) * (fabs(eh) * sin(t)))) - (cos(t) * ew)) / sqrt((pow(((tan(t) * fabs(eh)) / ew), 2.0) - -1.0))));
	} else {
		tmp = fabs(((((ew * cos(t)) / fabs(eh)) - (tanh(asinh(((tan(t) / ew) * t_1))) * sin(t))) * fabs(eh)));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = -math.fabs(eh)
	tmp = 0
	if math.fabs(eh) <= 1.35e-48:
		tmp = math.fabs(((((math.tan(t) * t_1) * ((1.0 / ew) * (math.fabs(eh) * math.sin(t)))) - (math.cos(t) * ew)) / math.sqrt((math.pow(((math.tan(t) * math.fabs(eh)) / ew), 2.0) - -1.0))))
	else:
		tmp = math.fabs(((((ew * math.cos(t)) / math.fabs(eh)) - (math.tanh(math.asinh(((math.tan(t) / ew) * t_1))) * math.sin(t))) * math.fabs(eh)))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(-abs(eh))
	tmp = 0.0
	if (abs(eh) <= 1.35e-48)
		tmp = abs(Float64(Float64(Float64(Float64(tan(t) * t_1) * Float64(Float64(1.0 / ew) * Float64(abs(eh) * sin(t)))) - Float64(cos(t) * ew)) / sqrt(Float64((Float64(Float64(tan(t) * abs(eh)) / ew) ^ 2.0) - -1.0))));
	else
		tmp = abs(Float64(Float64(Float64(Float64(ew * cos(t)) / abs(eh)) - Float64(tanh(asinh(Float64(Float64(tan(t) / ew) * t_1))) * sin(t))) * abs(eh)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = -abs(eh);
	tmp = 0.0;
	if (abs(eh) <= 1.35e-48)
		tmp = abs(((((tan(t) * t_1) * ((1.0 / ew) * (abs(eh) * sin(t)))) - (cos(t) * ew)) / sqrt(((((tan(t) * abs(eh)) / ew) ^ 2.0) - -1.0))));
	else
		tmp = abs(((((ew * cos(t)) / abs(eh)) - (tanh(asinh(((tan(t) / ew) * t_1))) * sin(t))) * abs(eh)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = (-N[Abs[eh], $MachinePrecision])}, If[LessEqual[N[Abs[eh], $MachinePrecision], 1.35e-48], N[Abs[N[(N[(N[(N[(N[Tan[t], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[(1.0 / ew), $MachinePrecision] * N[(N[Abs[eh], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[N[(N[(N[Tan[t], $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision], 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Abs[eh], $MachinePrecision]), $MachinePrecision] - N[(N[Tanh[N[ArcSinh[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_1 := -\left|eh\right|\\
\mathbf{if}\;\left|eh\right| \leq 1.35 \cdot 10^{-48}:\\
\;\;\;\;\left|\frac{\left(\tan t \cdot t\_1\right) \cdot \left(\frac{1}{ew} \cdot \left(\left|eh\right| \cdot \sin t\right)\right) - \cos t \cdot ew}{\sqrt{{\left(\frac{\tan t \cdot \left|eh\right|}{ew}\right)}^{2} - -1}}\right|\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 1.3500000000000001e-48

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3500000000000001e-48 < eh

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

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

        \[\leadsto \left|\left(\frac{ew \cdot \cos t}{eh} - \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot \left(-eh\right)\right) \cdot \sin t\right) \cdot eh\right| \]
      3. lower-cos.f6486.5%

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

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

Alternative 4: 97.8% accurate, 1.3× speedup?

\[\begin{array}{l} t_1 := \frac{\tan t}{ew} \cdot \left(-\left|eh\right|\right)\\ \mathbf{if}\;\left|eh\right| \leq 1.35 \cdot 10^{-48}:\\ \;\;\;\;\left|\frac{\left(\sin t \cdot \left|eh\right|\right) \cdot t\_1 - \cos t \cdot ew}{\sqrt{{\left(\frac{\tan t \cdot \left|eh\right|}{ew}\right)}^{2} - -1}}\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{ew \cdot \cos t}{\left|eh\right|} - \tanh \sinh^{-1} t\_1 \cdot \sin t\right) \cdot \left|eh\right|\right|\\ \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* (/ (tan t) ew) (- (fabs eh)))))
   (if (<= (fabs eh) 1.35e-48)
     (fabs
      (/
       (- (* (* (sin t) (fabs eh)) t_1) (* (cos t) ew))
       (sqrt (- (pow (/ (* (tan t) (fabs eh)) ew) 2.0) -1.0))))
     (fabs
      (*
       (- (/ (* ew (cos t)) (fabs eh)) (* (tanh (asinh t_1)) (sin t)))
       (fabs eh))))))
double code(double eh, double ew, double t) {
	double t_1 = (tan(t) / ew) * -fabs(eh);
	double tmp;
	if (fabs(eh) <= 1.35e-48) {
		tmp = fabs(((((sin(t) * fabs(eh)) * t_1) - (cos(t) * ew)) / sqrt((pow(((tan(t) * fabs(eh)) / ew), 2.0) - -1.0))));
	} else {
		tmp = fabs(((((ew * cos(t)) / fabs(eh)) - (tanh(asinh(t_1)) * sin(t))) * fabs(eh)));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = (math.tan(t) / ew) * -math.fabs(eh)
	tmp = 0
	if math.fabs(eh) <= 1.35e-48:
		tmp = math.fabs(((((math.sin(t) * math.fabs(eh)) * t_1) - (math.cos(t) * ew)) / math.sqrt((math.pow(((math.tan(t) * math.fabs(eh)) / ew), 2.0) - -1.0))))
	else:
		tmp = math.fabs(((((ew * math.cos(t)) / math.fabs(eh)) - (math.tanh(math.asinh(t_1)) * math.sin(t))) * math.fabs(eh)))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(Float64(tan(t) / ew) * Float64(-abs(eh)))
	tmp = 0.0
	if (abs(eh) <= 1.35e-48)
		tmp = abs(Float64(Float64(Float64(Float64(sin(t) * abs(eh)) * t_1) - Float64(cos(t) * ew)) / sqrt(Float64((Float64(Float64(tan(t) * abs(eh)) / ew) ^ 2.0) - -1.0))));
	else
		tmp = abs(Float64(Float64(Float64(Float64(ew * cos(t)) / abs(eh)) - Float64(tanh(asinh(t_1)) * sin(t))) * abs(eh)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = (tan(t) / ew) * -abs(eh);
	tmp = 0.0;
	if (abs(eh) <= 1.35e-48)
		tmp = abs(((((sin(t) * abs(eh)) * t_1) - (cos(t) * ew)) / sqrt(((((tan(t) * abs(eh)) / ew) ^ 2.0) - -1.0))));
	else
		tmp = abs(((((ew * cos(t)) / abs(eh)) - (tanh(asinh(t_1)) * sin(t))) * abs(eh)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * (-N[Abs[eh], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[N[Abs[eh], $MachinePrecision], 1.35e-48], N[Abs[N[(N[(N[(N[(N[Sin[t], $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(N[Cos[t], $MachinePrecision] * ew), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[N[(N[(N[Tan[t], $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision] / ew), $MachinePrecision], 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Abs[eh], $MachinePrecision]), $MachinePrecision] - N[(N[Tanh[N[ArcSinh[t$95$1], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{\tan t}{ew} \cdot \left(-\left|eh\right|\right)\\
\mathbf{if}\;\left|eh\right| \leq 1.35 \cdot 10^{-48}:\\
\;\;\;\;\left|\frac{\left(\sin t \cdot \left|eh\right|\right) \cdot t\_1 - \cos t \cdot ew}{\sqrt{{\left(\frac{\tan t \cdot \left|eh\right|}{ew}\right)}^{2} - -1}}\right|\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 1.3500000000000001e-48

    1. Initial program 99.8%

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

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

    if 1.3500000000000001e-48 < eh

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

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

        \[\leadsto \left|\left(\frac{ew \cdot \cos t}{eh} - \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot \left(-eh\right)\right) \cdot \sin t\right) \cdot eh\right| \]
      3. lower-cos.f6486.5%

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

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

Alternative 5: 97.8% accurate, 1.3× speedup?

\[\begin{array}{l} t_1 := \frac{\tan t}{ew}\\ t_2 := t\_1 \cdot \left|eh\right|\\ \mathbf{if}\;\left|eh\right| \leq 1.35 \cdot 10^{-48}:\\ \;\;\;\;\frac{\left|\mathsf{fma}\left(\cos t, ew, t\_2 \cdot \left(\left|eh\right| \cdot \sin t\right)\right)\right|}{\sqrt{{t\_2}^{2} - -1}}\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{ew \cdot \cos t}{\left|eh\right|} - \tanh \sinh^{-1} \left(t\_1 \cdot \left(-\left|eh\right|\right)\right) \cdot \sin t\right) \cdot \left|eh\right|\right|\\ \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (/ (tan t) ew)) (t_2 (* t_1 (fabs eh))))
   (if (<= (fabs eh) 1.35e-48)
     (/
      (fabs (fma (cos t) ew (* t_2 (* (fabs eh) (sin t)))))
      (sqrt (- (pow t_2 2.0) -1.0)))
     (fabs
      (*
       (-
        (/ (* ew (cos t)) (fabs eh))
        (* (tanh (asinh (* t_1 (- (fabs eh))))) (sin t)))
       (fabs eh))))))
double code(double eh, double ew, double t) {
	double t_1 = tan(t) / ew;
	double t_2 = t_1 * fabs(eh);
	double tmp;
	if (fabs(eh) <= 1.35e-48) {
		tmp = fabs(fma(cos(t), ew, (t_2 * (fabs(eh) * sin(t))))) / sqrt((pow(t_2, 2.0) - -1.0));
	} else {
		tmp = fabs(((((ew * cos(t)) / fabs(eh)) - (tanh(asinh((t_1 * -fabs(eh)))) * sin(t))) * fabs(eh)));
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = Float64(tan(t) / ew)
	t_2 = Float64(t_1 * abs(eh))
	tmp = 0.0
	if (abs(eh) <= 1.35e-48)
		tmp = Float64(abs(fma(cos(t), ew, Float64(t_2 * Float64(abs(eh) * sin(t))))) / sqrt(Float64((t_2 ^ 2.0) - -1.0)));
	else
		tmp = abs(Float64(Float64(Float64(Float64(ew * cos(t)) / abs(eh)) - Float64(tanh(asinh(Float64(t_1 * Float64(-abs(eh))))) * sin(t))) * abs(eh)));
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Abs[eh], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[eh], $MachinePrecision], 1.35e-48], N[(N[Abs[N[(N[Cos[t], $MachinePrecision] * ew + N[(t$95$2 * N[(N[Abs[eh], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[Power[t$95$2, 2.0], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(N[(N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision] / N[Abs[eh], $MachinePrecision]), $MachinePrecision] - N[(N[Tanh[N[ArcSinh[N[(t$95$1 * (-N[Abs[eh], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\tan t}{ew}\\
t_2 := t\_1 \cdot \left|eh\right|\\
\mathbf{if}\;\left|eh\right| \leq 1.35 \cdot 10^{-48}:\\
\;\;\;\;\frac{\left|\mathsf{fma}\left(\cos t, ew, t\_2 \cdot \left(\left|eh\right| \cdot \sin t\right)\right)\right|}{\sqrt{{t\_2}^{2} - -1}}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 1.3500000000000001e-48

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

      \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot 0\right) \cdot \left(\sin t \cdot 0\right) - \left(\cos t \cdot 1\right) \cdot \left(\cos t \cdot 1\right)}{\sin t \cdot 0 - \cos t \cdot 1}}\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 rewrites77.1%

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

    if 1.3500000000000001e-48 < eh

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

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

        \[\leadsto \left|\left(\frac{ew \cdot \cos t}{eh} - \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot \left(-eh\right)\right) \cdot \sin t\right) \cdot eh\right| \]
      3. lower-cos.f6486.5%

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

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

Alternative 6: 94.5% accurate, 0.6× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left|t\_3 \cdot \cos t\_2 - t\_1 \cdot \sin t\_2\right|\\


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

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

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

        \[\leadsto \left|\left(\frac{ew \cdot \cos t}{eh} - \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot \left(-eh\right)\right) \cdot \sin t\right) \cdot eh\right| \]
      3. lower-cos.f6486.5%

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

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

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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

Alternative 7: 91.9% accurate, 1.7× speedup?

\[\begin{array}{l} t_1 := ew \cdot \cos t\\ \mathbf{if}\;\left|eh\right| \leq 5.8 \cdot 10^{-105}:\\ \;\;\;\;\left|t\_1\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(\frac{t\_1}{\left|eh\right|} - \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot \left(-\left|eh\right|\right)\right) \cdot \sin t\right) \cdot \left|eh\right|\right|\\ \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (* ew (cos t))))
   (if (<= (fabs eh) 5.8e-105)
     (fabs t_1)
     (fabs
      (*
       (-
        (/ t_1 (fabs eh))
        (* (tanh (asinh (* (/ (tan t) ew) (- (fabs eh))))) (sin t)))
       (fabs eh))))))
double code(double eh, double ew, double t) {
	double t_1 = ew * cos(t);
	double tmp;
	if (fabs(eh) <= 5.8e-105) {
		tmp = fabs(t_1);
	} else {
		tmp = fabs((((t_1 / fabs(eh)) - (tanh(asinh(((tan(t) / ew) * -fabs(eh)))) * sin(t))) * fabs(eh)));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = ew * math.cos(t)
	tmp = 0
	if math.fabs(eh) <= 5.8e-105:
		tmp = math.fabs(t_1)
	else:
		tmp = math.fabs((((t_1 / math.fabs(eh)) - (math.tanh(math.asinh(((math.tan(t) / ew) * -math.fabs(eh)))) * math.sin(t))) * math.fabs(eh)))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(ew * cos(t))
	tmp = 0.0
	if (abs(eh) <= 5.8e-105)
		tmp = abs(t_1);
	else
		tmp = abs(Float64(Float64(Float64(t_1 / abs(eh)) - Float64(tanh(asinh(Float64(Float64(tan(t) / ew) * Float64(-abs(eh))))) * sin(t))) * abs(eh)));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = ew * cos(t);
	tmp = 0.0;
	if (abs(eh) <= 5.8e-105)
		tmp = abs(t_1);
	else
		tmp = abs((((t_1 / abs(eh)) - (tanh(asinh(((tan(t) / ew) * -abs(eh)))) * sin(t))) * abs(eh)));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[eh], $MachinePrecision], 5.8e-105], N[Abs[t$95$1], $MachinePrecision], N[Abs[N[(N[(N[(t$95$1 / N[Abs[eh], $MachinePrecision]), $MachinePrecision] - N[(N[Tanh[N[ArcSinh[N[(N[(N[Tan[t], $MachinePrecision] / ew), $MachinePrecision] * (-N[Abs[eh], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sin[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[eh], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_1 := ew \cdot \cos t\\
\mathbf{if}\;\left|eh\right| \leq 5.8 \cdot 10^{-105}:\\
\;\;\;\;\left|t\_1\right|\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 5.8000000000000001e-105

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

        \[\leadsto \left|ew \cdot \cos t\right| \]
      2. lower-cos.f6461.8%

        \[\leadsto \left|ew \cdot \cos t\right| \]
    10. Applied rewrites61.8%

      \[\leadsto \left|ew \cdot \color{blue}{\cos t}\right| \]

    if 5.8000000000000001e-105 < eh

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

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

        \[\leadsto \left|\left(\frac{ew \cdot \cos t}{eh} - \tanh \sinh^{-1} \left(\frac{\tan t}{ew} \cdot \left(-eh\right)\right) \cdot \sin t\right) \cdot eh\right| \]
      3. lower-cos.f6486.5%

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

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

Alternative 8: 74.6% accurate, 2.5× speedup?

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

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

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: tmp
    if (abs(eh) <= 58000000.0d0) then
        tmp = abs((ew * cos(t)))
    else
        tmp = abs(((-1.0d0) * (abs(eh) * (sin(t) * sin(atan(((-1.0d0) * ((abs(eh) * t) / ew))))))))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if (Math.abs(eh) <= 58000000.0) {
		tmp = Math.abs((ew * Math.cos(t)));
	} else {
		tmp = Math.abs((-1.0 * (Math.abs(eh) * (Math.sin(t) * Math.sin(Math.atan((-1.0 * ((Math.abs(eh) * t) / ew))))))));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if math.fabs(eh) <= 58000000.0:
		tmp = math.fabs((ew * math.cos(t)))
	else:
		tmp = math.fabs((-1.0 * (math.fabs(eh) * (math.sin(t) * math.sin(math.atan((-1.0 * ((math.fabs(eh) * t) / ew))))))))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if (abs(eh) <= 58000000.0)
		tmp = abs(Float64(ew * cos(t)));
	else
		tmp = abs(Float64(-1.0 * Float64(abs(eh) * Float64(sin(t) * sin(atan(Float64(-1.0 * Float64(Float64(abs(eh) * t) / ew))))))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if (abs(eh) <= 58000000.0)
		tmp = abs((ew * cos(t)));
	else
		tmp = abs((-1.0 * (abs(eh) * (sin(t) * sin(atan((-1.0 * ((abs(eh) * t) / ew))))))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[N[Abs[eh], $MachinePrecision], 58000000.0], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(-1.0 * N[(N[Abs[eh], $MachinePrecision] * N[(N[Sin[t], $MachinePrecision] * N[Sin[N[ArcTan[N[(-1.0 * N[(N[(N[Abs[eh], $MachinePrecision] * t), $MachinePrecision] / ew), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|eh\right| \leq 58000000:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 5.8e7

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

        \[\leadsto \left|ew \cdot \cos t\right| \]
      2. lower-cos.f6461.8%

        \[\leadsto \left|ew \cdot \cos t\right| \]
    10. Applied rewrites61.8%

      \[\leadsto \left|ew \cdot \color{blue}{\cos t}\right| \]

    if 5.8e7 < eh

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|-1 \cdot \left(eh \cdot \left(\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot t}{ew}\right)\right)\right)\right| \]
      2. lower-*.f6441.6%

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

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

Alternative 9: 74.6% accurate, 3.5× speedup?

\[\begin{array}{l} t_1 := -\left|eh\right|\\ \mathbf{if}\;\left|eh\right| \leq 58000000:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\left(t\_1 \cdot \sin t\right) \cdot \tanh \sinh^{-1} \left(\frac{t}{ew} \cdot t\_1\right)\right|\\ \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (- (fabs eh))))
   (if (<= (fabs eh) 58000000.0)
     (fabs (* ew (cos t)))
     (fabs (* (* t_1 (sin t)) (tanh (asinh (* (/ t ew) t_1))))))))
double code(double eh, double ew, double t) {
	double t_1 = -fabs(eh);
	double tmp;
	if (fabs(eh) <= 58000000.0) {
		tmp = fabs((ew * cos(t)));
	} else {
		tmp = fabs(((t_1 * sin(t)) * tanh(asinh(((t / ew) * t_1)))));
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = -math.fabs(eh)
	tmp = 0
	if math.fabs(eh) <= 58000000.0:
		tmp = math.fabs((ew * math.cos(t)))
	else:
		tmp = math.fabs(((t_1 * math.sin(t)) * math.tanh(math.asinh(((t / ew) * t_1)))))
	return tmp
function code(eh, ew, t)
	t_1 = Float64(-abs(eh))
	tmp = 0.0
	if (abs(eh) <= 58000000.0)
		tmp = abs(Float64(ew * cos(t)));
	else
		tmp = abs(Float64(Float64(t_1 * sin(t)) * tanh(asinh(Float64(Float64(t / ew) * t_1)))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = -abs(eh);
	tmp = 0.0;
	if (abs(eh) <= 58000000.0)
		tmp = abs((ew * cos(t)));
	else
		tmp = abs(((t_1 * sin(t)) * tanh(asinh(((t / ew) * t_1)))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = (-N[Abs[eh], $MachinePrecision])}, If[LessEqual[N[Abs[eh], $MachinePrecision], 58000000.0], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(t$95$1 * N[Sin[t], $MachinePrecision]), $MachinePrecision] * N[Tanh[N[ArcSinh[N[(N[(t / ew), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_1 := -\left|eh\right|\\
\mathbf{if}\;\left|eh\right| \leq 58000000:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\left(t\_1 \cdot \sin t\right) \cdot \tanh \sinh^{-1} \left(\frac{t}{ew} \cdot t\_1\right)\right|\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 5.8e7

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

        \[\leadsto \left|ew \cdot \cos t\right| \]
      2. lower-cos.f6461.8%

        \[\leadsto \left|ew \cdot \cos t\right| \]
    10. Applied rewrites61.8%

      \[\leadsto \left|ew \cdot \color{blue}{\cos t}\right| \]

    if 5.8e7 < eh

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|-1 \cdot \left(eh \cdot \left(\left(\sin t \cdot \left(\frac{t}{ew} \cdot \left(-eh\right)\right)\right) \cdot \frac{1}{\sqrt{{\left(\frac{\tan t}{ew} \cdot eh\right)}^{2} - -1}}\right)\right)\right| \]
    7. Step-by-step derivation
      1. lower-/.f6410.8%

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

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

      \[\leadsto \left|-1 \cdot \left(eh \cdot \left(\left(\sin t \cdot \left(\frac{t}{ew} \cdot \left(-eh\right)\right)\right) \cdot \frac{1}{\sqrt{{\left(\frac{t}{ew} \cdot eh\right)}^{2} - -1}}\right)\right)\right| \]
    10. Step-by-step derivation
      1. lower-/.f6412.8%

        \[\leadsto \left|-1 \cdot \left(eh \cdot \left(\left(\sin t \cdot \left(\frac{t}{ew} \cdot \left(-eh\right)\right)\right) \cdot \frac{1}{\sqrt{{\left(\frac{t}{ew} \cdot eh\right)}^{2} - -1}}\right)\right)\right| \]
    11. Applied rewrites12.8%

      \[\leadsto \left|-1 \cdot \left(eh \cdot \left(\left(\sin t \cdot \left(\frac{t}{ew} \cdot \left(-eh\right)\right)\right) \cdot \frac{1}{\sqrt{{\left(\frac{t}{ew} \cdot eh\right)}^{2} - -1}}\right)\right)\right| \]
    12. Applied rewrites41.6%

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

Alternative 10: 61.6% accurate, 6.0× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|eh\right| \leq 3.5 \cdot 10^{+180}:\\ \;\;\;\;\left|ew \cdot \cos t\right|\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left|eh\right| \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right|\\ \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= (fabs eh) 3.5e+180)
   (fabs (* ew (cos t)))
   (fabs (/ (* (fabs eh) t) (* ew (sqrt (/ 1.0 (pow ew 2.0))))))))
double code(double eh, double ew, double t) {
	double tmp;
	if (fabs(eh) <= 3.5e+180) {
		tmp = fabs((ew * cos(t)));
	} else {
		tmp = fabs(((fabs(eh) * t) / (ew * sqrt((1.0 / pow(ew, 2.0))))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: tmp
    if (abs(eh) <= 3.5d+180) then
        tmp = abs((ew * cos(t)))
    else
        tmp = abs(((abs(eh) * t) / (ew * sqrt((1.0d0 / (ew ** 2.0d0))))))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if (Math.abs(eh) <= 3.5e+180) {
		tmp = Math.abs((ew * Math.cos(t)));
	} else {
		tmp = Math.abs(((Math.abs(eh) * t) / (ew * Math.sqrt((1.0 / Math.pow(ew, 2.0))))));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if math.fabs(eh) <= 3.5e+180:
		tmp = math.fabs((ew * math.cos(t)))
	else:
		tmp = math.fabs(((math.fabs(eh) * t) / (ew * math.sqrt((1.0 / math.pow(ew, 2.0))))))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if (abs(eh) <= 3.5e+180)
		tmp = abs(Float64(ew * cos(t)));
	else
		tmp = abs(Float64(Float64(abs(eh) * t) / Float64(ew * sqrt(Float64(1.0 / (ew ^ 2.0))))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if (abs(eh) <= 3.5e+180)
		tmp = abs((ew * cos(t)));
	else
		tmp = abs(((abs(eh) * t) / (ew * sqrt((1.0 / (ew ^ 2.0))))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[N[Abs[eh], $MachinePrecision], 3.5e+180], N[Abs[N[(ew * N[Cos[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[Abs[eh], $MachinePrecision] * t), $MachinePrecision] / N[(ew * N[Sqrt[N[(1.0 / N[Power[ew, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|eh\right| \leq 3.5 \cdot 10^{+180}:\\
\;\;\;\;\left|ew \cdot \cos t\right|\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{\left|eh\right| \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right|\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 3.4999999999999998e180

    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. 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. flip-+N/A

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

        \[\leadsto \left|\left(ew \cdot \color{blue}{\frac{\left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin t \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos t \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\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) \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. Applied rewrites99.8%

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

        \[\leadsto \left|eh \cdot \color{blue}{\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| \]
      2. lower--.f64N/A

        \[\leadsto \left|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} - \color{blue}{\sin t \cdot \sin \tan^{-1} \left(-1 \cdot \frac{eh \cdot \sin t}{ew \cdot \cos t}\right)}\right)\right| \]
    6. Applied rewrites87.8%

      \[\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| \]
    7. Applied rewrites87.7%

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

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

        \[\leadsto \left|ew \cdot \cos t\right| \]
      2. lower-cos.f6461.8%

        \[\leadsto \left|ew \cdot \cos t\right| \]
    10. Applied rewrites61.8%

      \[\leadsto \left|ew \cdot \color{blue}{\cos t}\right| \]

    if 3.4999999999999998e180 < eh

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left|\frac{eh \cdot {\sin t}^{2}}{ew \cdot \left(\cos t \cdot \sqrt{\frac{{\sin t}^{2}}{{ew}^{2} \cdot {\cos t}^{2}}}\right)}\right| \]
      4. lower-sin.f64N/A

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

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

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

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

        \[\leadsto \left|\frac{eh \cdot {\sin t}^{2}}{ew \cdot \left(\cos t \cdot \sqrt{\frac{{\sin t}^{2}}{{ew}^{2} \cdot {\cos t}^{2}}}\right)}\right| \]
    6. Applied rewrites20.0%

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

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

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

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

        \[\leadsto \left|\frac{eh \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right| \]
      4. lower-sqrt.f64N/A

        \[\leadsto \left|\frac{eh \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right| \]
      5. lower-/.f64N/A

        \[\leadsto \left|\frac{eh \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right| \]
      6. lower-pow.f6411.6%

        \[\leadsto \left|\frac{eh \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right| \]
    9. Applied rewrites11.6%

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

Alternative 11: 42.8% accurate, 6.4× speedup?

\[\begin{array}{l} \mathbf{if}\;\left|eh\right| \leq 3.5 \cdot 10^{+180}:\\ \;\;\;\;\frac{\left|-ew\right|}{\sqrt{1}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{\left|eh\right| \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right|\\ \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= (fabs eh) 3.5e+180)
   (/ (fabs (- ew)) (sqrt 1.0))
   (fabs (/ (* (fabs eh) t) (* ew (sqrt (/ 1.0 (pow ew 2.0))))))))
double code(double eh, double ew, double t) {
	double tmp;
	if (fabs(eh) <= 3.5e+180) {
		tmp = fabs(-ew) / sqrt(1.0);
	} else {
		tmp = fabs(((fabs(eh) * t) / (ew * sqrt((1.0 / pow(ew, 2.0))))));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(eh, ew, t)
use fmin_fmax_functions
    real(8), intent (in) :: eh
    real(8), intent (in) :: ew
    real(8), intent (in) :: t
    real(8) :: tmp
    if (abs(eh) <= 3.5d+180) then
        tmp = abs(-ew) / sqrt(1.0d0)
    else
        tmp = abs(((abs(eh) * t) / (ew * sqrt((1.0d0 / (ew ** 2.0d0))))))
    end if
    code = tmp
end function
public static double code(double eh, double ew, double t) {
	double tmp;
	if (Math.abs(eh) <= 3.5e+180) {
		tmp = Math.abs(-ew) / Math.sqrt(1.0);
	} else {
		tmp = Math.abs(((Math.abs(eh) * t) / (ew * Math.sqrt((1.0 / Math.pow(ew, 2.0))))));
	}
	return tmp;
}
def code(eh, ew, t):
	tmp = 0
	if math.fabs(eh) <= 3.5e+180:
		tmp = math.fabs(-ew) / math.sqrt(1.0)
	else:
		tmp = math.fabs(((math.fabs(eh) * t) / (ew * math.sqrt((1.0 / math.pow(ew, 2.0))))))
	return tmp
function code(eh, ew, t)
	tmp = 0.0
	if (abs(eh) <= 3.5e+180)
		tmp = Float64(abs(Float64(-ew)) / sqrt(1.0));
	else
		tmp = abs(Float64(Float64(abs(eh) * t) / Float64(ew * sqrt(Float64(1.0 / (ew ^ 2.0))))));
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	tmp = 0.0;
	if (abs(eh) <= 3.5e+180)
		tmp = abs(-ew) / sqrt(1.0);
	else
		tmp = abs(((abs(eh) * t) / (ew * sqrt((1.0 / (ew ^ 2.0))))));
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := If[LessEqual[N[Abs[eh], $MachinePrecision], 3.5e+180], N[(N[Abs[(-ew)], $MachinePrecision] / N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(N[Abs[eh], $MachinePrecision] * t), $MachinePrecision] / N[(ew * N[Sqrt[N[(1.0 / N[Power[ew, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|eh\right| \leq 3.5 \cdot 10^{+180}:\\
\;\;\;\;\frac{\left|-ew\right|}{\sqrt{1}}\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{\left|eh\right| \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right|\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < 3.4999999999999998e180

    1. Initial program 99.8%

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

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

      \[\leadsto \left|\frac{\color{blue}{-1 \cdot ew}}{\sqrt{{\left(\frac{\tan t \cdot eh}{ew}\right)}^{2} - -1}}\right| \]
    4. Step-by-step derivation
      1. lower-*.f6441.8%

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

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

      \[\leadsto \left|\frac{-1 \cdot ew}{\sqrt{\color{blue}{1}}}\right| \]
    7. Step-by-step derivation
      1. Applied rewrites42.2%

        \[\leadsto \left|\frac{-1 \cdot ew}{\sqrt{\color{blue}{1}}}\right| \]
      2. Step-by-step derivation
        1. lift-fabs.f64N/A

          \[\leadsto \color{blue}{\left|\frac{-1 \cdot ew}{\sqrt{1}}\right|} \]
        2. lift-/.f64N/A

          \[\leadsto \left|\color{blue}{\frac{-1 \cdot ew}{\sqrt{1}}}\right| \]
        3. fabs-divN/A

          \[\leadsto \color{blue}{\frac{\left|-1 \cdot ew\right|}{\left|\sqrt{1}\right|}} \]
        4. lift-sqrt.f64N/A

          \[\leadsto \frac{\left|-1 \cdot ew\right|}{\left|\color{blue}{\sqrt{1}}\right|} \]
        5. sqrt-fabs-revN/A

          \[\leadsto \frac{\left|-1 \cdot ew\right|}{\color{blue}{\sqrt{1}}} \]
        6. lift-sqrt.f64N/A

          \[\leadsto \frac{\left|-1 \cdot ew\right|}{\color{blue}{\sqrt{1}}} \]
        7. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left|-1 \cdot ew\right|}{\sqrt{1}}} \]
      3. Applied rewrites42.2%

        \[\leadsto \color{blue}{\frac{\left|-ew\right|}{\sqrt{1}}} \]

      if 3.4999999999999998e180 < eh

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left|\frac{eh \cdot {\sin t}^{2}}{ew \cdot \left(\cos t \cdot \sqrt{\frac{{\sin t}^{2}}{{ew}^{2} \cdot {\cos t}^{2}}}\right)}\right| \]
        4. lower-sin.f64N/A

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

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

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

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

          \[\leadsto \left|\frac{eh \cdot {\sin t}^{2}}{ew \cdot \left(\cos t \cdot \sqrt{\frac{{\sin t}^{2}}{{ew}^{2} \cdot {\cos t}^{2}}}\right)}\right| \]
      6. Applied rewrites20.0%

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

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

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

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

          \[\leadsto \left|\frac{eh \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right| \]
        4. lower-sqrt.f64N/A

          \[\leadsto \left|\frac{eh \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right| \]
        5. lower-/.f64N/A

          \[\leadsto \left|\frac{eh \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right| \]
        6. lower-pow.f6411.6%

          \[\leadsto \left|\frac{eh \cdot t}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}\right| \]
      9. Applied rewrites11.6%

        \[\leadsto \left|\frac{eh \cdot t}{\color{blue}{ew \cdot \sqrt{\frac{1}{{ew}^{2}}}}}\right| \]
    8. Recombined 2 regimes into one program.
    9. Add Preprocessing

    Alternative 12: 42.2% accurate, 29.4× speedup?

    \[\frac{\left|-ew\right|}{\sqrt{1}} \]
    (FPCore (eh ew t) :precision binary64 (/ (fabs (- ew)) (sqrt 1.0)))
    double code(double eh, double ew, double t) {
    	return fabs(-ew) / sqrt(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(-ew) / sqrt(1.0d0)
    end function
    
    public static double code(double eh, double ew, double t) {
    	return Math.abs(-ew) / Math.sqrt(1.0);
    }
    
    def code(eh, ew, t):
    	return math.fabs(-ew) / math.sqrt(1.0)
    
    function code(eh, ew, t)
    	return Float64(abs(Float64(-ew)) / sqrt(1.0))
    end
    
    function tmp = code(eh, ew, t)
    	tmp = abs(-ew) / sqrt(1.0);
    end
    
    code[eh_, ew_, t_] := N[(N[Abs[(-ew)], $MachinePrecision] / N[Sqrt[1.0], $MachinePrecision]), $MachinePrecision]
    
    \frac{\left|-ew\right|}{\sqrt{1}}
    
    Derivation
    1. Initial program 99.8%

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

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

      \[\leadsto \left|\frac{\color{blue}{-1 \cdot ew}}{\sqrt{{\left(\frac{\tan t \cdot eh}{ew}\right)}^{2} - -1}}\right| \]
    4. Step-by-step derivation
      1. lower-*.f6441.8%

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

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

      \[\leadsto \left|\frac{-1 \cdot ew}{\sqrt{\color{blue}{1}}}\right| \]
    7. Step-by-step derivation
      1. Applied rewrites42.2%

        \[\leadsto \left|\frac{-1 \cdot ew}{\sqrt{\color{blue}{1}}}\right| \]
      2. Step-by-step derivation
        1. lift-fabs.f64N/A

          \[\leadsto \color{blue}{\left|\frac{-1 \cdot ew}{\sqrt{1}}\right|} \]
        2. lift-/.f64N/A

          \[\leadsto \left|\color{blue}{\frac{-1 \cdot ew}{\sqrt{1}}}\right| \]
        3. fabs-divN/A

          \[\leadsto \color{blue}{\frac{\left|-1 \cdot ew\right|}{\left|\sqrt{1}\right|}} \]
        4. lift-sqrt.f64N/A

          \[\leadsto \frac{\left|-1 \cdot ew\right|}{\left|\color{blue}{\sqrt{1}}\right|} \]
        5. sqrt-fabs-revN/A

          \[\leadsto \frac{\left|-1 \cdot ew\right|}{\color{blue}{\sqrt{1}}} \]
        6. lift-sqrt.f64N/A

          \[\leadsto \frac{\left|-1 \cdot ew\right|}{\color{blue}{\sqrt{1}}} \]
        7. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\left|-1 \cdot ew\right|}{\sqrt{1}}} \]
      3. Applied rewrites42.2%

        \[\leadsto \color{blue}{\frac{\left|-ew\right|}{\sqrt{1}}} \]
      4. Add Preprocessing

      Reproduce

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