Toniolo and Linder, Equation (7)

Percentage Accurate: 33.3% → 83.6%
Time: 8.4s
Alternatives: 8
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ \frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \end{array} \]
(FPCore (x l t)
 :precision binary64
 (/
  (* (sqrt 2.0) t)
  (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
double code(double x, double l, double t) {
	return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
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(x, l, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
	return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t):
	return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
function code(x, l, t)
	return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l))))
end
function tmp = code(x, l, t)
	tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 33.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \end{array} \]
(FPCore (x l t)
 :precision binary64
 (/
  (* (sqrt 2.0) t)
  (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
double code(double x, double l, double t) {
	return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
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(x, l, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
	return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t):
	return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
function code(x, l, t)
	return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l))))
end
function tmp = code(x, l, t)
	tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\end{array}

Alternative 1: 83.6% accurate, N/A× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ \begin{array}{l} t_2 := {\left({2}^{0.5} \cdot t\_m\right)}^{1}\\ t_3 := \mathsf{fma}\left(t\_m \cdot t\_m, 2, l\_m \cdot l\_m\right)\\ t_4 := \sqrt{2} \cdot t\_m\\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;\frac{t\_4}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot l\_m}\\ \mathbf{elif}\;t\_m \leq 6 \cdot 10^{-168}:\\ \;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\ \mathbf{elif}\;t\_m \leq 1.32 \cdot 10^{-11}:\\ \;\;\;\;\frac{t\_4}{\sqrt{\left(\mathsf{fma}\left(\frac{t\_m \cdot t\_m}{x}, 2, \frac{\left(t\_m \cdot t\_m\right) \cdot 2}{x \cdot x}\right) + \mathsf{fma}\left(t\_2, t\_2, \frac{l\_m \cdot l\_m}{x \cdot x} + \frac{l\_m \cdot l\_m}{x}\right)\right) - \mathsf{fma}\left(\frac{t\_3}{x}, -1, \frac{t\_3 \cdot -1}{x \cdot x}\right)}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\ \end{array} \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (let* ((t_2 (pow (* (pow 2.0 0.5) t_m) 1.0))
        (t_3 (fma (* t_m t_m) 2.0 (* l_m l_m)))
        (t_4 (* (sqrt 2.0) t_m)))
   (*
    t_s
    (if (<= t_m 5.5e-211)
      (/
       t_4
       (* (* (pow (exp 0.5) (log 2.0)) (pow (exp 0.5) (* -1.0 (log x)))) l_m))
      (if (<= t_m 6e-168)
        (- (+ 1.0 (/ 0.5 (* x x))) (pow x -1.0))
        (if (<= t_m 1.32e-11)
          (/
           t_4
           (sqrt
            (-
             (+
              (fma (/ (* t_m t_m) x) 2.0 (/ (* (* t_m t_m) 2.0) (* x x)))
              (fma t_2 t_2 (+ (/ (* l_m l_m) (* x x)) (/ (* l_m l_m) x))))
             (fma (/ t_3 x) -1.0 (/ (* t_3 -1.0) (* x x))))))
          (pow (/ (* x (- 1.0 (pow x -1.0))) (+ 1.0 x)) 0.5)))))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double t_2 = pow((pow(2.0, 0.5) * t_m), 1.0);
	double t_3 = fma((t_m * t_m), 2.0, (l_m * l_m));
	double t_4 = sqrt(2.0) * t_m;
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = t_4 / ((pow(exp(0.5), log(2.0)) * pow(exp(0.5), (-1.0 * log(x)))) * l_m);
	} else if (t_m <= 6e-168) {
		tmp = (1.0 + (0.5 / (x * x))) - pow(x, -1.0);
	} else if (t_m <= 1.32e-11) {
		tmp = t_4 / sqrt(((fma(((t_m * t_m) / x), 2.0, (((t_m * t_m) * 2.0) / (x * x))) + fma(t_2, t_2, (((l_m * l_m) / (x * x)) + ((l_m * l_m) / x)))) - fma((t_3 / x), -1.0, ((t_3 * -1.0) / (x * x)))));
	} else {
		tmp = pow(((x * (1.0 - pow(x, -1.0))) / (1.0 + x)), 0.5);
	}
	return t_s * tmp;
}
l_m = abs(l)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	t_2 = Float64((2.0 ^ 0.5) * t_m) ^ 1.0
	t_3 = fma(Float64(t_m * t_m), 2.0, Float64(l_m * l_m))
	t_4 = Float64(sqrt(2.0) * t_m)
	tmp = 0.0
	if (t_m <= 5.5e-211)
		tmp = Float64(t_4 / Float64(Float64((exp(0.5) ^ log(2.0)) * (exp(0.5) ^ Float64(-1.0 * log(x)))) * l_m));
	elseif (t_m <= 6e-168)
		tmp = Float64(Float64(1.0 + Float64(0.5 / Float64(x * x))) - (x ^ -1.0));
	elseif (t_m <= 1.32e-11)
		tmp = Float64(t_4 / sqrt(Float64(Float64(fma(Float64(Float64(t_m * t_m) / x), 2.0, Float64(Float64(Float64(t_m * t_m) * 2.0) / Float64(x * x))) + fma(t_2, t_2, Float64(Float64(Float64(l_m * l_m) / Float64(x * x)) + Float64(Float64(l_m * l_m) / x)))) - fma(Float64(t_3 / x), -1.0, Float64(Float64(t_3 * -1.0) / Float64(x * x))))));
	else
		tmp = Float64(Float64(x * Float64(1.0 - (x ^ -1.0))) / Float64(1.0 + x)) ^ 0.5;
	end
	return Float64(t_s * tmp)
