?

Average Error: 42.7 → 9.0
Time: 2.1min
Precision: binary64
Cost: 21328

?

\[\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}} \]
\[\begin{array}{l} t_1 := t \cdot \sqrt{2 + \frac{4}{x}}\\ t_2 := \sqrt{2} \cdot t\\ t_3 := \frac{t_2}{\frac{\ell}{t_1} \cdot \frac{\ell}{x} + t_1}\\ t_4 := \frac{t_2}{\sqrt{2 \cdot \left(\ell \cdot \frac{\ell}{x}\right) + \left(2 + 4 \cdot \frac{1}{x}\right) \cdot {t}^{2}}}\\ \mathbf{if}\;t \leq -2.4 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;t \leq 7.5 \cdot 10^{-308}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t \leq 3.7 \cdot 10^{-159}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 3.7 \cdot 10^{+21}:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \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)))))
(FPCore (x l t)
 :precision binary64
 (let* ((t_1 (* t (sqrt (+ 2.0 (/ 4.0 x)))))
        (t_2 (* (sqrt 2.0) t))
        (t_3 (/ t_2 (+ (* (/ l t_1) (/ l x)) t_1)))
        (t_4
         (/
          t_2
          (sqrt
           (+
            (* 2.0 (* l (/ l x)))
            (* (+ 2.0 (* 4.0 (/ 1.0 x))) (pow t 2.0)))))))
   (if (<= t -2.4e+102)
     -1.0
     (if (<= t 7.5e-308)
       t_4
       (if (<= t 3.7e-159) t_3 (if (<= t 3.7e+21) t_4 t_3))))))
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)));
}
double code(double x, double l, double t) {
	double t_1 = t * sqrt((2.0 + (4.0 / x)));
	double t_2 = sqrt(2.0) * t;
	double t_3 = t_2 / (((l / t_1) * (l / x)) + t_1);
	double t_4 = t_2 / sqrt(((2.0 * (l * (l / x))) + ((2.0 + (4.0 * (1.0 / x))) * pow(t, 2.0))));
	double tmp;
	if (t <= -2.4e+102) {
		tmp = -1.0;
	} else if (t <= 7.5e-308) {
		tmp = t_4;
	} else if (t <= 3.7e-159) {
		tmp = t_3;
	} else if (t <= 3.7e+21) {
		tmp = t_4;
	} else {
		tmp = t_3;
	}
	return tmp;
}
real(8) function code(x, l, t)
    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
