Example from Robby

Percentage Accurate: 99.8% → 99.8%
Time: 12.7s
Alternatives: 12
Speedup: 1.2×

Specification

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

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \tan^{-1} \left(\frac{\frac{eh}{ew}}{\tan t}\right)\\
\left|\left(ew \cdot \sin t\right) \cdot \cos t\_1 + \left(eh \cdot \cos t\right) \cdot \sin t\_1\right|
\end{array}
\end{array}

Alternative 1: 99.8% accurate, 1.2× speedup?

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

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

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

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

Alternative 2: 98.7% accurate, 1.8× speedup?

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

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

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

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

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

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

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

Alternative 3: 89.9% accurate, 1.9× speedup?

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

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

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

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

    \[\leadsto \left|\mathsf{fma}\left(\frac{\sin t}{\cosh \sinh^{-1} \left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}, ew, \tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot \left(\cos t \cdot eh\right)\right)\right| \]
  4. Step-by-step derivation
    1. lower-*.f6499.2

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

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

    \[\leadsto \left|\mathsf{fma}\left(\frac{\sin t}{\cosh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right)}, ew, \tanh \sinh^{-1} \left(\frac{eh}{\color{blue}{ew \cdot t}}\right) \cdot \left(\cos t \cdot eh\right)\right)\right| \]
  7. Step-by-step derivation
    1. lower-*.f6489.9

      \[\leadsto \left|\mathsf{fma}\left(\frac{\sin t}{\cosh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right)}, ew, \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot \color{blue}{t}}\right) \cdot \left(\cos t \cdot eh\right)\right)\right| \]
  8. Applied rewrites89.9%

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

Alternative 4: 80.6% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
t_2 := \cos t \cdot eh\\
t_3 := \left|t\_2 \cdot \tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right|\\
\mathbf{if}\;eh \leq -1.7 \cdot 10^{-54}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;eh \leq 4.2 \cdot 10^{+72}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(t\_1, t\_2, \sin t \cdot ew\right)}{\cosh \sinh^{-1} t\_1}\right|\\

