| Alternative 1 | |
|---|---|
| Accuracy | 81.3% |
| Cost | 15176 |

(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 (/ (* l l) x))
(t_2 (sqrt (/ (+ -1.0 x) (+ x 1.0))))
(t_3 (- t_2))
(t_4 (* 2.0 (+ (* t t) (/ (* t t) x))))
(t_5 (+ 2.0 (+ (/ 2.0 x) (/ 2.0 x)))))
(if (<= t -8.5e-37)
t_3
(if (<= t -1.8e-167)
(/
t
(sqrt (/ (+ t_1 (+ t_4 (* (fma 2.0 (* t t) (* l l)) (/ 1.0 x)))) 2.0)))
(if (<= t -5.9e-282)
t_3
(if (<= t 5.5e-164)
(*
t
(/
(sqrt 2.0)
(fma t (sqrt t_5) (* (sqrt (/ 1.0 t_5)) (* (/ l x) (/ l t))))))
(if (<= t 2e+16) (/ t (sqrt (/ (+ t_1 (+ t_1 t_4)) 2.0))) t_2)))))))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 = (l * l) / x;
double t_2 = sqrt(((-1.0 + x) / (x + 1.0)));
double t_3 = -t_2;
double t_4 = 2.0 * ((t * t) + ((t * t) / x));
double t_5 = 2.0 + ((2.0 / x) + (2.0 / x));
double tmp;
if (t <= -8.5e-37) {
tmp = t_3;
} else if (t <= -1.8e-167) {
tmp = t / sqrt(((t_1 + (t_4 + (fma(2.0, (t * t), (l * l)) * (1.0 / x)))) / 2.0));
} else if (t <= -5.9e-282) {
tmp = t_3;
} else if (t <= 5.5e-164) {
tmp = t * (sqrt(2.0) / fma(t, sqrt(t_5), (sqrt((1.0 / t_5)) * ((l / x) * (l / t)))));
} else if (t <= 2e+16) {
tmp = t / sqrt(((t_1 + (t_1 + t_4)) / 2.0));
} else {
tmp = t_2;
}
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(Float64(l * l) / x) t_2 = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))) t_3 = Float64(-t_2) t_4 = Float64(2.0 * Float64(Float64(t * t) + Float64(Float64(t * t) / x))) t_5 = Float64(2.0 + Float64(Float64(2.0 / x) + Float64(2.0 / x))) tmp = 0.0 if (t <= -8.5e-37) tmp = t_3; elseif (t <= -1.8e-167) tmp = Float64(t / sqrt(Float64(Float64(t_1 + Float64(t_4 + Float64(fma(2.0, Float64(t * t), Float64(l * l)) * Float64(1.0 / x)))) / 2.0))); elseif (t <= -5.9e-282) tmp = t_3; elseif (t <= 5.5e-164) tmp = Float64(t * Float64(sqrt(2.0) / fma(t, sqrt(t_5), Float64(sqrt(Float64(1.0 / t_5)) * Float64(Float64(l / x) * Float64(l / t)))))); elseif (t <= 2e+16) tmp = Float64(t / sqrt(Float64(Float64(t_1 + Float64(t_1 + t_4)) / 2.0))); else tmp = t_2; end return 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[(N[(l * l), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = (-t$95$2)}, Block[{t$95$4 = N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(2.0 + N[(N[(2.0 / x), $MachinePrecision] + N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8.5e-37], t$95$3, If[LessEqual[t, -1.8e-167], N[(t / N[Sqrt[N[(N[(t$95$1 + N[(t$95$4 + N[(N[(2.0 * N[(t * t), $MachinePrecision] + N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -5.9e-282], t$95$3, If[LessEqual[t, 5.5e-164], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[(t * N[Sqrt[t$95$5], $MachinePrecision] + N[(N[Sqrt[N[(1.0 / t$95$5), $MachinePrecision]], $MachinePrecision] * N[(N[(l / x), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e+16], N[(t / N[Sqrt[N[(N[(t$95$1 + N[(t$95$1 + t$95$4), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$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}}
\begin{array}{l}
t_1 := \frac{\ell \cdot \ell}{x}\\
t_2 := \sqrt{\frac{-1 + x}{x + 1}}\\
t_3 := -t_2\\
t_4 := 2 \cdot \left(t \cdot t + \frac{t \cdot t}{x}\right)\\
t_5 := 2 + \left(\frac{2}{x} + \frac{2}{x}\right)\\
\mathbf{if}\;t \leq -8.5 \cdot 10^{-37}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\sqrt{\frac{t_1 + \left(t_4 + \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) \cdot \frac{1}{x}\right)}{2}}}\\
\mathbf{elif}\;t \leq -5.9 \cdot 10^{-282}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-164}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{\mathsf{fma}\left(t, \sqrt{t_5}, \sqrt{\frac{1}{t_5}} \cdot \left(\frac{\ell}{x} \cdot \frac{\ell}{t}\right)\right)}\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\frac{t}{\sqrt{\frac{t_1 + \left(t_1 + t_4\right)}{2}}}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if t < -8.5000000000000007e-37 or -1.8e-167 < t < -5.8999999999999997e-282Initial program 40.0%
Simplified39.9%
[Start]40.0 | \[ \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}}
\] |
|---|---|
associate-*l/ [<=]39.9 | \[ \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \cdot t}
\] |
Applied egg-rr40.1%
[Start]39.9 | \[ \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}} \cdot t
\] |
|---|---|
*-commutative [=>]39.9 | \[ \color{blue}{t \cdot \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}}
\] |
clear-num [=>]39.9 | \[ t \cdot \color{blue}{\frac{1}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}{\sqrt{2}}}}
\] |
un-div-inv [=>]39.9 | \[ \color{blue}{\frac{t}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}{\sqrt{2}}}}
\] |
sqrt-undiv [=>]40.1 | \[ \frac{t}{\color{blue}{\sqrt{\frac{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}{2}}}}
\] |
Taylor expanded in t around -inf 88.2%
Simplified88.2%
[Start]88.2 | \[ -1 \cdot \sqrt{\frac{x - 1}{1 + x}}
\] |
|---|---|
mul-1-neg [=>]88.2 | \[ \color{blue}{-\sqrt{\frac{x - 1}{1 + x}}}
\] |
+-commutative [<=]88.2 | \[ -\sqrt{\frac{x - 1}{\color{blue}{x + 1}}}
\] |
sub-neg [=>]88.2 | \[ -\sqrt{\frac{\color{blue}{x + \left(-1\right)}}{x + 1}}
\] |
metadata-eval [=>]88.2 | \[ -\sqrt{\frac{x + \color{blue}{-1}}{x + 1}}
\] |
+-commutative [=>]88.2 | \[ -\sqrt{\frac{\color{blue}{-1 + x}}{x + 1}}
\] |
if -8.5000000000000007e-37 < t < -1.8e-167Initial program 52.8%
Simplified52.9%
[Start]52.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}}
\] |
|---|---|
associate-*l/ [<=]52.9 | \[ \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \cdot t}
\] |
Applied egg-rr53.1%
[Start]52.9 | \[ \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}} \cdot t
\] |
|---|---|
*-commutative [=>]52.9 | \[ \color{blue}{t \cdot \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}}
\] |
clear-num [=>]52.8 | \[ t \cdot \color{blue}{\frac{1}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}{\sqrt{2}}}}
\] |
un-div-inv [=>]52.9 | \[ \color{blue}{\frac{t}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}{\sqrt{2}}}}
\] |
sqrt-undiv [=>]53.1 | \[ \frac{t}{\color{blue}{\sqrt{\frac{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}{2}}}}
\] |
Taylor expanded in x around inf 86.3%
Simplified86.3%
[Start]86.3 | \[ \frac{t}{\sqrt{\frac{\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}}{2}}}
\] |
|---|---|
associate--l+ [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\color{blue}{\frac{{\ell}^{2}}{x} + \left(\left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}}{2}}}
\] |
unpow2 [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\color{blue}{\ell \cdot \ell}}{x} + \left(\left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
distribute-lft-out [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(\color{blue}{2 \cdot \left(\frac{{t}^{2}}{x} + {t}^{2}\right)} - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
unpow2 [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{\color{blue}{t \cdot t}}{x} + {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
unpow2 [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + \color{blue}{t \cdot t}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
mul-1-neg [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \color{blue}{\left(-\frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}\right)}{2}}}
\] |
unpow2 [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{\ell \cdot \ell} + 2 \cdot {t}^{2}}{x}\right)\right)}{2}}}
\] |
+-commutative [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{2 \cdot {t}^{2} + \ell \cdot \ell}}{x}\right)\right)}{2}}}
\] |
unpow2 [=>]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{2 \cdot \color{blue}{\left(t \cdot t\right)} + \ell \cdot \ell}{x}\right)\right)}{2}}}
\] |
fma-udef [<=]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}}{x}\right)\right)}{2}}}
\] |
Applied egg-rr86.4%
[Start]86.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}{x}\right)\right)}{2}}}
\] |
|---|---|
div-inv [=>]86.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\color{blue}{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) \cdot \frac{1}{x}}\right)\right)}{2}}}
\] |
if -5.8999999999999997e-282 < t < 5.50000000000000027e-164Initial program 6.5%
Simplified6.5%
[Start]6.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}}
\] |
|---|---|
associate-*l/ [<=]6.5 | \[ \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \cdot t}
\] |
Taylor expanded in x around inf 26.2%
Simplified26.2%
[Start]26.3 | \[ \frac{t}{\sqrt{\frac{\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}}{2}}}
\] |
|---|---|
associate--l+ [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\color{blue}{\frac{{\ell}^{2}}{x} + \left(\left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}}{2}}}
\] |
unpow2 [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\color{blue}{\ell \cdot \ell}}{x} + \left(\left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
distribute-lft-out [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(\color{blue}{2 \cdot \left(\frac{{t}^{2}}{x} + {t}^{2}\right)} - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
unpow2 [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{\color{blue}{t \cdot t}}{x} + {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
unpow2 [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + \color{blue}{t \cdot t}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
mul-1-neg [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \color{blue}{\left(-\frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}\right)}{2}}}
\] |
unpow2 [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{\ell \cdot \ell} + 2 \cdot {t}^{2}}{x}\right)\right)}{2}}}
\] |
+-commutative [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{2 \cdot {t}^{2} + \ell \cdot \ell}}{x}\right)\right)}{2}}}
\] |
unpow2 [=>]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{2 \cdot \color{blue}{\left(t \cdot t\right)} + \ell \cdot \ell}{x}\right)\right)}{2}}}
\] |
fma-udef [<=]26.3 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}}{x}\right)\right)}{2}}}
\] |
Taylor expanded in t around inf 69.8%
Simplified69.8%
[Start]69.8 | \[ \frac{\sqrt{2}}{\sqrt{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}} \cdot t + \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}} \cdot t
\] |
|---|---|
*-commutative [<=]69.8 | \[ \frac{\sqrt{2}}{\color{blue}{t \cdot \sqrt{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} + \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}} \cdot t
\] |
fma-def [=>]69.8 | \[ \frac{\sqrt{2}}{\color{blue}{\mathsf{fma}\left(t, \sqrt{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}, \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}\right)}} \cdot t
\] |
distribute-lft-in [=>]69.8 | \[ \frac{\sqrt{2}}{\mathsf{fma}\left(t, \sqrt{\color{blue}{\left(2 \cdot 1 + 2 \cdot \frac{1}{x}\right)} + 2 \cdot \frac{1}{x}}, \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}\right)} \cdot t
\] |
metadata-eval [=>]69.8 | \[ \frac{\sqrt{2}}{\mathsf{fma}\left(t, \sqrt{\left(\color{blue}{2} + 2 \cdot \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}, \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}\right)} \cdot t
\] |
associate-+l+ [=>]69.8 | \[ \frac{\sqrt{2}}{\mathsf{fma}\left(t, \sqrt{\color{blue}{2 + \left(2 \cdot \frac{1}{x} + 2 \cdot \frac{1}{x}\right)}}, \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}\right)} \cdot t
\] |
associate-*r/ [=>]69.8 | \[ \frac{\sqrt{2}}{\mathsf{fma}\left(t, \sqrt{2 + \left(\color{blue}{\frac{2 \cdot 1}{x}} + 2 \cdot \frac{1}{x}\right)}, \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}\right)} \cdot t
\] |
metadata-eval [=>]69.8 | \[ \frac{\sqrt{2}}{\mathsf{fma}\left(t, \sqrt{2 + \left(\frac{\color{blue}{2}}{x} + 2 \cdot \frac{1}{x}\right)}, \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}\right)} \cdot t
\] |
associate-*r/ [=>]69.8 | \[ \frac{\sqrt{2}}{\mathsf{fma}\left(t, \sqrt{2 + \left(\frac{2}{x} + \color{blue}{\frac{2 \cdot 1}{x}}\right)}, \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}\right)} \cdot t
\] |
metadata-eval [=>]69.8 | \[ \frac{\sqrt{2}}{\mathsf{fma}\left(t, \sqrt{2 + \left(\frac{2}{x} + \frac{\color{blue}{2}}{x}\right)}, \sqrt{\frac{1}{2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}}} \cdot \frac{{\ell}^{2}}{t \cdot x}\right)} \cdot t
\] |
if 5.50000000000000027e-164 < t < 2e16Initial program 42.4%
Simplified42.6%
[Start]42.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}}
\] |
|---|---|
associate-*l/ [<=]42.6 | \[ \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \cdot t}
\] |
Applied egg-rr42.7%
[Start]42.6 | \[ \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}} \cdot t
\] |
|---|---|
*-commutative [=>]42.6 | \[ \color{blue}{t \cdot \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}}
\] |
clear-num [=>]42.6 | \[ t \cdot \color{blue}{\frac{1}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}{\sqrt{2}}}}
\] |
un-div-inv [=>]42.5 | \[ \color{blue}{\frac{t}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}{\sqrt{2}}}}
\] |
sqrt-undiv [=>]42.7 | \[ \frac{t}{\color{blue}{\sqrt{\frac{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}{2}}}}
\] |
Taylor expanded in x around inf 81.4%
Simplified81.4%
[Start]81.4 | \[ \frac{t}{\sqrt{\frac{\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}}{2}}}
\] |
|---|---|
associate--l+ [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\color{blue}{\frac{{\ell}^{2}}{x} + \left(\left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}}{2}}}
\] |
unpow2 [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\color{blue}{\ell \cdot \ell}}{x} + \left(\left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
distribute-lft-out [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(\color{blue}{2 \cdot \left(\frac{{t}^{2}}{x} + {t}^{2}\right)} - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
unpow2 [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{\color{blue}{t \cdot t}}{x} + {t}^{2}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
unpow2 [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + \color{blue}{t \cdot t}\right) - -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}{2}}}
\] |
mul-1-neg [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \color{blue}{\left(-\frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}\right)}{2}}}
\] |
unpow2 [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{\ell \cdot \ell} + 2 \cdot {t}^{2}}{x}\right)\right)}{2}}}
\] |
+-commutative [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{2 \cdot {t}^{2} + \ell \cdot \ell}}{x}\right)\right)}{2}}}
\] |
unpow2 [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{2 \cdot \color{blue}{\left(t \cdot t\right)} + \ell \cdot \ell}{x}\right)\right)}{2}}}
\] |
fma-udef [<=]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}}{x}\right)\right)}{2}}}
\] |
Taylor expanded in t around 0 81.4%
Simplified81.4%
[Start]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{{\ell}^{2}}{x}\right)\right)}{2}}}
\] |
|---|---|
unpow2 [=>]81.4 | \[ \frac{t}{\sqrt{\frac{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \left(-\frac{\color{blue}{\ell \cdot \ell}}{x}\right)\right)}{2}}}
\] |
if 2e16 < t Initial program 26.4%
Simplified26.5%
[Start]26.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}}
\] |
|---|---|
associate-*l/ [<=]26.5 | \[ \color{blue}{\frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}} \cdot t}
\] |
Applied egg-rr26.7%
[Start]26.5 | \[ \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}} \cdot t
\] |
|---|---|
*-commutative [=>]26.5 | \[ \color{blue}{t \cdot \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}}
\] |
clear-num [=>]26.5 | \[ t \cdot \color{blue}{\frac{1}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}{\sqrt{2}}}}
\] |
un-div-inv [=>]26.5 | \[ \color{blue}{\frac{t}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}}{\sqrt{2}}}}
\] |
sqrt-undiv [=>]26.7 | \[ \frac{t}{\color{blue}{\sqrt{\frac{\frac{x + 1}{x + -1} \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right) - \ell \cdot \ell}{2}}}}
\] |
Taylor expanded in t around inf 93.7%
Final simplification86.4%
| Alternative 1 | |
|---|---|
| Accuracy | 81.3% |
| Cost | 15176 |
| Alternative 2 | |
|---|---|
| Accuracy | 81.3% |
| Cost | 15048 |
| Alternative 3 | |
|---|---|
| Accuracy | 81.2% |
| Cost | 8788 |
| Alternative 4 | |
|---|---|
| Accuracy | 81.2% |
| Cost | 8788 |
| Alternative 5 | |
|---|---|
| Accuracy | 77.1% |
| Cost | 7044 |
| Alternative 6 | |
|---|---|
| Accuracy | 76.9% |
| Cost | 6980 |
| Alternative 7 | |
|---|---|
| Accuracy | 76.5% |
| Cost | 836 |
| Alternative 8 | |
|---|---|
| Accuracy | 76.6% |
| Cost | 836 |
| Alternative 9 | |
|---|---|
| Accuracy | 76.1% |
| Cost | 452 |
| Alternative 10 | |
|---|---|
| Accuracy | 76.4% |
| Cost | 452 |
| Alternative 11 | |
|---|---|
| Accuracy | 75.8% |
| Cost | 196 |
| Alternative 12 | |
|---|---|
| Accuracy | 38.8% |
| Cost | 64 |
herbie shell --seed 2023162
(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)))))