real(8) function code(x, l, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: l
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = t * sqrt((2.0d0 + (4.0d0 / x)))
    t_2 = sqrt(2.0d0) * t
    t_3 = t_2 / (((l / t_1) * (l / x)) + t_1)
    t_4 = t_2 / sqrt(((2.0d0 * (l * (l / x))) + ((2.0d0 + (4.0d0 * (1.0d0 / x))) * (t ** 2.0d0))))
    if (t <= (-2.4d+102)) then
        tmp = -1.0d0
    else if (t <= 7.5d-308) then
        tmp = t_4
    else if (t <= 3.7d-159) then
        tmp = t_3
    else if (t <= 3.7d+21) then
        tmp = t_4
    else
        tmp = t_3
    end if
    code = tmp
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)));
}
public static double code(double x, double l, double t) {
	double t_1 = t * Math.sqrt((2.0 + (4.0 / x)));
	double t_2 = Math.sqrt(2.0) * t;
	double t_3 = t_2 / (((l / t_1) * (l / x)) + t_1);
	double t_4 = t_2 / Math.sqrt(((2.0 * (l * (l / x))) + ((2.0 + (4.0 * (1.0 / x))) * Math.pow(t, 2.0))));
	double tmp;
	if (t <= -2.4e+102) {
		tmp = -1.0;
	} else if (t <= 7.5e-308) {
		tmp = t_4;
	} else if (t <= 3.7e-159) {
		tmp = t_3;
	} else if (t <= 3.7e+21) {
		tmp = t_4;
	} else {
		tmp = t_3;
	}
	return tmp;
}
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)))
def code(x, l, t):
	t_1 = t * math.sqrt((2.0 + (4.0 / x)))
	t_2 = math.sqrt(2.0) * t
	t_3 = t_2 / (((l / t_1) * (l / x)) + t_1)
	t_4 = t_2 / math.sqrt(((2.0 * (l * (l / x))) + ((2.0 + (4.0 * (1.0 / x))) * math.pow(t, 2.0))))
	tmp = 0
	if t <= -2.4e+102:
		tmp = -1.0
	elif t <= 7.5e-308:
		tmp = t_4
	elif t <= 3.7e-159:
		tmp = t_3
	elif t <= 3.7e+21:
		tmp = t_4
	else:
		tmp = t_3
	return tmp
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 code(x, l, t)
	t_1 = Float64(t * sqrt(Float64(2.0 + Float64(4.0 / x))))
	t_2 = Float64(sqrt(2.0) * t)
	t_3 = Float64(t_2 / Float64(Float64(Float64(l / t_1) * Float64(l / x)) + t_1))
	t_4 = Float64(t_2 / sqrt(Float64(Float64(2.0 * Float64(l * Float64(l / x))) + Float64(Float64(2.0 + Float64(4.0 * Float64(1.0 / x))) * (t ^ 2.0)))))
	tmp = 0.0
	if (t <= -2.4e+102)
		tmp = -1.0;
	elseif (t <= 7.5e-308)
		tmp = t_4;
	elseif (t <= 3.7e-159)
		tmp = t_3;
	elseif (t <= 3.7e+21)
		tmp = t_4;
	else
		tmp = t_3;
	end
	return tmp
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
function tmp_2 = code(x, l, t)
	t_1 = t * sqrt((2.0 + (4.0 / x)));
	t_2 = sqrt(2.0) * t;
	t_3 = t_2 / (((l / t_1) * (l / x)) + t_1);
	t_4 = t_2 / sqrt(((2.0 * (l * (l / x))) + ((2.0 + (4.0 * (1.0 / x))) * (t ^ 2.0))));
	tmp = 0.0;
	if (t <= -2.4e+102)
		tmp = -1.0;
	elseif (t <= 7.5e-308)
		tmp = t_4;
	elseif (t <= 3.7e-159)
		tmp = t_3;
	elseif (t <= 3.7e+21)
		tmp = t_4;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
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]
code[x_, l_, t_] := Block[{t$95$1 = N[(t * N[Sqrt[N[(2.0 + N[(4.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(N[(N[(l / t$95$1), $MachinePrecision] * N[(l / x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 / N[Sqrt[N[(N[(2.0 * N[(l * N[(l / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 + N[(4.0 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.4e+102], -1.0, If[LessEqual[t, 7.5e-308], t$95$4, If[LessEqual[t, 3.7e-159], t$95$3, If[LessEqual[t, 3.7e+21], t$95$4, t$95$3]]]]]]]]
\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}}
\begin{array}{l}
t_1 := t \cdot \sqrt{2 + \frac{4}{x}}\\
t_2 := \sqrt{2} \cdot t\\
t_3 := \frac{t_2}{\frac{\ell}{t_1} \cdot \frac{\ell}{x} + t_1}\\
t_4 := \frac{t_2}{\sqrt{2 \cdot \left(\ell \cdot \frac{\ell}{x}\right) + \left(2 + 4 \cdot \frac{1}{x}\right) \cdot {t}^{2}}}\\
\mathbf{if}\;t \leq -2.4 \cdot 10^{+102}:\\
\;\;\;\;-1\\

\mathbf{elif}\;t \leq 7.5 \cdot 10^{-308}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t \leq 3.7 \cdot 10^{-159}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t \leq 3.7 \cdot 10^{+21}:\\
\;\;\;\;t_4\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 3 regimes
  2. if t < -2.39999999999999994e102

    1. Initial program 50.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. Taylor expanded in x around inf 50.4

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(\ell, \ell, 2 \cdot {t}^{2}\right)}{x} + 2 \cdot {t}^{2}\right) + \frac{\mathsf{fma}\left(\ell, \ell, 2 \cdot {t}^{2}\right)}{x}}}} \]
      Proof
    4. Taylor expanded in t around -inf 13.8

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

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

      \[\leadsto \color{blue}{-1} \]

    if -2.39999999999999994e102 < t < 7.4999999999999998e-308 or 3.6999999999999999e-159 < t < 3.7e21

    1. Initial program 35.2

      \[\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. Taylor expanded in x around inf 14.8

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

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(\ell, \ell, 2 \cdot {t}^{2}\right)}{x} + 2 \cdot {t}^{2}\right) + \frac{\mathsf{fma}\left(\ell, \ell, 2 \cdot {t}^{2}\right)}{x}}}} \]
      Proof
    4. Taylor expanded in t around 0 14.8

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{2 \cdot \frac{{\ell}^{2}}{x} + \left(2 + 4 \cdot \frac{1}{x}\right) \cdot {t}^{2}}}} \]
    5. Applied egg-rr10.7

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \color{blue}{\left(\ell \cdot \frac{\ell}{x}\right)} + \left(2 + 4 \cdot \frac{1}{x}\right) \cdot {t}^{2}}} \]

    if 7.4999999999999998e-308 < t < 3.6999999999999999e-159 or 3.7e21 < t

    1. Initial program 47.1

      \[\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. Taylor expanded in x around inf 38.2

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\left(\frac{{\ell}^{2}}{x} + \left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right)\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}}}} \]
    3. Simplified38.2

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\left(\frac{\mathsf{fma}\left(\ell, \ell, 2 \cdot {t}^{2}\right)}{x} + 2 \cdot {t}^{2}\right) + \frac{\mathsf{fma}\left(\ell, \ell, 2 \cdot {t}^{2}\right)}{x}}}} \]
      Proof
    4. Taylor expanded in t around inf 17.5

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\frac{{\ell}^{2}}{t \cdot \left(\sqrt{2 + 4 \cdot \frac{1}{x}} \cdot x\right)} + t \cdot \sqrt{2 + 4 \cdot \frac{1}{x}}}} \]
    5. Simplified17.5

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\frac{{\ell}^{2}}{\left(t \cdot \sqrt{2 + \frac{4}{x}}\right) \cdot x} + t \cdot \sqrt{2 + \frac{4}{x}}}} \]
      Proof
    6. Applied egg-rr10.3

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\frac{\ell}{t \cdot \sqrt{2 + \frac{4}{x}}} \cdot \frac{\ell}{x}} + t \cdot \sqrt{2 + \frac{4}{x}}} \]
  3. Recombined 3 regimes into one program.