end
l_m = N[Abs[l], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := Block[{t$95$2 = N[Power[N[(N[Power[2.0, 0.5], $MachinePrecision] * t$95$m), $MachinePrecision], 1.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$m * t$95$m), $MachinePrecision] * 2.0 + N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[2.0], $MachinePrecision] * t$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 5.5e-211], N[(t$95$4 / N[(N[(N[Power[N[Exp[0.5], $MachinePrecision], N[Log[2.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[Exp[0.5], $MachinePrecision], N[(-1.0 * N[Log[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 6e-168], N[(N[(1.0 + N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 1.32e-11], N[(t$95$4 / N[Sqrt[N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] / x), $MachinePrecision] * 2.0 + N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * 2.0), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 * t$95$2 + N[(N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(N[(l$95$m * l$95$m), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$3 / x), $MachinePrecision] * -1.0 + N[(N[(t$95$3 * -1.0), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(x * N[(1.0 - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]]]]), $MachinePrecision]]]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
\begin{array}{l}
t_2 := {\left({2}^{0.5} \cdot t\_m\right)}^{1}\\
t_3 := \mathsf{fma}\left(t\_m \cdot t\_m, 2, l\_m \cdot l\_m\right)\\
t_4 := \sqrt{2} \cdot t\_m\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\
\;\;\;\;\frac{t\_4}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot l\_m}\\

\mathbf{elif}\;t\_m \leq 6 \cdot 10^{-168}:\\
\;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\

\mathbf{elif}\;t\_m \leq 1.32 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_4}{\sqrt{\left(\mathsf{fma}\left(\frac{t\_m \cdot t\_m}{x}, 2, \frac{\left(t\_m \cdot t\_m\right) \cdot 2}{x \cdot x}\right) + \mathsf{fma}\left(t\_2, t\_2, \frac{l\_m \cdot l\_m}{x \cdot x} + \frac{l\_m \cdot l\_m}{x}\right)\right) - \mathsf{fma}\left(\frac{t\_3}{x}, -1, \frac{t\_3 \cdot -1}{x \cdot x}\right)}}\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < 5.49999999999999973e-211

    1. Initial program 27.4%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around inf

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\ell \cdot \sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1} \cdot \color{blue}{\ell}} \]
    5. Applied rewrites10.0%

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{{\left({\left({\left(x - 1\right)}^{-1} + \left(\frac{x}{x - 1} - 1\right)\right)}^{\left({0.5}^{0.5}\right)}\right)}^{\left({0.5}^{0.5}\right)} \cdot \ell}} \]
    6. Taylor expanded in x around inf

      \[\leadsto \frac{\sqrt{2} \cdot t}{e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2} \cdot \left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
    7. Step-by-step derivation
      1. exp-prodN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      2. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      3. sqrt-pow2N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\frac{1}{2}}^{\left(\frac{2}{2}\right)}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\frac{1}{2}}^{1}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      6. lower-exp.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      7. lower-+.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      8. lower-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      9. log-recN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      10. lower-neg.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      11. lower-log.f6416.6

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{0.5}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
    8. Applied rewrites16.6%

      \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{0.5}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
    9. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      2. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      3. lift-neg.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      4. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      5. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      6. unpow-prod-upN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      8. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      9. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      10. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      11. neg-logN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\log \left(\frac{1}{x}\right)}\right) \cdot \ell} \]
      12. inv-powN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\log \left({x}^{-1}\right)}\right) \cdot \ell} \]
      13. log-pow-revN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell} \]
      14. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell} \]
      15. lift-log.f6416.7

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell} \]
    10. Applied rewrites16.7%

      \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell} \]

    if 5.49999999999999973e-211 < t < 5.99999999999999983e-168

    1. Initial program 2.6%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    4. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{1}{2} \cdot 2} \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{1} \cdot \sqrt{\frac{\color{blue}{x - 1}}{1 + x}} \]
      3. metadata-evalN/A

        \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      9. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      10. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      11. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      12. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      13. lower-+.f6441.1

        \[\leadsto \frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1 \]
    5. Applied rewrites41.1%

      \[\leadsto \color{blue}{\frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1} \]
    6. Taylor expanded in x around inf

      \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
    7. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      2. lower-+.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      3. lower-/.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      4. unpow2N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - \frac{1}{x}\right) \cdot 1 \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - \frac{1}{x}\right) \cdot 1 \]
      6. inv-powN/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]
      7. lower-pow.f6456.5

        \[\leadsto \left(\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]
    8. Applied rewrites56.5%

      \[\leadsto \left(\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]

    if 5.99999999999999983e-168 < t < 1.32e-11

    1. Initial program 48.8%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\left(2 \cdot \frac{{t}^{2}}{x} + \left(2 \cdot \frac{{t}^{2}}{{x}^{2}} + \left(2 \cdot {t}^{2} + \left(\frac{{\ell}^{2}}{x} + \frac{{\ell}^{2}}{{x}^{2}}\right)\right)\right)\right) - \left(-1 \cdot \frac{2 \cdot {t}^{2} + {\ell}^{2}}{x} + -1 \cdot \frac{2 \cdot {t}^{2} + {\ell}^{2}}{{x}^{2}}\right)}}} \]
    4. Applied rewrites91.8%

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\left(\mathsf{fma}\left(\frac{t \cdot t}{x}, 2, \frac{\left(t \cdot t\right) \cdot 2}{x \cdot x}\right) + \mathsf{fma}\left({\left({2}^{0.5} \cdot t\right)}^{1}, {\left({2}^{0.5} \cdot t\right)}^{1}, \frac{\ell \cdot \ell}{x \cdot x} + \frac{\ell \cdot \ell}{x}\right)\right) - \mathsf{fma}\left(\frac{\mathsf{fma}\left(t \cdot t, 2, \ell \cdot \ell\right)}{x}, -1, \frac{\mathsf{fma}\left(t \cdot t, 2, \ell \cdot \ell\right) \cdot -1}{x \cdot x}\right)}}} \]

    if 1.32e-11 < t

    1. Initial program 32.5%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    4. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{1}{2} \cdot 2} \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{1} \cdot \sqrt{\frac{\color{blue}{x - 1}}{1 + x}} \]
      3. metadata-evalN/A

        \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      9. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      10. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      11. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      12. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      13. lower-+.f6447.7

        \[\leadsto \frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1 \]
    5. Applied rewrites47.7%

      \[\leadsto \color{blue}{\frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      2. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      4. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      5. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      6. lift-pow.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      7. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. sqrt-divN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot 1 \]
      9. pow1/2N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      10. lower-pow.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      11. lower-/.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      12. lift--.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      13. lift-+.f6493.5

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    7. Applied rewrites93.5%

      \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    8. Taylor expanded in x around inf

      \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      2. lower--.f64N/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      3. inv-powN/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      4. lift-pow.f6493.5

        \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5} \cdot 1 \]
    10. Applied rewrites93.5%

      \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5} \cdot 1 \]
  3. Recombined 4 regimes into one program.
  4. Final simplification47.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell}\\ \mathbf{elif}\;t \leq 6 \cdot 10^{-168}:\\ \;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\ \mathbf{elif}\;t \leq 1.32 \cdot 10^{-11}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\sqrt{\left(\mathsf{fma}\left(\frac{t \cdot t}{x}, 2, \frac{\left(t \cdot t\right) \cdot 2}{x \cdot x}\right) + \mathsf{fma}\left({\left({2}^{0.5} \cdot t\right)}^{1}, {\left({2}^{0.5} \cdot t\right)}^{1}, \frac{\ell \cdot \ell}{x \cdot x} + \frac{\ell \cdot \ell}{x}\right)\right) - \mathsf{fma}\left(\frac{\mathsf{fma}\left(t \cdot t, 2, \ell \cdot \ell\right)}{x}, -1, \frac{\mathsf{fma}\left(t \cdot t, 2, \ell \cdot \ell\right) \cdot -1}{x \cdot x}\right)}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

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

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t\_m}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot l\_m}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= t_m 5.5e-211)
    (/
     (* (sqrt 2.0) t_m)
     (* (* (pow (exp 0.5) (log 2.0)) (pow (exp 0.5) (* -1.0 (log x)))) l_m))
    (pow (/ (* x (- 1.0 (pow x -1.0))) (+ 1.0 x)) 0.5))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = (sqrt(2.0) * t_m) / ((pow(exp(0.5), log(2.0)) * pow(exp(0.5), (-1.0 * log(x)))) * l_m);
	} else {
		tmp = pow(((x * (1.0 - pow(x, -1.0))) / (1.0 + x)), 0.5);
	}
	return t_s * tmp;
}
l_m =     private
t\_m =     private
t\_s =     private
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(t_s, x, l_m, t_m)
use fmin_fmax_functions
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 5.5d-211) then
        tmp = (sqrt(2.0d0) * t_m) / (((exp(0.5d0) ** log(2.0d0)) * (exp(0.5d0) ** ((-1.0d0) * log(x)))) * l_m)
    else
        tmp = ((x * (1.0d0 - (x ** (-1.0d0)))) / (1.0d0 + x)) ** 0.5d0
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = (Math.sqrt(2.0) * t_m) / ((Math.pow(Math.exp(0.5), Math.log(2.0)) * Math.pow(Math.exp(0.5), (-1.0 * Math.log(x)))) * l_m);
	} else {
		tmp = Math.pow(((x * (1.0 - Math.pow(x, -1.0))) / (1.0 + x)), 0.5);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if t_m <= 5.5e-211:
		tmp = (math.sqrt(2.0) * t_m) / ((math.pow(math.exp(0.5), math.log(2.0)) * math.pow(math.exp(0.5), (-1.0 * math.log(x)))) * l_m)
	else:
		tmp = math.pow(((x * (1.0 - math.pow(x, -1.0))) / (1.0 + x)), 0.5)
	return t_s * tmp
l_m = abs(l)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (t_m <= 5.5e-211)
		tmp = Float64(Float64(sqrt(2.0) * t_m) / Float64(Float64((exp(0.5) ^ log(2.0)) * (exp(0.5) ^ Float64(-1.0 * log(x)))) * l_m));
	else
		tmp = Float64(Float64(x * Float64(1.0 - (x ^ -1.0))) / Float64(1.0 + x)) ^ 0.5;
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (t_m <= 5.5e-211)
		tmp = (sqrt(2.0) * t_m) / (((exp(0.5) ^ log(2.0)) * (exp(0.5) ^ (-1.0 * log(x)))) * l_m);
	else
		tmp = ((x * (1.0 - (x ^ -1.0))) / (1.0 + x)) ^ 0.5;
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5.5e-211], N[(N[(N[Sqrt[2.0], $MachinePrecision] * t$95$m), $MachinePrecision] / N[(N[(N[Power[N[Exp[0.5], $MachinePrecision], N[Log[2.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[Exp[0.5], $MachinePrecision], N[(-1.0 * N[Log[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(x * N[(1.0 - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\
\;\;\;\;\frac{\sqrt{2} \cdot t\_m}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot l\_m}\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.49999999999999973e-211

    1. Initial program 27.4%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around inf

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\ell \cdot \sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1} \cdot \color{blue}{\ell}} \]
    5. Applied rewrites10.0%

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{{\left({\left({\left(x - 1\right)}^{-1} + \left(\frac{x}{x - 1} - 1\right)\right)}^{\left({0.5}^{0.5}\right)}\right)}^{\left({0.5}^{0.5}\right)} \cdot \ell}} \]
    6. Taylor expanded in x around inf

      \[\leadsto \frac{\sqrt{2} \cdot t}{e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2} \cdot \left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
    7. Step-by-step derivation
      1. exp-prodN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      2. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      3. sqrt-pow2N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\frac{1}{2}}^{\left(\frac{2}{2}\right)}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\frac{1}{2}}^{1}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      6. lower-exp.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      7. lower-+.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      8. lower-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      9. log-recN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      10. lower-neg.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      11. lower-log.f6416.6

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{0.5}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
    8. Applied rewrites16.6%

      \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{0.5}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
    9. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      2. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      3. lift-neg.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      4. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      5. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      6. unpow-prod-upN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      8. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      9. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      10. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{neg}\left(\log x\right)\right)}\right) \cdot \ell} \]
      11. neg-logN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\log \left(\frac{1}{x}\right)}\right) \cdot \ell} \]
      12. inv-powN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\log \left({x}^{-1}\right)}\right) \cdot \ell} \]
      13. log-pow-revN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell} \]
      14. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{\frac{1}{2}}\right)}^{\log 2} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell} \]
      15. lift-log.f6416.7

        \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell} \]
    10. Applied rewrites16.7%

      \[\leadsto \frac{\sqrt{2} \cdot t}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell} \]

    if 5.49999999999999973e-211 < t

    1. Initial program 32.7%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    4. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{1}{2} \cdot 2} \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{1} \cdot \sqrt{\frac{\color{blue}{x - 1}}{1 + x}} \]
      3. metadata-evalN/A

        \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      9. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      10. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      11. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      12. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      13. lower-+.f6443.8

        \[\leadsto \frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1 \]
    5. Applied rewrites43.8%

      \[\leadsto \color{blue}{\frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      2. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      4. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      5. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      6. lift-pow.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      7. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. sqrt-divN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot 1 \]
      9. pow1/2N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      10. lower-pow.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      11. lower-/.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      12. lift--.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      13. lift-+.f6482.9

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    7. Applied rewrites82.9%

      \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    8. Taylor expanded in x around inf

      \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      2. lower--.f64N/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      3. inv-powN/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      4. lift-pow.f6482.9

        \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5} \cdot 1 \]
    10. Applied rewrites82.9%

      \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5} \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\left({\left(e^{0.5}\right)}^{\log 2} \cdot {\left(e^{0.5}\right)}^{\left(-1 \cdot \log x\right)}\right) \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

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

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t\_m}{e^{\log \left(e^{0.5}\right) \cdot \left(\log 2 - \log x\right)} \cdot l\_m}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= t_m 5.5e-211)
    (/
     (* (sqrt 2.0) t_m)
     (* (exp (* (log (exp 0.5)) (- (log 2.0) (log x)))) l_m))
    (pow (/ (* x (- 1.0 (pow x -1.0))) (+ 1.0 x)) 0.5))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = (sqrt(2.0) * t_m) / (exp((log(exp(0.5)) * (log(2.0) - log(x)))) * l_m);
	} else {
		tmp = pow(((x * (1.0 - pow(x, -1.0))) / (1.0 + x)), 0.5);
	}
	return t_s * tmp;
}
l_m =     private
t\_m =     private
t\_s =     private
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(t_s, x, l_m, t_m)
use fmin_fmax_functions
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 5.5d-211) then
        tmp = (sqrt(2.0d0) * t_m) / (exp((log(exp(0.5d0)) * (log(2.0d0) - log(x)))) * l_m)
    else
        tmp = ((x * (1.0d0 - (x ** (-1.0d0)))) / (1.0d0 + x)) ** 0.5d0
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = (Math.sqrt(2.0) * t_m) / (Math.exp((Math.log(Math.exp(0.5)) * (Math.log(2.0) - Math.log(x)))) * l_m);
	} else {
		tmp = Math.pow(((x * (1.0 - Math.pow(x, -1.0))) / (1.0 + x)), 0.5);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if t_m <= 5.5e-211:
		tmp = (math.sqrt(2.0) * t_m) / (math.exp((math.log(math.exp(0.5)) * (math.log(2.0) - math.log(x)))) * l_m)
	else:
		tmp = math.pow(((x * (1.0 - math.pow(x, -1.0))) / (1.0 + x)), 0.5)
	return t_s * tmp
l_m = abs(l)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (t_m <= 5.5e-211)
		tmp = Float64(Float64(sqrt(2.0) * t_m) / Float64(exp(Float64(log(exp(0.5)) * Float64(log(2.0) - log(x)))) * l_m));
	else
		tmp = Float64(Float64(x * Float64(1.0 - (x ^ -1.0))) / Float64(1.0 + x)) ^ 0.5;
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (t_m <= 5.5e-211)
		tmp = (sqrt(2.0) * t_m) / (exp((log(exp(0.5)) * (log(2.0) - log(x)))) * l_m);
	else
		tmp = ((x * (1.0 - (x ^ -1.0))) / (1.0 + x)) ^ 0.5;
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5.5e-211], N[(N[(N[Sqrt[2.0], $MachinePrecision] * t$95$m), $MachinePrecision] / N[(N[Exp[N[(N[Log[N[Exp[0.5], $MachinePrecision]], $MachinePrecision] * N[(N[Log[2.0], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(x * N[(1.0 - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\
\;\;\;\;\frac{\sqrt{2} \cdot t\_m}{e^{\log \left(e^{0.5}\right) \cdot \left(\log 2 - \log x\right)} \cdot l\_m}\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.49999999999999973e-211

    1. Initial program 27.4%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around inf

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\ell \cdot \sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1} \cdot \color{blue}{\ell}} \]
    5. Applied rewrites10.0%

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{{\left({\left({\left(x - 1\right)}^{-1} + \left(\frac{x}{x - 1} - 1\right)\right)}^{\left({0.5}^{0.5}\right)}\right)}^{\left({0.5}^{0.5}\right)} \cdot \ell}} \]
    6. Taylor expanded in x around inf

      \[\leadsto \frac{\sqrt{2} \cdot t}{e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2} \cdot \left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
    7. Step-by-step derivation
      1. exp-prodN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      2. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\left(\sqrt{\frac{1}{2}}\right)}^{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      3. sqrt-pow2N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\frac{1}{2}}^{\left(\frac{2}{2}\right)}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{{\frac{1}{2}}^{1}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      6. lower-exp.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      7. lower-+.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      8. lower-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      9. log-recN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      10. lower-neg.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      11. lower-log.f6416.6

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{0.5}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
    8. Applied rewrites16.6%

      \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{0.5}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
    9. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      2. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(-\log x\right)\right)} \cdot \ell} \]
      3. lift-neg.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      4. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      5. lower-pow.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{{\left(e^{\frac{1}{2}}\right)}^{\left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      6. pow-to-expN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      7. lower-exp.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      9. lower-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      10. lower-+.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      11. lift-log.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + \left(\mathsf{neg}\left(\log x\right)\right)\right)} \cdot \ell} \]
      12. neg-logN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + \log \left(\frac{1}{x}\right)\right)} \cdot \ell} \]
      13. inv-powN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + \log \left({x}^{-1}\right)\right)} \cdot \ell} \]
      14. log-pow-revN/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + -1 \cdot \log x\right)} \cdot \ell} \]
      15. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{\frac{1}{2}}\right) \cdot \left(\log 2 + -1 \cdot \log x\right)} \cdot \ell} \]
      16. lift-log.f6416.7

        \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{0.5}\right) \cdot \left(\log 2 + -1 \cdot \log x\right)} \cdot \ell} \]
    10. Applied rewrites16.7%

      \[\leadsto \frac{\sqrt{2} \cdot t}{e^{\log \left(e^{0.5}\right) \cdot \left(\log 2 + -1 \cdot \log x\right)} \cdot \ell} \]

    if 5.49999999999999973e-211 < t

    1. Initial program 32.7%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    4. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{1}{2} \cdot 2} \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{1} \cdot \sqrt{\frac{\color{blue}{x - 1}}{1 + x}} \]
      3. metadata-evalN/A

        \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      9. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      10. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      11. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      12. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      13. lower-+.f6443.8

        \[\leadsto \frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1 \]
    5. Applied rewrites43.8%

      \[\leadsto \color{blue}{\frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      2. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      4. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      5. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      6. lift-pow.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      7. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. sqrt-divN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot 1 \]
      9. pow1/2N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      10. lower-pow.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      11. lower-/.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      12. lift--.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      13. lift-+.f6482.9

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    7. Applied rewrites82.9%

      \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    8. Taylor expanded in x around inf

      \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      2. lower--.f64N/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      3. inv-powN/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      4. lift-pow.f6482.9

        \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5} \cdot 1 \]
    10. Applied rewrites82.9%

      \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5} \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{e^{\log \left(e^{0.5}\right) \cdot \left(\log 2 - \log x\right)} \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

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

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t\_m}{l\_m}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= t_m 5.5e-211)
    (*
     (pow
      (+
       (pow (- x 1.0) -1.0)
       (/
        (+
         1.0
         (+ (pow x -1.0) (+ (pow (* x x) -1.0) (pow (* (* x x) x) -1.0))))
        x))
      -0.5)
     (/ (* (* (pow 2.0 0.25) (pow 2.0 0.25)) t_m) l_m))
    (pow (/ (* x (- 1.0 (pow x -1.0))) (+ 1.0 x)) 0.5))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = pow((pow((x - 1.0), -1.0) + ((1.0 + (pow(x, -1.0) + (pow((x * x), -1.0) + pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((pow(2.0, 0.25) * pow(2.0, 0.25)) * t_m) / l_m);
	} else {
		tmp = pow(((x * (1.0 - pow(x, -1.0))) / (1.0 + x)), 0.5);
	}
	return t_s * tmp;
}
l_m =     private
t\_m =     private
t\_s =     private
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(t_s, x, l_m, t_m)
use fmin_fmax_functions
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 5.5d-211) then
        tmp = ((((x - 1.0d0) ** (-1.0d0)) + ((1.0d0 + ((x ** (-1.0d0)) + (((x * x) ** (-1.0d0)) + (((x * x) * x) ** (-1.0d0))))) / x)) ** (-0.5d0)) * ((((2.0d0 ** 0.25d0) * (2.0d0 ** 0.25d0)) * t_m) / l_m)
    else
        tmp = ((x * (1.0d0 - (x ** (-1.0d0)))) / (1.0d0 + x)) ** 0.5d0
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = Math.pow((Math.pow((x - 1.0), -1.0) + ((1.0 + (Math.pow(x, -1.0) + (Math.pow((x * x), -1.0) + Math.pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((Math.pow(2.0, 0.25) * Math.pow(2.0, 0.25)) * t_m) / l_m);
	} else {
		tmp = Math.pow(((x * (1.0 - Math.pow(x, -1.0))) / (1.0 + x)), 0.5);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if t_m <= 5.5e-211:
		tmp = math.pow((math.pow((x - 1.0), -1.0) + ((1.0 + (math.pow(x, -1.0) + (math.pow((x * x), -1.0) + math.pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((math.pow(2.0, 0.25) * math.pow(2.0, 0.25)) * t_m) / l_m)
	else:
		tmp = math.pow(((x * (1.0 - math.pow(x, -1.0))) / (1.0 + x)), 0.5)
	return t_s * tmp
l_m = abs(l)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (t_m <= 5.5e-211)
		tmp = Float64((Float64((Float64(x - 1.0) ^ -1.0) + Float64(Float64(1.0 + Float64((x ^ -1.0) + Float64((Float64(x * x) ^ -1.0) + (Float64(Float64(x * x) * x) ^ -1.0)))) / x)) ^ -0.5) * Float64(Float64(Float64((2.0 ^ 0.25) * (2.0 ^ 0.25)) * t_m) / l_m));
	else
		tmp = Float64(Float64(x * Float64(1.0 - (x ^ -1.0))) / Float64(1.0 + x)) ^ 0.5;
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (t_m <= 5.5e-211)
		tmp = ((((x - 1.0) ^ -1.0) + ((1.0 + ((x ^ -1.0) + (((x * x) ^ -1.0) + (((x * x) * x) ^ -1.0)))) / x)) ^ -0.5) * ((((2.0 ^ 0.25) * (2.0 ^ 0.25)) * t_m) / l_m);
	else
		tmp = ((x * (1.0 - (x ^ -1.0))) / (1.0 + x)) ^ 0.5;
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5.5e-211], N[(N[Power[N[(N[Power[N[(x - 1.0), $MachinePrecision], -1.0], $MachinePrecision] + N[(N[(1.0 + N[(N[Power[x, -1.0], $MachinePrecision] + N[(N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision] + N[Power[N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(N[(N[(N[Power[2.0, 0.25], $MachinePrecision] * N[Power[2.0, 0.25], $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(x * N[(1.0 - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\
\;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t\_m}{l\_m}\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.49999999999999973e-211

    1. Initial program 27.4%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around inf

      \[\leadsto \color{blue}{\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}} \cdot \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}} \]
    5. Applied rewrites10.0%

      \[\leadsto \color{blue}{{\left({\left(x - 1\right)}^{-1} + \left(\frac{x}{x - 1} - 1\right)\right)}^{-0.5} \cdot \frac{{2}^{0.5} \cdot t}{\ell}} \]
    6. Taylor expanded in x around inf

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

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left(\frac{1}{x} + \left(\frac{1}{{x}^{2}} + \frac{1}{{x}^{3}}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{{2}^{\frac{1}{2}} \cdot t}{\ell} \]
    8. Applied rewrites15.9%

      \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{{2}^{\color{blue}{0.5}} \cdot t}{\ell} \]
    9. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{{2}^{\frac{1}{2}} \cdot t}{\ell} \]
      2. sqr-powN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      3. lower-*.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      4. metadata-evalN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      6. metadata-evalN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\frac{1}{4}}\right) \cdot t}{\ell} \]
      7. lower-pow.f6415.9

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell} \]
    10. Applied rewrites15.9%

      \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell} \]

    if 5.49999999999999973e-211 < t

    1. Initial program 32.7%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    4. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{1}{2} \cdot 2} \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{1} \cdot \sqrt{\frac{\color{blue}{x - 1}}{1 + x}} \]
      3. metadata-evalN/A

        \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      9. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      10. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      11. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      12. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      13. lower-+.f6443.8

        \[\leadsto \frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1 \]
    5. Applied rewrites43.8%

      \[\leadsto \color{blue}{\frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      2. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      4. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      5. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      6. lift-pow.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      7. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. sqrt-divN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot 1 \]
      9. pow1/2N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      10. lower-pow.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      11. lower-/.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      12. lift--.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      13. lift-+.f6482.9

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    7. Applied rewrites82.9%

      \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    8. Taylor expanded in x around inf

      \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      2. lower--.f64N/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - \frac{1}{x}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      3. inv-powN/A

        \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      4. lift-pow.f6482.9

        \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5} \cdot 1 \]
    10. Applied rewrites82.9%

      \[\leadsto {\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5} \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x \cdot \left(1 - {x}^{-1}\right)}{1 + x}\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

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

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t\_m}{l\_m}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{0.5}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= t_m 5.5e-211)
    (*
     (pow
      (+
       (pow (- x 1.0) -1.0)
       (/
        (+
         1.0
         (+ (pow x -1.0) (+ (pow (* x x) -1.0) (pow (* (* x x) x) -1.0))))
        x))
      -0.5)
     (/ (* (* (pow 2.0 0.25) (pow 2.0 0.25)) t_m) l_m))
    (pow (- (/ x (+ 1.0 x)) (/ 1.0 (+ 1.0 x))) 0.5))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = pow((pow((x - 1.0), -1.0) + ((1.0 + (pow(x, -1.0) + (pow((x * x), -1.0) + pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((pow(2.0, 0.25) * pow(2.0, 0.25)) * t_m) / l_m);
	} else {
		tmp = pow(((x / (1.0 + x)) - (1.0 / (1.0 + x))), 0.5);
	}
	return t_s * tmp;
}
l_m =     private
t\_m =     private
t\_s =     private
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(t_s, x, l_m, t_m)
use fmin_fmax_functions
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 5.5d-211) then
        tmp = ((((x - 1.0d0) ** (-1.0d0)) + ((1.0d0 + ((x ** (-1.0d0)) + (((x * x) ** (-1.0d0)) + (((x * x) * x) ** (-1.0d0))))) / x)) ** (-0.5d0)) * ((((2.0d0 ** 0.25d0) * (2.0d0 ** 0.25d0)) * t_m) / l_m)
    else
        tmp = ((x / (1.0d0 + x)) - (1.0d0 / (1.0d0 + x))) ** 0.5d0
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = Math.pow((Math.pow((x - 1.0), -1.0) + ((1.0 + (Math.pow(x, -1.0) + (Math.pow((x * x), -1.0) + Math.pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((Math.pow(2.0, 0.25) * Math.pow(2.0, 0.25)) * t_m) / l_m);
	} else {
		tmp = Math.pow(((x / (1.0 + x)) - (1.0 / (1.0 + x))), 0.5);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if t_m <= 5.5e-211:
		tmp = math.pow((math.pow((x - 1.0), -1.0) + ((1.0 + (math.pow(x, -1.0) + (math.pow((x * x), -1.0) + math.pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((math.pow(2.0, 0.25) * math.pow(2.0, 0.25)) * t_m) / l_m)
	else:
		tmp = math.pow(((x / (1.0 + x)) - (1.0 / (1.0 + x))), 0.5)
	return t_s * tmp
l_m = abs(l)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (t_m <= 5.5e-211)
		tmp = Float64((Float64((Float64(x - 1.0) ^ -1.0) + Float64(Float64(1.0 + Float64((x ^ -1.0) + Float64((Float64(x * x) ^ -1.0) + (Float64(Float64(x * x) * x) ^ -1.0)))) / x)) ^ -0.5) * Float64(Float64(Float64((2.0 ^ 0.25) * (2.0 ^ 0.25)) * t_m) / l_m));
	else
		tmp = Float64(Float64(x / Float64(1.0 + x)) - Float64(1.0 / Float64(1.0 + x))) ^ 0.5;
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (t_m <= 5.5e-211)
		tmp = ((((x - 1.0) ^ -1.0) + ((1.0 + ((x ^ -1.0) + (((x * x) ^ -1.0) + (((x * x) * x) ^ -1.0)))) / x)) ^ -0.5) * ((((2.0 ^ 0.25) * (2.0 ^ 0.25)) * t_m) / l_m);
	else
		tmp = ((x / (1.0 + x)) - (1.0 / (1.0 + x))) ^ 0.5;
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5.5e-211], N[(N[Power[N[(N[Power[N[(x - 1.0), $MachinePrecision], -1.0], $MachinePrecision] + N[(N[(1.0 + N[(N[Power[x, -1.0], $MachinePrecision] + N[(N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision] + N[Power[N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(N[(N[(N[Power[2.0, 0.25], $MachinePrecision] * N[Power[2.0, 0.25], $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\
\;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t\_m}{l\_m}\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.49999999999999973e-211

    1. Initial program 27.4%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around inf

      \[\leadsto \color{blue}{\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}} \cdot \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}} \]
    5. Applied rewrites10.0%

      \[\leadsto \color{blue}{{\left({\left(x - 1\right)}^{-1} + \left(\frac{x}{x - 1} - 1\right)\right)}^{-0.5} \cdot \frac{{2}^{0.5} \cdot t}{\ell}} \]
    6. Taylor expanded in x around inf

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

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left(\frac{1}{x} + \left(\frac{1}{{x}^{2}} + \frac{1}{{x}^{3}}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{{2}^{\frac{1}{2}} \cdot t}{\ell} \]
    8. Applied rewrites15.9%

      \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{{2}^{\color{blue}{0.5}} \cdot t}{\ell} \]
    9. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{{2}^{\frac{1}{2}} \cdot t}{\ell} \]
      2. sqr-powN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      3. lower-*.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      4. metadata-evalN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      6. metadata-evalN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\frac{1}{4}}\right) \cdot t}{\ell} \]
      7. lower-pow.f6415.9

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell} \]
    10. Applied rewrites15.9%

      \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell} \]

    if 5.49999999999999973e-211 < t

    1. Initial program 32.7%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    4. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{1}{2} \cdot 2} \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{1} \cdot \sqrt{\frac{\color{blue}{x - 1}}{1 + x}} \]
      3. metadata-evalN/A

        \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      9. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      10. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      11. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      12. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      13. lower-+.f6443.8

        \[\leadsto \frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1 \]
    5. Applied rewrites43.8%

      \[\leadsto \color{blue}{\frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      2. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      3. lift-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      4. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      5. lift-+.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      6. lift-pow.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      7. unpow1/2N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. sqrt-divN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot 1 \]
      9. pow1/2N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      10. lower-pow.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      11. lower-/.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      12. lift--.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      13. lift-+.f6482.9

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    7. Applied rewrites82.9%

      \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{0.5} \cdot 1 \]
    8. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      2. lift-+.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      3. lift-/.f64N/A

        \[\leadsto {\left(\frac{x - 1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      4. div-subN/A

        \[\leadsto {\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      5. lower--.f64N/A

        \[\leadsto {\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      6. lower-/.f64N/A

        \[\leadsto {\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      7. lift-+.f64N/A

        \[\leadsto {\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      8. lower-/.f64N/A

        \[\leadsto {\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{\frac{1}{2}} \cdot 1 \]
      9. lift-+.f6482.9

        \[\leadsto {\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{0.5} \cdot 1 \]
    9. Applied rewrites82.9%

      \[\leadsto {\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{0.5} \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x}{1 + x} - \frac{1}{1 + x}\right)}^{0.5}\\ \end{array} \]
  5. Add Preprocessing

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

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t\_m}{l\_m}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= t_m 5.5e-211)
    (*
     (pow
      (+
       (pow (- x 1.0) -1.0)
       (/
        (+
         1.0
         (+ (pow x -1.0) (+ (pow (* x x) -1.0) (pow (* (* x x) x) -1.0))))
        x))
      -0.5)
     (/ (* (* (pow 2.0 0.25) (pow 2.0 0.25)) t_m) l_m))
    (- (+ 1.0 (/ 0.5 (* x x))) (pow x -1.0)))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = pow((pow((x - 1.0), -1.0) + ((1.0 + (pow(x, -1.0) + (pow((x * x), -1.0) + pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((pow(2.0, 0.25) * pow(2.0, 0.25)) * t_m) / l_m);
	} else {
		tmp = (1.0 + (0.5 / (x * x))) - pow(x, -1.0);
	}
	return t_s * tmp;
}
l_m =     private
t\_m =     private
t\_s =     private
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(t_s, x, l_m, t_m)
use fmin_fmax_functions
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 5.5d-211) then
        tmp = ((((x - 1.0d0) ** (-1.0d0)) + ((1.0d0 + ((x ** (-1.0d0)) + (((x * x) ** (-1.0d0)) + (((x * x) * x) ** (-1.0d0))))) / x)) ** (-0.5d0)) * ((((2.0d0 ** 0.25d0) * (2.0d0 ** 0.25d0)) * t_m) / l_m)
    else
        tmp = (1.0d0 + (0.5d0 / (x * x))) - (x ** (-1.0d0))
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = Math.pow((Math.pow((x - 1.0), -1.0) + ((1.0 + (Math.pow(x, -1.0) + (Math.pow((x * x), -1.0) + Math.pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((Math.pow(2.0, 0.25) * Math.pow(2.0, 0.25)) * t_m) / l_m);
	} else {
		tmp = (1.0 + (0.5 / (x * x))) - Math.pow(x, -1.0);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if t_m <= 5.5e-211:
		tmp = math.pow((math.pow((x - 1.0), -1.0) + ((1.0 + (math.pow(x, -1.0) + (math.pow((x * x), -1.0) + math.pow(((x * x) * x), -1.0)))) / x)), -0.5) * (((math.pow(2.0, 0.25) * math.pow(2.0, 0.25)) * t_m) / l_m)
	else:
		tmp = (1.0 + (0.5 / (x * x))) - math.pow(x, -1.0)
	return t_s * tmp
l_m = abs(l)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (t_m <= 5.5e-211)
		tmp = Float64((Float64((Float64(x - 1.0) ^ -1.0) + Float64(Float64(1.0 + Float64((x ^ -1.0) + Float64((Float64(x * x) ^ -1.0) + (Float64(Float64(x * x) * x) ^ -1.0)))) / x)) ^ -0.5) * Float64(Float64(Float64((2.0 ^ 0.25) * (2.0 ^ 0.25)) * t_m) / l_m));
	else
		tmp = Float64(Float64(1.0 + Float64(0.5 / Float64(x * x))) - (x ^ -1.0));
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (t_m <= 5.5e-211)
		tmp = ((((x - 1.0) ^ -1.0) + ((1.0 + ((x ^ -1.0) + (((x * x) ^ -1.0) + (((x * x) * x) ^ -1.0)))) / x)) ^ -0.5) * ((((2.0 ^ 0.25) * (2.0 ^ 0.25)) * t_m) / l_m);
	else
		tmp = (1.0 + (0.5 / (x * x))) - (x ^ -1.0);
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5.5e-211], N[(N[Power[N[(N[Power[N[(x - 1.0), $MachinePrecision], -1.0], $MachinePrecision] + N[(N[(1.0 + N[(N[Power[x, -1.0], $MachinePrecision] + N[(N[Power[N[(x * x), $MachinePrecision], -1.0], $MachinePrecision] + N[Power[N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(N[(N[(N[Power[2.0, 0.25], $MachinePrecision] * N[Power[2.0, 0.25], $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\
\;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t\_m}{l\_m}\\

\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.49999999999999973e-211

    1. Initial program 27.4%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around inf

      \[\leadsto \color{blue}{\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}} \cdot \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}} \]
    5. Applied rewrites10.0%

      \[\leadsto \color{blue}{{\left({\left(x - 1\right)}^{-1} + \left(\frac{x}{x - 1} - 1\right)\right)}^{-0.5} \cdot \frac{{2}^{0.5} \cdot t}{\ell}} \]
    6. Taylor expanded in x around inf

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

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left(\frac{1}{x} + \left(\frac{1}{{x}^{2}} + \frac{1}{{x}^{3}}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{{2}^{\frac{1}{2}} \cdot t}{\ell} \]
    8. Applied rewrites15.9%

      \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{{2}^{\color{blue}{0.5}} \cdot t}{\ell} \]
    9. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{{2}^{\frac{1}{2}} \cdot t}{\ell} \]
      2. sqr-powN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      3. lower-*.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      4. metadata-evalN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      5. lower-pow.f64N/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot t}{\ell} \]
      6. metadata-evalN/A

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{\frac{-1}{2}} \cdot \frac{\left({2}^{\frac{1}{4}} \cdot {2}^{\frac{1}{4}}\right) \cdot t}{\ell} \]
      7. lower-pow.f6415.9

        \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell} \]
    10. Applied rewrites15.9%

      \[\leadsto {\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell} \]

    if 5.49999999999999973e-211 < t

    1. Initial program 32.7%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    4. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{1}{2} \cdot 2} \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{1} \cdot \sqrt{\frac{\color{blue}{x - 1}}{1 + x}} \]
      3. metadata-evalN/A

        \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      9. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      10. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      11. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      12. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      13. lower-+.f6443.8

        \[\leadsto \frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1 \]
    5. Applied rewrites43.8%

      \[\leadsto \color{blue}{\frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1} \]
    6. Taylor expanded in x around inf

      \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
    7. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      2. lower-+.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      3. lower-/.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      4. unpow2N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - \frac{1}{x}\right) \cdot 1 \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - \frac{1}{x}\right) \cdot 1 \]
      6. inv-powN/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]
      7. lower-pow.f6482.3

        \[\leadsto \left(\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]
    8. Applied rewrites82.3%

      \[\leadsto \left(\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;{\left({\left(x - 1\right)}^{-1} + \frac{1 + \left({x}^{-1} + \left({\left(x \cdot x\right)}^{-1} + {\left(\left(x \cdot x\right) \cdot x\right)}^{-1}\right)\right)}{x}\right)}^{-0.5} \cdot \frac{\left({2}^{0.25} \cdot {2}^{0.25}\right) \cdot t}{\ell}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 78.5% accurate, N/A× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \begin{array}{l} \mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;\frac{t\_m}{l\_m} \cdot {x}^{0.5}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\ \end{array} \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (*
  t_s
  (if (<= t_m 5.5e-211)
    (* (/ t_m l_m) (pow x 0.5))
    (- (+ 1.0 (/ 0.5 (* x x))) (pow x -1.0)))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = (t_m / l_m) * pow(x, 0.5);
	} else {
		tmp = (1.0 + (0.5 / (x * x))) - pow(x, -1.0);
	}
	return t_s * tmp;
}
l_m =     private
t\_m =     private
t\_s =     private
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(t_s, x, l_m, t_m)
use fmin_fmax_functions
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 5.5d-211) then
        tmp = (t_m / l_m) * (x ** 0.5d0)
    else
        tmp = (1.0d0 + (0.5d0 / (x * x))) - (x ** (-1.0d0))
    end if
    code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	double tmp;
	if (t_m <= 5.5e-211) {
		tmp = (t_m / l_m) * Math.pow(x, 0.5);
	} else {
		tmp = (1.0 + (0.5 / (x * x))) - Math.pow(x, -1.0);
	}
	return t_s * tmp;
}
l_m = math.fabs(l)
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	tmp = 0
	if t_m <= 5.5e-211:
		tmp = (t_m / l_m) * math.pow(x, 0.5)
	else:
		tmp = (1.0 + (0.5 / (x * x))) - math.pow(x, -1.0)
	return t_s * tmp
l_m = abs(l)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	tmp = 0.0
	if (t_m <= 5.5e-211)
		tmp = Float64(Float64(t_m / l_m) * (x ^ 0.5));
	else
		tmp = Float64(Float64(1.0 + Float64(0.5 / Float64(x * x))) - (x ^ -1.0));
	end
	return Float64(t_s * tmp)
end
l_m = abs(l);
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, l_m, t_m)
	tmp = 0.0;
	if (t_m <= 5.5e-211)
		tmp = (t_m / l_m) * (x ^ 0.5);
	else
		tmp = (1.0 + (0.5 / (x * x))) - (x ^ -1.0);
	end
	tmp_2 = t_s * tmp;
end
l_m = N[Abs[l], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5.5e-211], N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Power[x, 0.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-211}:\\
\;\;\;\;\frac{t\_m}{l\_m} \cdot {x}^{0.5}\\

\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 5.49999999999999973e-211

    1. Initial program 27.4%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around inf

      \[\leadsto \color{blue}{\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}} \cdot \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}} \]
    5. Applied rewrites10.0%

      \[\leadsto \color{blue}{{\left({\left(x - 1\right)}^{-1} + \left(\frac{x}{x - 1} - 1\right)\right)}^{-0.5} \cdot \frac{{2}^{0.5} \cdot t}{\ell}} \]
    6. Taylor expanded in x around inf

      \[\leadsto \frac{t \cdot \left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right)}{\ell} \cdot \color{blue}{\sqrt{x}} \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{t \cdot \left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right)}{\ell} \cdot \sqrt{x} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{t \cdot \left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right)}{\ell} \cdot \sqrt{x} \]
      3. sqrt-unprodN/A

        \[\leadsto \frac{t \cdot \sqrt{\frac{1}{2} \cdot 2}}{\ell} \cdot \sqrt{x} \]
      4. metadata-evalN/A

        \[\leadsto \frac{t \cdot \sqrt{1}}{\ell} \cdot \sqrt{x} \]
      5. metadata-evalN/A

        \[\leadsto \frac{t \cdot 1}{\ell} \cdot \sqrt{x} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{t \cdot 1}{\ell} \cdot \sqrt{x} \]
      7. pow1/2N/A

        \[\leadsto \frac{t \cdot 1}{\ell} \cdot {x}^{\frac{1}{2}} \]
      8. lower-pow.f6415.6

        \[\leadsto \frac{t \cdot 1}{\ell} \cdot {x}^{0.5} \]
    8. Applied rewrites15.6%

      \[\leadsto \frac{t \cdot 1}{\ell} \cdot \color{blue}{{x}^{0.5}} \]

    if 5.49999999999999973e-211 < t

    1. Initial program 32.7%

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
    2. Add Preprocessing
    3. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{x - 1}{1 + x}}} \]
    4. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\frac{1}{2} \cdot 2} \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      2. metadata-evalN/A

        \[\leadsto \sqrt{1} \cdot \sqrt{\frac{\color{blue}{x - 1}}{1 + x}} \]
      3. metadata-evalN/A

        \[\leadsto 1 \cdot \sqrt{\color{blue}{\frac{x - 1}{1 + x}}} \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      5. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{x - 1}{1 + x}} \cdot \color{blue}{1} \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{x - 1}}{\sqrt{1 + x}} \cdot 1 \]
      8. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      9. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      10. lift--.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{\sqrt{1 + x}} \cdot 1 \]
      11. pow1/2N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      12. lower-pow.f64N/A

        \[\leadsto \frac{{\left(x - 1\right)}^{\frac{1}{2}}}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot 1 \]
      13. lower-+.f6443.8

        \[\leadsto \frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1 \]
    5. Applied rewrites43.8%

      \[\leadsto \color{blue}{\frac{{\left(x - 1\right)}^{0.5}}{{\left(1 + x\right)}^{0.5}} \cdot 1} \]
    6. Taylor expanded in x around inf

      \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
    7. Step-by-step derivation
      1. lower--.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      2. lower-+.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      3. lower-/.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{{x}^{2}}\right) - \frac{1}{x}\right) \cdot 1 \]
      4. unpow2N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - \frac{1}{x}\right) \cdot 1 \]
      5. lower-*.f64N/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - \frac{1}{x}\right) \cdot 1 \]
      6. inv-powN/A

        \[\leadsto \left(\left(1 + \frac{\frac{1}{2}}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]
      7. lower-pow.f6482.3

        \[\leadsto \left(\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]
    8. Applied rewrites82.3%

      \[\leadsto \left(\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\right) \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification44.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 5.5 \cdot 10^{-211}:\\ \;\;\;\;\frac{t}{\ell} \cdot {x}^{0.5}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{0.5}{x \cdot x}\right) - {x}^{-1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 22.2% accurate, N/A× speedup?

\[\begin{array}{l} l_m = \left|\ell\right| \\ t\_m = \left|t\right| \\ t\_s = \mathsf{copysign}\left(1, t\right) \\ t\_s \cdot \left(\frac{t\_m}{l\_m} \cdot {x}^{0.5}\right) \end{array} \]
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
 :precision binary64
 (* t_s (* (/ t_m l_m) (pow x 0.5))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
	return t_s * ((t_m / l_m) * pow(x, 0.5));
}
l_m =     private
t\_m =     private
t\_s =     private
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(t_s, x, l_m, t_m)
use fmin_fmax_functions
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: l_m
    real(8), intent (in) :: t_m
    code = t_s * ((t_m / l_m) * (x ** 0.5d0))
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
	return t_s * ((t_m / l_m) * Math.pow(x, 0.5));
}
l_m = math.fabs(l)
t\_m = math.fabs(t)
t\_s = math.copysign(1.0, t)
def code(t_s, x, l_m, t_m):
	return t_s * ((t_m / l_m) * math.pow(x, 0.5))
l_m = abs(l)
t\_m = abs(t)
t\_s = copysign(1.0, t)
function code(t_s, x, l_m, t_m)
	return Float64(t_s * Float64(Float64(t_m / l_m) * (x ^ 0.5)))
end
l_m = abs(l);
t\_m = abs(t);
t\_s = sign(t) * abs(1.0);
function tmp = code(t_s, x, l_m, t_m)
	tmp = t_s * ((t_m / l_m) * (x ^ 0.5));
end
l_m = N[Abs[l], $MachinePrecision]
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Power[x, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)

\\
t\_s \cdot \left(\frac{t\_m}{l\_m} \cdot {x}^{0.5}\right)
\end{array}
Derivation
  1. Initial program 29.6%

    \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \]
  2. Add Preprocessing
  3. Taylor expanded in l around inf

    \[\leadsto \color{blue}{\frac{t \cdot \sqrt{2}}{\ell} \cdot \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

      \[\leadsto \sqrt{\frac{1}{\left(\frac{1}{x - 1} + \frac{x}{x - 1}\right) - 1}} \cdot \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}} \]
  5. Applied rewrites8.1%

    \[\leadsto \color{blue}{{\left({\left(x - 1\right)}^{-1} + \left(\frac{x}{x - 1} - 1\right)\right)}^{-0.5} \cdot \frac{{2}^{0.5} \cdot t}{\ell}} \]
  6. Taylor expanded in x around inf

    \[\leadsto \frac{t \cdot \left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right)}{\ell} \cdot \color{blue}{\sqrt{x}} \]
  7. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{t \cdot \left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right)}{\ell} \cdot \sqrt{x} \]
    2. lower-/.f64N/A

      \[\leadsto \frac{t \cdot \left(\sqrt{\frac{1}{2}} \cdot \sqrt{2}\right)}{\ell} \cdot \sqrt{x} \]
    3. sqrt-unprodN/A

      \[\leadsto \frac{t \cdot \sqrt{\frac{1}{2} \cdot 2}}{\ell} \cdot \sqrt{x} \]
    4. metadata-evalN/A

      \[\leadsto \frac{t \cdot \sqrt{1}}{\ell} \cdot \sqrt{x} \]
    5. metadata-evalN/A

      \[\leadsto \frac{t \cdot 1}{\ell} \cdot \sqrt{x} \]
    6. lower-*.f64N/A

      \[\leadsto \frac{t \cdot 1}{\ell} \cdot \sqrt{x} \]
    7. pow1/2N/A

      \[\leadsto \frac{t \cdot 1}{\ell} \cdot {x}^{\frac{1}{2}} \]
    8. lower-pow.f6414.4

      \[\leadsto \frac{t \cdot 1}{\ell} \cdot {x}^{0.5} \]
  8. Applied rewrites14.4%

    \[\leadsto \frac{t \cdot 1}{\ell} \cdot \color{blue}{{x}^{0.5}} \]
  9. Final simplification14.4%

    \[\leadsto \frac{t}{\ell} \cdot {x}^{0.5} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2025066 
(FPCore (x l t)
  :name "Toniolo and Linder, Equation (7)"
  :precision binary64
  (/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))