| Alternative 1 | |
|---|---|
| Accuracy | 85.8% |
| Cost | 27720 |

(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 (sqrt x))) (t_2 (+ 2.0 (/ 4.0 x))))
(if (<= t -6.5e-107)
(/ (sqrt 2.0) (* (sqrt (/ (+ x 1.0) (+ x -1.0))) (- (sqrt 2.0))))
(if (<= t 7e-161)
(* t (/ (sqrt 2.0) (hypot (hypot t_1 (* t (sqrt t_2))) t_1)))
(if (<= t 2.9e+55)
(*
t
(/
(sqrt 2.0)
(pow (pow (fma (* t t) t_2 (* 2.0 (/ l (/ x l)))) 0.25) 2.0)))
1.0)))))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 / sqrt(x);
double t_2 = 2.0 + (4.0 / x);
double tmp;
if (t <= -6.5e-107) {
tmp = sqrt(2.0) / (sqrt(((x + 1.0) / (x + -1.0))) * -sqrt(2.0));
} else if (t <= 7e-161) {
tmp = t * (sqrt(2.0) / hypot(hypot(t_1, (t * sqrt(t_2))), t_1));
} else if (t <= 2.9e+55) {
tmp = t * (sqrt(2.0) / pow(pow(fma((t * t), t_2, (2.0 * (l / (x / l)))), 0.25), 2.0));
} else {
tmp = 1.0;
}
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(l / sqrt(x)) t_2 = Float64(2.0 + Float64(4.0 / x)) tmp = 0.0 if (t <= -6.5e-107) tmp = Float64(sqrt(2.0) / Float64(sqrt(Float64(Float64(x + 1.0) / Float64(x + -1.0))) * Float64(-sqrt(2.0)))); elseif (t <= 7e-161) tmp = Float64(t * Float64(sqrt(2.0) / hypot(hypot(t_1, Float64(t * sqrt(t_2))), t_1))); elseif (t <= 2.9e+55) tmp = Float64(t * Float64(sqrt(2.0) / ((fma(Float64(t * t), t_2, Float64(2.0 * Float64(l / Float64(x / l)))) ^ 0.25) ^ 2.0))); else tmp = 1.0; 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[(l / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 + N[(4.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.5e-107], N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e-161], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[Sqrt[t$95$1 ^ 2 + N[(t * N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.9e+55], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Power[N[Power[N[(N[(t * t), $MachinePrecision] * t$95$2 + N[(2.0 * N[(l / N[(x / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.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}}
\begin{array}{l}
t_1 := \frac{\ell}{\sqrt{x}}\\
t_2 := 2 + \frac{4}{x}\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + -1}} \cdot \left(-\sqrt{2}\right)}\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-161}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{\mathsf{hypot}\left(\mathsf{hypot}\left(t_1, t \cdot \sqrt{t_2}\right), t_1\right)}\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{+55}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{{\left({\left(\mathsf{fma}\left(t \cdot t, t_2, 2 \cdot \frac{\ell}{\frac{x}{\ell}}\right)\right)}^{0.25}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if t < -6.5000000000000002e-107Initial program 36.3%
Simplified36.3%
[Start]36.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}}
\] |
|---|---|
associate-/l* [=>]36.3 | \[ \color{blue}{\frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{t}}}
\] |
fma-neg [=>]36.3 | \[ \frac{\sqrt{2}}{\frac{\sqrt{\color{blue}{\mathsf{fma}\left(\frac{x + 1}{x - 1}, \ell \cdot \ell + 2 \cdot \left(t \cdot t\right), -\ell \cdot \ell\right)}}}{t}}
\] |
remove-double-neg [<=]36.3 | \[ \frac{\sqrt{2}}{\frac{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x - 1}, \color{blue}{-\left(-\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right)\right)}, -\ell \cdot \ell\right)}}{t}}
\] |
fma-neg [<=]36.3 | \[ \frac{\sqrt{2}}{\frac{\sqrt{\color{blue}{\frac{x + 1}{x - 1} \cdot \left(-\left(-\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right)\right)\right) - \ell \cdot \ell}}}{t}}
\] |
sub-neg [=>]36.3 | \[ \frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}} \cdot \left(-\left(-\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right)\right)\right) - \ell \cdot \ell}}{t}}
\] |
metadata-eval [=>]36.3 | \[ \frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + \color{blue}{-1}} \cdot \left(-\left(-\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right)\right)\right) - \ell \cdot \ell}}{t}}
\] |
remove-double-neg [=>]36.3 | \[ \frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \color{blue}{\left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right)} - \ell \cdot \ell}}{t}}
\] |
fma-def [=>]36.3 | \[ \frac{\sqrt{2}}{\frac{\sqrt{\frac{x + 1}{x + -1} \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell, 2 \cdot \left(t \cdot t\right)\right)} - \ell \cdot \ell}}{t}}
\] |
Taylor expanded in t around -inf 91.7%
Simplified91.7%
[Start]91.7 | \[ \frac{\sqrt{2}}{-1 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}
\] |
|---|---|
mul-1-neg [=>]91.7 | \[ \frac{\sqrt{2}}{\color{blue}{-\sqrt{2} \cdot \sqrt{\frac{1 + x}{x - 1}}}}
\] |
*-commutative [=>]91.7 | \[ \frac{\sqrt{2}}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot \sqrt{2}}}
\] |
distribute-rgt-neg-in [=>]91.7 | \[ \frac{\sqrt{2}}{\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot \left(-\sqrt{2}\right)}}
\] |
+-commutative [=>]91.7 | \[ \frac{\sqrt{2}}{\sqrt{\frac{\color{blue}{x + 1}}{x - 1}} \cdot \left(-\sqrt{2}\right)}
\] |
sub-neg [=>]91.7 | \[ \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}} \cdot \left(-\sqrt{2}\right)}
\] |
metadata-eval [=>]91.7 | \[ \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{x + \color{blue}{-1}}} \cdot \left(-\sqrt{2}\right)}
\] |
+-commutative [=>]91.7 | \[ \frac{\sqrt{2}}{\sqrt{\frac{x + 1}{\color{blue}{-1 + x}}} \cdot \left(-\sqrt{2}\right)}
\] |
if -6.5000000000000002e-107 < t < 7.00000000000000039e-161Initial program 7.4%
Simplified7.4%
[Start]7.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/ [<=]7.4 | \[ \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 56.1%
Simplified56.1%
[Start]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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}}} \cdot t
\] |
|---|---|
associate--l+ [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}}} \cdot t
\] |
unpow2 [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
distribute-lft-out [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
unpow2 [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
unpow2 [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
mul-1-neg [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
unpow2 [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
+-commutative [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
unpow2 [=>]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
fma-udef [<=]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
Applied egg-rr56.0%
[Start]56.1 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
|---|---|
add-sqr-sqrt [=>]55.9 | \[ \frac{\sqrt{2}}{\color{blue}{\sqrt{\sqrt{\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)}} \cdot \sqrt{\sqrt{\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)}}}} \cdot t
\] |
pow2 [=>]55.9 | \[ \frac{\sqrt{2}}{\color{blue}{{\left(\sqrt{\sqrt{\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)}}\right)}^{2}}} \cdot t
\] |
Taylor expanded in t around 0 56.0%
Simplified61.3%
[Start]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \left(\left(2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}\right) \cdot {t}^{2} + \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
|---|---|
*-commutative [<=]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \left(\color{blue}{{t}^{2} \cdot \left(2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}\right)} + \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
fma-def [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \color{blue}{\mathsf{fma}\left({t}^{2}, 2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}, \frac{{\ell}^{2}}{x}\right)}\right)}^{0.25}\right)}^{2}} \cdot t
\] |
unpow2 [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(\color{blue}{t \cdot t}, 2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}, \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
distribute-lft-in [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, \color{blue}{\left(2 \cdot 1 + 2 \cdot \frac{1}{x}\right)} + 2 \cdot \frac{1}{x}, \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
metadata-eval [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, \left(\color{blue}{2} + 2 \cdot \frac{1}{x}\right) + 2 \cdot \frac{1}{x}, \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-+l+ [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, \color{blue}{2 + \left(2 \cdot \frac{1}{x} + 2 \cdot \frac{1}{x}\right)}, \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-*r/ [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\color{blue}{\frac{2 \cdot 1}{x}} + 2 \cdot \frac{1}{x}\right), \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
metadata-eval [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{\color{blue}{2}}{x} + 2 \cdot \frac{1}{x}\right), \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-*r/ [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \color{blue}{\frac{2 \cdot 1}{x}}\right), \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
metadata-eval [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{\color{blue}{2}}{x}\right), \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
unpow2 [=>]56.0 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\color{blue}{\ell \cdot \ell}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-/l* [=>]61.3 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \color{blue}{\frac{\ell}{\frac{x}{\ell}}}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
Applied egg-rr86.0%
[Start]61.3 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
|---|---|
pow-pow [=>]61.5 | \[ \frac{\sqrt{2}}{\color{blue}{{\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)\right)}^{\left(0.25 \cdot 2\right)}}} \cdot t
\] |
metadata-eval [=>]61.5 | \[ \frac{\sqrt{2}}{{\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)\right)}^{\color{blue}{0.5}}} \cdot t
\] |
pow1/2 [<=]61.5 | \[ \frac{\sqrt{2}}{\color{blue}{\sqrt{\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)}}} \cdot t
\] |
+-commutative [=>]61.5 | \[ \frac{\sqrt{2}}{\sqrt{\color{blue}{\mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right) + \frac{\ell}{x} \cdot \ell}}} \cdot t
\] |
add-sqr-sqrt [=>]61.4 | \[ \frac{\sqrt{2}}{\sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)} \cdot \sqrt{\mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)}} + \frac{\ell}{x} \cdot \ell}} \cdot t
\] |
add-sqr-sqrt [=>]61.4 | \[ \frac{\sqrt{2}}{\sqrt{\sqrt{\mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)} \cdot \sqrt{\mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)} + \color{blue}{\sqrt{\frac{\ell}{x} \cdot \ell} \cdot \sqrt{\frac{\ell}{x} \cdot \ell}}}} \cdot t
\] |
hypot-def [=>]61.3 | \[ \frac{\sqrt{2}}{\color{blue}{\mathsf{hypot}\left(\sqrt{\mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\ell}{\frac{x}{\ell}}\right)}, \sqrt{\frac{\ell}{x} \cdot \ell}\right)}} \cdot t
\] |
if 7.00000000000000039e-161 < t < 2.8999999999999999e55Initial program 59.8%
Simplified60.1%
[Start]59.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/ [<=]60.1 | \[ \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 79.7%
Simplified79.7%
[Start]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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}}} \cdot t
\] |
|---|---|
associate--l+ [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}}} \cdot t
\] |
unpow2 [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
distribute-lft-out [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
unpow2 [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
unpow2 [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
mul-1-neg [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
unpow2 [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
+-commutative [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
unpow2 [=>]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
fma-udef [<=]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
Applied egg-rr79.2%
[Start]79.7 | \[ \frac{\sqrt{2}}{\sqrt{\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)}} \cdot t
\] |
|---|---|
add-sqr-sqrt [=>]79.2 | \[ \frac{\sqrt{2}}{\color{blue}{\sqrt{\sqrt{\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)}} \cdot \sqrt{\sqrt{\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)}}}} \cdot t
\] |
pow2 [=>]79.2 | \[ \frac{\sqrt{2}}{\color{blue}{{\left(\sqrt{\sqrt{\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)}}\right)}^{2}}} \cdot t
\] |
Taylor expanded in t around 0 79.2%
Simplified87.4%
[Start]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \left(\left(2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}\right) \cdot {t}^{2} + \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
|---|---|
*-commutative [<=]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \left(\color{blue}{{t}^{2} \cdot \left(2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}\right)} + \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
fma-def [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \color{blue}{\mathsf{fma}\left({t}^{2}, 2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}, \frac{{\ell}^{2}}{x}\right)}\right)}^{0.25}\right)}^{2}} \cdot t
\] |
unpow2 [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(\color{blue}{t \cdot t}, 2 \cdot \left(1 + \frac{1}{x}\right) + 2 \cdot \frac{1}{x}, \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
distribute-lft-in [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, \color{blue}{\left(2 \cdot 1 + 2 \cdot \frac{1}{x}\right)} + 2 \cdot \frac{1}{x}, \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
metadata-eval [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, \left(\color{blue}{2} + 2 \cdot \frac{1}{x}\right) + 2 \cdot \frac{1}{x}, \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-+l+ [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, \color{blue}{2 + \left(2 \cdot \frac{1}{x} + 2 \cdot \frac{1}{x}\right)}, \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-*r/ [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\color{blue}{\frac{2 \cdot 1}{x}} + 2 \cdot \frac{1}{x}\right), \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
metadata-eval [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{\color{blue}{2}}{x} + 2 \cdot \frac{1}{x}\right), \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-*r/ [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \color{blue}{\frac{2 \cdot 1}{x}}\right), \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
metadata-eval [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{\color{blue}{2}}{x}\right), \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
unpow2 [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \frac{\color{blue}{\ell \cdot \ell}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-/l* [=>]87.4 | \[ \frac{\sqrt{2}}{{\left({\left(\frac{\ell}{x} \cdot \ell + \mathsf{fma}\left(t \cdot t, 2 + \left(\frac{2}{x} + \frac{2}{x}\right), \color{blue}{\frac{\ell}{\frac{x}{\ell}}}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
Taylor expanded in l around 0 79.2%
Simplified87.4%
[Start]79.2 | \[ \frac{\sqrt{2}}{{\left({\left({t}^{2} \cdot \left(2 + 4 \cdot \frac{1}{x}\right) + 2 \cdot \frac{{\ell}^{2}}{x}\right)}^{0.25}\right)}^{2}} \cdot t
\] |
|---|---|
fma-def [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\color{blue}{\left(\mathsf{fma}\left({t}^{2}, 2 + 4 \cdot \frac{1}{x}, 2 \cdot \frac{{\ell}^{2}}{x}\right)\right)}}^{0.25}\right)}^{2}} \cdot t
\] |
unpow2 [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\mathsf{fma}\left(\color{blue}{t \cdot t}, 2 + 4 \cdot \frac{1}{x}, 2 \cdot \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-*r/ [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\mathsf{fma}\left(t \cdot t, 2 + \color{blue}{\frac{4 \cdot 1}{x}}, 2 \cdot \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
metadata-eval [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\mathsf{fma}\left(t \cdot t, 2 + \frac{\color{blue}{4}}{x}, 2 \cdot \frac{{\ell}^{2}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
unpow2 [=>]79.2 | \[ \frac{\sqrt{2}}{{\left({\left(\mathsf{fma}\left(t \cdot t, 2 + \frac{4}{x}, 2 \cdot \frac{\color{blue}{\ell \cdot \ell}}{x}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
associate-/l* [=>]87.4 | \[ \frac{\sqrt{2}}{{\left({\left(\mathsf{fma}\left(t \cdot t, 2 + \frac{4}{x}, 2 \cdot \color{blue}{\frac{\ell}{\frac{x}{\ell}}}\right)\right)}^{0.25}\right)}^{2}} \cdot t
\] |
if 2.8999999999999999e55 < t Initial program 35.6%
Simplified35.6%
[Start]35.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}}
\] |
|---|---|
associate-*l/ [<=]35.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}
\] |
Taylor expanded in x around inf 94.4%
Applied egg-rr95.9%
[Start]94.4 | \[ \sqrt{2} \cdot \sqrt{0.5}
\] |
|---|---|
sqrt-unprod [=>]95.9 | \[ \color{blue}{\sqrt{2 \cdot 0.5}}
\] |
metadata-eval [=>]95.9 | \[ \sqrt{\color{blue}{1}}
\] |
metadata-eval [=>]95.9 | \[ \color{blue}{1}
\] |
Final simplification90.3%
| Alternative 1 | |
|---|---|
| Accuracy | 85.8% |
| Cost | 27720 |
| Alternative 2 | |
|---|---|
| Accuracy | 85.8% |
| Cost | 27473 |
| Alternative 3 | |
|---|---|
| Accuracy | 80.3% |
| Cost | 21712 |
| Alternative 4 | |
|---|---|
| Accuracy | 80.1% |
| Cost | 20100 |
| Alternative 5 | |
|---|---|
| Accuracy | 80.0% |
| Cost | 15056 |
| Alternative 6 | |
|---|---|
| Accuracy | 77.7% |
| Cost | 7368 |
| Alternative 7 | |
|---|---|
| Accuracy | 78.0% |
| Cost | 7368 |
| Alternative 8 | |
|---|---|
| Accuracy | 78.6% |
| Cost | 7368 |
| Alternative 9 | |
|---|---|
| Accuracy | 76.6% |
| Cost | 7180 |
| Alternative 10 | |
|---|---|
| Accuracy | 76.2% |
| Cost | 6984 |
| Alternative 11 | |
|---|---|
| Accuracy | 77.0% |
| Cost | 6984 |
| Alternative 12 | |
|---|---|
| Accuracy | 75.9% |
| Cost | 1348 |
| Alternative 13 | |
|---|---|
| Accuracy | 75.8% |
| Cost | 836 |
| Alternative 14 | |
|---|---|
| Accuracy | 75.4% |
| Cost | 196 |
| Alternative 15 | |
|---|---|
| Accuracy | 37.4% |
| Cost | 64 |
herbie shell --seed 2023161
(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)))))