Alternatives

Alternative 1
Error10.1
Cost21136
\[\begin{array}{l} t_1 := \sqrt{2} \cdot t\\ t_2 := \frac{t_1}{\sqrt{2 \cdot \left(\ell \cdot \frac{\ell}{x}\right) + \left(2 + 4 \cdot \frac{1}{x}\right) \cdot {t}^{2}}}\\ \mathbf{if}\;t \leq -2.4 \cdot 10^{+102}:\\ \;\;\;\;-1\\ \mathbf{elif}\;t \leq -3.4 \cdot 10^{-258}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{-159}:\\ \;\;\;\;\frac{t_1}{\mathsf{hypot}\left(t, t\right)}\\ \mathbf{elif}\;t \leq 6 \cdot 10^{+143}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 2
Error16.7
Cost14168
\[\begin{array}{l} t_1 := \sqrt{\frac{2}{x}}\\ t_2 := \sqrt{2} \cdot t\\ t_3 := \frac{t_2}{\mathsf{hypot}\left(t, t\right)}\\ t_4 := \frac{t_2}{\ell \cdot t_1}\\ \mathbf{if}\;\ell \leq -2.55 \cdot 10^{+144}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\ell \leq -1.65 \cdot 10^{+49}:\\ \;\;\;\;\frac{t_2}{\left(-\ell\right) \cdot t_1}\\ \mathbf{elif}\;\ell \leq 1.55 \cdot 10^{+127}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+172}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;\ell \leq 7.2 \cdot 10^{+233}:\\ \;\;\;\;\frac{\frac{t}{\mathsf{hypot}\left(t, t\right)}}{\sqrt{0.5}}\\ \mathbf{elif}\;\ell \leq 2.8 \cdot 10^{+281}:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 3
Error15.5
Cost13904
\[\begin{array}{l} t_1 := \sqrt{2} \cdot t\\ t_2 := \frac{t_1}{\ell \cdot \sqrt{\frac{2}{x}}}\\ \mathbf{if}\;\ell \leq 3.8 \cdot 10^{+127}:\\ \;\;\;\;\frac{t_1}{\mathsf{hypot}\left(t, t\right)}\\ \mathbf{elif}\;\ell \leq 5 \cdot 10^{+174}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{+238}:\\ \;\;\;\;\frac{\frac{t}{\mathsf{hypot}\left(t, t\right)}}{\sqrt{0.5}}\\ \mathbf{elif}\;\ell \leq 2.8 \cdot 10^{+281}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 4
Error15.7
Cost13184
\[\frac{\sqrt{2} \cdot t}{\mathsf{hypot}\left(t, t\right)} \]
Alternative 5
Error15.4
Cost196
\[\begin{array}{l} \mathbf{if}\;t \leq -1 \cdot 10^{-310}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 6
Error39.4
Cost64
\[-1 \]

Error

Reproduce?

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