\mathbf{else}:\\
\;\;\;\;t\_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -1.69999999999999994e-54 or 4.2000000000000003e72 < eh

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999994e-54 < eh < 4.2000000000000003e72

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left|\frac{\mathsf{fma}\left(\frac{eh}{\color{blue}{ew \cdot t}}, \cos t \cdot eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)}\right| \]
    5. Step-by-step derivation
      1. lower-*.f6450.8

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

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

      \[\leadsto \left|\frac{\mathsf{fma}\left(\frac{eh}{ew \cdot t}, \cos t \cdot eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}\right| \]
    8. Step-by-step derivation
      1. lower-*.f6458.0

        \[\leadsto \left|\frac{\mathsf{fma}\left(\frac{eh}{ew \cdot t}, \cos t \cdot eh, \sin t \cdot ew\right)}{\cosh \sinh^{-1} \left(\frac{eh}{ew \cdot \color{blue}{t}}\right)}\right| \]
    9. Applied rewrites58.0%

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

Alternative 5: 77.5% accurate, 2.3× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{eh}{ew \cdot t}\\
t_2 := \frac{\left|\left({t\_1}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} t\_1}\\
\mathbf{if}\;ew \leq -4.2 \cdot 10^{+171}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;ew \leq 3.3 \cdot 10^{+53}:\\
\;\;\;\;\left|\left(\cos t \cdot eh\right) \cdot \tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)\right|\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -4.2000000000000003e171 or 3.3000000000000002e53 < ew

    1. Initial program 99.8%

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

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

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

      \[\leadsto \frac{\left|\left({\left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)} \]
    5. Step-by-step derivation
      1. lower-*.f6447.8

        \[\leadsto \frac{\left|\left({\left(\frac{eh}{ew \cdot \color{blue}{t}}\right)}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)} \]
    6. Applied rewrites47.8%

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

      \[\leadsto \frac{\left|\left({\left(\frac{eh}{ew \cdot t}\right)}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} \left(\frac{eh}{\color{blue}{ew \cdot t}}\right)} \]
    8. Step-by-step derivation
      1. lower-*.f6448.2

        \[\leadsto \frac{\left|\left({\left(\frac{eh}{ew \cdot t}\right)}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} \left(\frac{eh}{ew \cdot \color{blue}{t}}\right)} \]
    9. Applied rewrites48.2%

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

    if -4.2000000000000003e171 < ew < 3.3000000000000002e53

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 62.2% accurate, 2.4× speedup?

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

\\
\begin{array}{l}
t_1 := \left|\tanh \sinh^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{ew}}{t}\right) \cdot eh\right|\\
t_2 := \frac{eh}{ew \cdot t}\\
\mathbf{if}\;eh \leq -1.7 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 8.6 \cdot 10^{+52}:\\
\;\;\;\;\frac{\left|\left({t\_2}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} t\_2}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -1.69999999999999994e-54 or 8.5999999999999999e52 < eh

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      3. lower-/.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      5. lower-pow.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      6. lower-/.f6418.7

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    8. Applied rewrites18.7%

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    9. Taylor expanded in t around 0

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}{t}\right) \cdot eh} \]
    10. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      3. lower-/.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      5. lower-pow.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      6. lower-/.f6420.1

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
    11. Applied rewrites20.1%

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
    12. Applied rewrites42.4%

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

    if -1.69999999999999994e-54 < eh < 8.5999999999999999e52

    1. Initial program 99.8%

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

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

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

      \[\leadsto \frac{\left|\left({\left(\frac{eh}{\color{blue}{ew \cdot t}}\right)}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)} \]
    5. Step-by-step derivation
      1. lower-*.f6447.8

        \[\leadsto \frac{\left|\left({\left(\frac{eh}{ew \cdot \color{blue}{t}}\right)}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right)} \]
    6. Applied rewrites47.8%

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

      \[\leadsto \frac{\left|\left({\left(\frac{eh}{ew \cdot t}\right)}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} \left(\frac{eh}{\color{blue}{ew \cdot t}}\right)} \]
    8. Step-by-step derivation
      1. lower-*.f6448.2

        \[\leadsto \frac{\left|\left({\left(\frac{eh}{ew \cdot t}\right)}^{2} - -1\right) \cdot \left(\sin t \cdot ew\right)\right|}{\cosh \sinh^{-1} \left(\frac{eh}{ew \cdot \color{blue}{t}}\right)} \]
    9. Applied rewrites48.2%

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

Alternative 7: 61.0% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|\sin t \cdot ew\right|\\ \mathbf{if}\;t \leq -1.4 \cdot 10^{-51}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 4.3 \cdot 10^{-45}:\\ \;\;\;\;\left|\tanh \sinh^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{ew}}{t}\right) \cdot eh\right|\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* (sin t) ew))))
   (if (<= t -1.4e-51)
     t_1
     (if (<= t 4.3e-45)
       (fabs
        (*
         (tanh
          (asinh (/ (/ (fma (* (* t t) eh) -0.3333333333333333 eh) ew) t)))
         eh))
       t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((sin(t) * ew));
	double tmp;
	if (t <= -1.4e-51) {
		tmp = t_1;
	} else if (t <= 4.3e-45) {
		tmp = fabs((tanh(asinh(((fma(((t * t) * eh), -0.3333333333333333, eh) / ew) / t))) * eh));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(eh, ew, t)
	t_1 = abs(Float64(sin(t) * ew))
	tmp = 0.0
	if (t <= -1.4e-51)
		tmp = t_1;
	elseif (t <= 4.3e-45)
		tmp = abs(Float64(tanh(asinh(Float64(Float64(fma(Float64(Float64(t * t) * eh), -0.3333333333333333, eh) / ew) / t))) * eh));
	else
		tmp = t_1;
	end
	return tmp
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.4e-51], t$95$1, If[LessEqual[t, 4.3e-45], N[Abs[N[(N[Tanh[N[ArcSinh[N[(N[(N[(N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] * -0.3333333333333333 + eh), $MachinePrecision] / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]], $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;t \leq -1.4 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 4.3 \cdot 10^{-45}:\\
\;\;\;\;\left|\tanh \sinh^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{ew}}{t}\right) \cdot eh\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.4e-51 or 4.2999999999999999e-45 < t

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \left|ew \cdot \sin t\right| \]
    5. Applied rewrites41.3%

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

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

        \[\leadsto \left|\sin t \cdot \color{blue}{ew}\right| \]
      3. lift-*.f6441.3

        \[\leadsto \left|\sin t \cdot \color{blue}{ew}\right| \]
    7. Applied rewrites41.3%

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

    if -1.4e-51 < t < 4.2999999999999999e-45

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      3. lower-/.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      5. lower-pow.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      6. lower-/.f6418.7

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    8. Applied rewrites18.7%

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    9. Taylor expanded in t around 0

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}{t}\right) \cdot eh} \]
    10. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      3. lower-/.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      5. lower-pow.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      6. lower-/.f6420.1

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
    11. Applied rewrites20.1%

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
    12. Applied rewrites42.4%

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

Alternative 8: 46.7% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;eh \leq -1.12 \cdot 10^{+104}:\\ \;\;\;\;\tanh \sinh^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{ew}}{t}\right) \cdot eh\\ \mathbf{elif}\;eh \leq 1.45 \cdot 10^{+86}:\\ \;\;\;\;\left|\sin t \cdot ew\right|\\ \mathbf{else}:\\ \;\;\;\;\tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (if (<= eh -1.12e+104)
   (*
    (tanh (asinh (/ (/ (fma (* (* t t) eh) -0.3333333333333333 eh) ew) t)))
    eh)
   (if (<= eh 1.45e+86)
     (fabs (* (sin t) ew))
     (* (tanh (asinh (/ eh (* ew t)))) eh))))
double code(double eh, double ew, double t) {
	double tmp;
	if (eh <= -1.12e+104) {
		tmp = tanh(asinh(((fma(((t * t) * eh), -0.3333333333333333, eh) / ew) / t))) * eh;
	} else if (eh <= 1.45e+86) {
		tmp = fabs((sin(t) * ew));
	} else {
		tmp = tanh(asinh((eh / (ew * t)))) * eh;
	}
	return tmp;
}
function code(eh, ew, t)
	tmp = 0.0
	if (eh <= -1.12e+104)
		tmp = Float64(tanh(asinh(Float64(Float64(fma(Float64(Float64(t * t) * eh), -0.3333333333333333, eh) / ew) / t))) * eh);
	elseif (eh <= 1.45e+86)
		tmp = abs(Float64(sin(t) * ew));
	else
		tmp = Float64(tanh(asinh(Float64(eh / Float64(ew * t)))) * eh);
	end
	return tmp
end
code[eh_, ew_, t_] := If[LessEqual[eh, -1.12e+104], N[(N[Tanh[N[ArcSinh[N[(N[(N[(N[(N[(t * t), $MachinePrecision] * eh), $MachinePrecision] * -0.3333333333333333 + eh), $MachinePrecision] / ew), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision], If[LessEqual[eh, 1.45e+86], N[Abs[N[(N[Sin[t], $MachinePrecision] * ew), $MachinePrecision]], $MachinePrecision], N[(N[Tanh[N[ArcSinh[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;eh \leq -1.12 \cdot 10^{+104}:\\
\;\;\;\;\tanh \sinh^{-1} \left(\frac{\frac{\mathsf{fma}\left(\left(t \cdot t\right) \cdot eh, -0.3333333333333333, eh\right)}{ew}}{t}\right) \cdot eh\\

\mathbf{elif}\;eh \leq 1.45 \cdot 10^{+86}:\\
\;\;\;\;\left|\sin t \cdot ew\right|\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if eh < -1.12000000000000003e104

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      3. lower-/.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      5. lower-pow.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
      6. lower-/.f6418.7

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    8. Applied rewrites18.7%

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \]
    9. Taylor expanded in t around 0

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\frac{-1}{3} \cdot \frac{eh \cdot {t}^{2}}{ew} + \frac{eh}{ew}}{t}\right) \cdot eh} \]
    10. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      3. lower-/.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      4. lower-*.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      5. lower-pow.f64N/A

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(\frac{-1}{3}, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
      6. lower-/.f6420.1

        \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
    11. Applied rewrites20.1%

      \[\leadsto \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{eh \cdot {t}^{2}}{ew}, \frac{eh}{ew}\right)}{t}\right) \cdot eh} \]
    12. Applied rewrites22.0%

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

    if -1.12000000000000003e104 < eh < 1.44999999999999995e86

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \left|ew \cdot \sin t\right| \]
    5. Applied rewrites41.3%

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

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

        \[\leadsto \left|\sin t \cdot \color{blue}{ew}\right| \]
      3. lift-*.f6441.3

        \[\leadsto \left|\sin t \cdot \color{blue}{ew}\right| \]
    7. Applied rewrites41.3%

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

    if 1.44999999999999995e86 < eh

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh}} \]
    6. Applied rewrites21.7%

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

      \[\leadsto \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh \]
    8. Step-by-step derivation
      1. lower-*.f6420.9

        \[\leadsto \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh \]
    9. Applied rewrites20.9%

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

Alternative 9: 45.9% accurate, 5.5× speedup?

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

\\
\begin{array}{l}
t_1 := \left|\sin t \cdot ew\right|\\
\mathbf{if}\;t \leq -1.2 \cdot 10^{-111}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 7.2 \cdot 10^{-167}:\\
\;\;\;\;\tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.2e-111 or 7.2000000000000002e-167 < t

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \left|ew \cdot \sin t\right| \]
    5. Applied rewrites41.3%

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

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

        \[\leadsto \left|\sin t \cdot \color{blue}{ew}\right| \]
      3. lift-*.f6441.3

        \[\leadsto \left|\sin t \cdot \color{blue}{ew}\right| \]
    7. Applied rewrites41.3%

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

    if -1.2e-111 < t < 7.2000000000000002e-167

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh}} \]
    6. Applied rewrites21.7%

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

      \[\leadsto \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh \]
    8. Step-by-step derivation
      1. lower-*.f6420.9

        \[\leadsto \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh \]
    9. Applied rewrites20.9%

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

Alternative 10: 28.1% accurate, 6.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left|t \cdot \left(ew + -0.16666666666666666 \cdot \left(ew \cdot {t}^{2}\right)\right)\right|\\ \mathbf{if}\;ew \leq -2.9 \cdot 10^{+85}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;ew \leq 6.2 \cdot 10^{+50}:\\ \;\;\;\;\tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (eh ew t)
 :precision binary64
 (let* ((t_1 (fabs (* t (+ ew (* -0.16666666666666666 (* ew (pow t 2.0))))))))
   (if (<= ew -2.9e+85)
     t_1
     (if (<= ew 6.2e+50) (* (tanh (asinh (/ eh (* ew t)))) eh) t_1))))
double code(double eh, double ew, double t) {
	double t_1 = fabs((t * (ew + (-0.16666666666666666 * (ew * pow(t, 2.0))))));
	double tmp;
	if (ew <= -2.9e+85) {
		tmp = t_1;
	} else if (ew <= 6.2e+50) {
		tmp = tanh(asinh((eh / (ew * t)))) * eh;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(eh, ew, t):
	t_1 = math.fabs((t * (ew + (-0.16666666666666666 * (ew * math.pow(t, 2.0))))))
	tmp = 0
	if ew <= -2.9e+85:
		tmp = t_1
	elif ew <= 6.2e+50:
		tmp = math.tanh(math.asinh((eh / (ew * t)))) * eh
	else:
		tmp = t_1
	return tmp
function code(eh, ew, t)
	t_1 = abs(Float64(t * Float64(ew + Float64(-0.16666666666666666 * Float64(ew * (t ^ 2.0))))))
	tmp = 0.0
	if (ew <= -2.9e+85)
		tmp = t_1;
	elseif (ew <= 6.2e+50)
		tmp = Float64(tanh(asinh(Float64(eh / Float64(ew * t)))) * eh);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(eh, ew, t)
	t_1 = abs((t * (ew + (-0.16666666666666666 * (ew * (t ^ 2.0))))));
	tmp = 0.0;
	if (ew <= -2.9e+85)
		tmp = t_1;
	elseif (ew <= 6.2e+50)
		tmp = tanh(asinh((eh / (ew * t)))) * eh;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[eh_, ew_, t_] := Block[{t$95$1 = N[Abs[N[(t * N[(ew + N[(-0.16666666666666666 * N[(ew * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ew, -2.9e+85], t$95$1, If[LessEqual[ew, 6.2e+50], N[(N[Tanh[N[ArcSinh[N[(eh / N[(ew * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * eh), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left|t \cdot \left(ew + -0.16666666666666666 \cdot \left(ew \cdot {t}^{2}\right)\right)\right|\\
\mathbf{if}\;ew \leq -2.9 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;ew \leq 6.2 \cdot 10^{+50}:\\
\;\;\;\;\tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if ew < -2.89999999999999997e85 or 6.20000000000000006e50 < ew

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \left|ew \cdot \sin t\right| \]
    5. Applied rewrites41.3%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Taylor expanded in t around 0

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

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

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

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

        \[\leadsto \left|t \cdot \left(ew + \frac{-1}{6} \cdot \left(ew \cdot {t}^{\color{blue}{2}}\right)\right)\right| \]
      5. lower-pow.f6418.5

        \[\leadsto \left|t \cdot \left(ew + -0.16666666666666666 \cdot \left(ew \cdot {t}^{2}\right)\right)\right| \]
    8. Applied rewrites18.5%

      \[\leadsto \left|t \cdot \color{blue}{\left(ew + -0.16666666666666666 \cdot \left(ew \cdot {t}^{2}\right)\right)}\right| \]

    if -2.89999999999999997e85 < ew < 6.20000000000000006e50

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh}} \]
    6. Applied rewrites21.7%

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

      \[\leadsto \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh \]
    8. Step-by-step derivation
      1. lower-*.f6420.9

        \[\leadsto \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh \]
    9. Applied rewrites20.9%

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

Alternative 11: 26.7% accurate, 7.1× speedup?

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

\\
\begin{array}{l}
t_1 := \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh\\
\mathbf{if}\;eh \leq -2.8 \cdot 10^{-127}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;eh \leq 1.15 \cdot 10^{+86}:\\
\;\;\;\;\left|ew \cdot t\right|\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eh < -2.8e-127 or 1.14999999999999995e86 < eh

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh} \cdot \sqrt{\tanh \sinh^{-1} \left(\frac{eh}{\tan t \cdot ew}\right) \cdot eh}} \]
    6. Applied rewrites21.7%

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

      \[\leadsto \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh \]
    8. Step-by-step derivation
      1. lower-*.f6420.9

        \[\leadsto \tanh \sinh^{-1} \left(\frac{eh}{ew \cdot t}\right) \cdot eh \]
    9. Applied rewrites20.9%

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

    if -2.8e-127 < eh < 1.14999999999999995e86

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \left|ew \cdot \sin t\right| \]
    5. Applied rewrites41.3%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Taylor expanded in t around 0

      \[\leadsto \left|ew \cdot t\right| \]
    7. Step-by-step derivation
      1. Applied rewrites18.8%

        \[\leadsto \left|ew \cdot t\right| \]
    8. Recombined 2 regimes into one program.
    9. Add Preprocessing

    Alternative 12: 18.8% accurate, 47.8× speedup?

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

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

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

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

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

        \[\leadsto \left|ew \cdot \sin t\right| \]
    5. Applied rewrites41.3%

      \[\leadsto \left|\color{blue}{ew \cdot \sin t}\right| \]
    6. Taylor expanded in t around 0

      \[\leadsto \left|ew \cdot t\right| \]
    7. Step-by-step derivation
      1. Applied rewrites18.8%

        \[\leadsto \left|ew \cdot t\right| \]
      2. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025162 
      (FPCore (eh ew t)
        :name "Example from Robby"
        :precision binary64
        (fabs (+ (* (* ew (sin t)) (cos (atan (/ (/ eh ew) (tan t))))) (* (* eh (cos t)) (sin (atan (/ (/ eh ew) (tan t))))))))