| Alternative 1 | |
|---|---|
| Accuracy | 81.6% |
| Cost | 69128 |

(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 (* 2.0 (+ (* t t) (/ (* t t) x))))
(t_2 (/ (* l l) x))
(t_3 (fma (* t 2.0) t (* l l)))
(t_4 (/ t_3 x)))
(if (<= t -1.3e+72)
(+ (/ 1.0 x) -1.0)
(if (<= t -5.6e-150)
(*
t
(/
(sqrt 2.0)
(sqrt
(+
t_2
(+
(fma
2.0
(/ (* t t) (pow x 3.0))
(+ (+ t_1 (/ (* l l) (pow x 3.0))) (/ (+ t_3 t_3) (* x x))))
(+ (/ t_3 (pow x 3.0)) t_4))))))
(if (<= t -1.42e-198)
-1.0
(if (<= t 9e-17)
(* t (/ (sqrt 2.0) (sqrt (+ t_2 (+ t_1 t_4)))))
(+ 1.0 (/ -1.0 x))))))))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 = 2.0 * ((t * t) + ((t * t) / x));
double t_2 = (l * l) / x;
double t_3 = fma((t * 2.0), t, (l * l));
double t_4 = t_3 / x;
double tmp;
if (t <= -1.3e+72) {
tmp = (1.0 / x) + -1.0;
} else if (t <= -5.6e-150) {
tmp = t * (sqrt(2.0) / sqrt((t_2 + (fma(2.0, ((t * t) / pow(x, 3.0)), ((t_1 + ((l * l) / pow(x, 3.0))) + ((t_3 + t_3) / (x * x)))) + ((t_3 / pow(x, 3.0)) + t_4)))));
} else if (t <= -1.42e-198) {
tmp = -1.0;
} else if (t <= 9e-17) {
tmp = t * (sqrt(2.0) / sqrt((t_2 + (t_1 + t_4))));
} else {
tmp = 1.0 + (-1.0 / x);
}
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(2.0 * Float64(Float64(t * t) + Float64(Float64(t * t) / x))) t_2 = Float64(Float64(l * l) / x) t_3 = fma(Float64(t * 2.0), t, Float64(l * l)) t_4 = Float64(t_3 / x) tmp = 0.0 if (t <= -1.3e+72) tmp = Float64(Float64(1.0 / x) + -1.0); elseif (t <= -5.6e-150) tmp = Float64(t * Float64(sqrt(2.0) / sqrt(Float64(t_2 + Float64(fma(2.0, Float64(Float64(t * t) / (x ^ 3.0)), Float64(Float64(t_1 + Float64(Float64(l * l) / (x ^ 3.0))) + Float64(Float64(t_3 + t_3) / Float64(x * x)))) + Float64(Float64(t_3 / (x ^ 3.0)) + t_4)))))); elseif (t <= -1.42e-198) tmp = -1.0; elseif (t <= 9e-17) tmp = Float64(t * Float64(sqrt(2.0) / sqrt(Float64(t_2 + Float64(t_1 + t_4))))); else tmp = Float64(1.0 + Float64(-1.0 / x)); 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[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(l * l), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t * 2.0), $MachinePrecision] * t + N[(l * l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 / x), $MachinePrecision]}, If[LessEqual[t, -1.3e+72], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[t, -5.6e-150], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(N[(2.0 * N[(N[(t * t), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 + N[(N[(l * l), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$3 + t$95$3), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$3 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.42e-198], -1.0, If[LessEqual[t, 9e-17], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[(t$95$1 + t$95$4), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\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 := 2 \cdot \left(t \cdot t + \frac{t \cdot t}{x}\right)\\
t_2 := \frac{\ell \cdot \ell}{x}\\
t_3 := \mathsf{fma}\left(t \cdot 2, t, \ell \cdot \ell\right)\\
t_4 := \frac{t_3}{x}\\
\mathbf{if}\;t \leq -1.3 \cdot 10^{+72}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{elif}\;t \leq -5.6 \cdot 10^{-150}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{\sqrt{t_2 + \left(\mathsf{fma}\left(2, \frac{t \cdot t}{{x}^{3}}, \left(t_1 + \frac{\ell \cdot \ell}{{x}^{3}}\right) + \frac{t_3 + t_3}{x \cdot x}\right) + \left(\frac{t_3}{{x}^{3}} + t_4\right)\right)}}\\
\mathbf{elif}\;t \leq -1.42 \cdot 10^{-198}:\\
\;\;\;\;-1\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-17}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{\sqrt{t_2 + \left(t_1 + t_4\right)}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if t < -1.29999999999999991e72Initial program 27.0%
Simplified27.0%
[Start]27.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-*r/ [<=]27.0% | \[ \color{blue}{\sqrt{2} \cdot \frac{t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}}
\] |
fma-neg [=>]27.0% | \[ \sqrt{2} \cdot \frac{t}{\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)}}}
\] |
sub-neg [=>]27.0% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{\color{blue}{x + \left(-1\right)}}, \ell \cdot \ell + 2 \cdot \left(t \cdot t\right), -\ell \cdot \ell\right)}}
\] |
metadata-eval [=>]27.0% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + \color{blue}{-1}}, \ell \cdot \ell + 2 \cdot \left(t \cdot t\right), -\ell \cdot \ell\right)}}
\] |
+-commutative [=>]27.0% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \color{blue}{2 \cdot \left(t \cdot t\right) + \ell \cdot \ell}, -\ell \cdot \ell\right)}}
\] |
fma-def [=>]27.0% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \color{blue}{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}, -\ell \cdot \ell\right)}}
\] |
distribute-rgt-neg-in [=>]27.0% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \color{blue}{\ell \cdot \left(-\ell\right)}\right)}}
\] |
Taylor expanded in t around -inf 92.6%
Simplified92.6%
[Start]92.6% | \[ \sqrt{2} \cdot \frac{t}{-1 \cdot \left(\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}
\] |
|---|---|
associate-*r* [=>]92.6% | \[ \sqrt{2} \cdot \frac{t}{\color{blue}{\left(-1 \cdot \left(\sqrt{2} \cdot t\right)\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}}
\] |
*-commutative [=>]92.6% | \[ \sqrt{2} \cdot \frac{t}{\left(-1 \cdot \color{blue}{\left(t \cdot \sqrt{2}\right)}\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}
\] |
neg-mul-1 [<=]92.6% | \[ \sqrt{2} \cdot \frac{t}{\color{blue}{\left(-t \cdot \sqrt{2}\right)} \cdot \sqrt{\frac{1 + x}{x - 1}}}
\] |
distribute-rgt-neg-in [=>]92.6% | \[ \sqrt{2} \cdot \frac{t}{\color{blue}{\left(t \cdot \left(-\sqrt{2}\right)\right)} \cdot \sqrt{\frac{1 + x}{x - 1}}}
\] |
+-commutative [<=]92.6% | \[ \sqrt{2} \cdot \frac{t}{\left(t \cdot \left(-\sqrt{2}\right)\right) \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}}
\] |
sub-neg [=>]92.6% | \[ \sqrt{2} \cdot \frac{t}{\left(t \cdot \left(-\sqrt{2}\right)\right) \cdot \sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}}}
\] |
metadata-eval [=>]92.6% | \[ \sqrt{2} \cdot \frac{t}{\left(t \cdot \left(-\sqrt{2}\right)\right) \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}}
\] |
+-commutative [=>]92.6% | \[ \sqrt{2} \cdot \frac{t}{\left(t \cdot \left(-\sqrt{2}\right)\right) \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}}
\] |
Taylor expanded in x around inf 92.7%
if -1.29999999999999991e72 < t < -5.59999999999999993e-150Initial program 55.1%
Simplified55.3%
[Start]55.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}}
\] |
|---|---|
associate-*l/ [<=]55.3% | \[ \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 88.7%
Simplified88.7%
[Start]88.7% | \[ \frac{\sqrt{2}}{\sqrt{\left(\frac{{\ell}^{2}}{x} + \left(2 \cdot \frac{{t}^{2}}{{x}^{3}} + \left(-1 \cdot \frac{-1 \cdot \left({\ell}^{2} + 2 \cdot {t}^{2}\right) - \left({\ell}^{2} + 2 \cdot {t}^{2}\right)}{{x}^{2}} + \left(\frac{{\ell}^{2}}{{x}^{3}} + \left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right)\right)\right) - \left(-1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{{x}^{3}} + -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)}} \cdot t
\] |
|---|---|
associate--l+ [=>]88.7% | \[ \frac{\sqrt{2}}{\sqrt{\color{blue}{\frac{{\ell}^{2}}{x} + \left(\left(2 \cdot \frac{{t}^{2}}{{x}^{3}} + \left(-1 \cdot \frac{-1 \cdot \left({\ell}^{2} + 2 \cdot {t}^{2}\right) - \left({\ell}^{2} + 2 \cdot {t}^{2}\right)}{{x}^{2}} + \left(\frac{{\ell}^{2}}{{x}^{3}} + \left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right)\right) - \left(-1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{{x}^{3}} + -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)\right)}}} \cdot t
\] |
unpow2 [=>]88.7% | \[ \frac{\sqrt{2}}{\sqrt{\frac{\color{blue}{\ell \cdot \ell}}{x} + \left(\left(2 \cdot \frac{{t}^{2}}{{x}^{3}} + \left(-1 \cdot \frac{-1 \cdot \left({\ell}^{2} + 2 \cdot {t}^{2}\right) - \left({\ell}^{2} + 2 \cdot {t}^{2}\right)}{{x}^{2}} + \left(\frac{{\ell}^{2}}{{x}^{3}} + \left(2 \cdot \frac{{t}^{2}}{x} + 2 \cdot {t}^{2}\right)\right)\right)\right) - \left(-1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{{x}^{3}} + -1 \cdot \frac{{\ell}^{2} + 2 \cdot {t}^{2}}{x}\right)\right)}} \cdot t
\] |
if -5.59999999999999993e-150 < t < -1.42000000000000001e-198Initial program 30.0%
Simplified30.1%
[Start]30.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-*r/ [<=]30.1% | \[ \color{blue}{\sqrt{2} \cdot \frac{t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}}
\] |
fma-neg [=>]30.1% | \[ \sqrt{2} \cdot \frac{t}{\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)}}}
\] |
sub-neg [=>]30.1% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{\color{blue}{x + \left(-1\right)}}, \ell \cdot \ell + 2 \cdot \left(t \cdot t\right), -\ell \cdot \ell\right)}}
\] |
metadata-eval [=>]30.1% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + \color{blue}{-1}}, \ell \cdot \ell + 2 \cdot \left(t \cdot t\right), -\ell \cdot \ell\right)}}
\] |
+-commutative [=>]30.1% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \color{blue}{2 \cdot \left(t \cdot t\right) + \ell \cdot \ell}, -\ell \cdot \ell\right)}}
\] |
fma-def [=>]30.1% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \color{blue}{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}, -\ell \cdot \ell\right)}}
\] |
distribute-rgt-neg-in [=>]30.1% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \color{blue}{\ell \cdot \left(-\ell\right)}\right)}}
\] |
Taylor expanded in t around -inf 99.3%
Simplified99.3%
[Start]99.3% | \[ \sqrt{2} \cdot \frac{t}{-1 \cdot \left(\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}
\] |
|---|---|
associate-*r* [=>]99.3% | \[ \sqrt{2} \cdot \frac{t}{\color{blue}{\left(-1 \cdot \left(\sqrt{2} \cdot t\right)\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}}
\] |
*-commutative [=>]99.3% | \[ \sqrt{2} \cdot \frac{t}{\left(-1 \cdot \color{blue}{\left(t \cdot \sqrt{2}\right)}\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}
\] |
neg-mul-1 [<=]99.3% | \[ \sqrt{2} \cdot \frac{t}{\color{blue}{\left(-t \cdot \sqrt{2}\right)} \cdot \sqrt{\frac{1 + x}{x - 1}}}
\] |
distribute-rgt-neg-in [=>]99.3% | \[ \sqrt{2} \cdot \frac{t}{\color{blue}{\left(t \cdot \left(-\sqrt{2}\right)\right)} \cdot \sqrt{\frac{1 + x}{x - 1}}}
\] |
+-commutative [<=]99.3% | \[ \sqrt{2} \cdot \frac{t}{\left(t \cdot \left(-\sqrt{2}\right)\right) \cdot \sqrt{\frac{\color{blue}{x + 1}}{x - 1}}}
\] |
sub-neg [=>]99.3% | \[ \sqrt{2} \cdot \frac{t}{\left(t \cdot \left(-\sqrt{2}\right)\right) \cdot \sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}}}
\] |
metadata-eval [=>]99.3% | \[ \sqrt{2} \cdot \frac{t}{\left(t \cdot \left(-\sqrt{2}\right)\right) \cdot \sqrt{\frac{x + 1}{x + \color{blue}{-1}}}}
\] |
+-commutative [=>]99.3% | \[ \sqrt{2} \cdot \frac{t}{\left(t \cdot \left(-\sqrt{2}\right)\right) \cdot \sqrt{\frac{x + 1}{\color{blue}{-1 + x}}}}
\] |
Taylor expanded in x around inf 100.0%
if -1.42000000000000001e-198 < t < 8.99999999999999957e-17Initial program 19.1%
Simplified19.1%
[Start]19.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}}
\] |
|---|---|
associate-*l/ [<=]19.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 69.1%
Simplified69.1%
[Start]69.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+ [=>]69.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 [=>]69.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 [=>]69.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 [=>]69.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 [=>]69.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
\] |
associate-*r/ [=>]69.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}{\frac{-1 \cdot \left({\ell}^{2} + 2 \cdot {t}^{2}\right)}{x}}\right)}} \cdot t
\] |
mul-1-neg [=>]69.1% | \[ \frac{\sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \frac{\color{blue}{-\left({\ell}^{2} + 2 \cdot {t}^{2}\right)}}{x}\right)}} \cdot t
\] |
+-commutative [=>]69.1% | \[ \frac{\sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \frac{-\color{blue}{\left(2 \cdot {t}^{2} + {\ell}^{2}\right)}}{x}\right)}} \cdot t
\] |
unpow2 [=>]69.1% | \[ \frac{\sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \frac{-\left(2 \cdot \color{blue}{\left(t \cdot t\right)} + {\ell}^{2}\right)}{x}\right)}} \cdot t
\] |
associate-*l* [<=]69.1% | \[ \frac{\sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \frac{-\left(\color{blue}{\left(2 \cdot t\right) \cdot t} + {\ell}^{2}\right)}{x}\right)}} \cdot t
\] |
unpow2 [=>]69.1% | \[ \frac{\sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \frac{-\left(\left(2 \cdot t\right) \cdot t + \color{blue}{\ell \cdot \ell}\right)}{x}\right)}} \cdot t
\] |
fma-udef [<=]69.1% | \[ \frac{\sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(\frac{t \cdot t}{x} + t \cdot t\right) - \frac{-\color{blue}{\mathsf{fma}\left(2 \cdot t, t, \ell \cdot \ell\right)}}{x}\right)}} \cdot t
\] |
if 8.99999999999999957e-17 < t Initial program 34.7%
Simplified34.6%
[Start]34.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}}
\] |
|---|---|
associate-*r/ [<=]34.6% | \[ \color{blue}{\sqrt{2} \cdot \frac{t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}}
\] |
fma-neg [=>]34.6% | \[ \sqrt{2} \cdot \frac{t}{\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)}}}
\] |
sub-neg [=>]34.6% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{\color{blue}{x + \left(-1\right)}}, \ell \cdot \ell + 2 \cdot \left(t \cdot t\right), -\ell \cdot \ell\right)}}
\] |
metadata-eval [=>]34.6% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + \color{blue}{-1}}, \ell \cdot \ell + 2 \cdot \left(t \cdot t\right), -\ell \cdot \ell\right)}}
\] |
+-commutative [=>]34.6% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \color{blue}{2 \cdot \left(t \cdot t\right) + \ell \cdot \ell}, -\ell \cdot \ell\right)}}
\] |
fma-def [=>]34.6% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \color{blue}{\mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}, -\ell \cdot \ell\right)}}
\] |
distribute-rgt-neg-in [=>]34.6% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \color{blue}{\ell \cdot \left(-\ell\right)}\right)}}
\] |
Applied egg-rr80.6%
[Start]34.6% | \[ \sqrt{2} \cdot \frac{t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}
\] |
|---|---|
associate-*r/ [=>]34.7% | \[ \color{blue}{\frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + -1}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}}
\] |
metadata-eval [<=]34.7% | \[ \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x + \color{blue}{\left(-1\right)}}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}
\] |
sub-neg [<=]34.7% | \[ \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{\color{blue}{x - 1}}, \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right), \ell \cdot \left(-\ell\right)\right)}}
\] |
fma-udef [=>]34.7% | \[ \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x - 1}, \color{blue}{2 \cdot \left(t \cdot t\right) + \ell \cdot \ell}, \ell \cdot \left(-\ell\right)\right)}}
\] |
+-commutative [<=]34.7% | \[ \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x - 1}, \color{blue}{\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)}, \ell \cdot \left(-\ell\right)\right)}}
\] |
distribute-rgt-neg-out [=>]34.7% | \[ \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(\frac{x + 1}{x - 1}, \ell \cdot \ell + 2 \cdot \left(t \cdot t\right), \color{blue}{-\ell \cdot \ell}\right)}}
\] |
fma-neg [<=]34.7% | \[ \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}}
\] |
clear-num [=>]34.7% | \[ \color{blue}{\frac{1}{\frac{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}{\sqrt{2} \cdot t}}}
\] |
Taylor expanded in l around 0 92.4%
Simplified92.4%
[Start]92.4% | \[ \frac{1}{\sqrt{\frac{1 + x}{x - 1}}}
\] |
|---|---|
+-commutative [=>]92.4% | \[ \frac{1}{\sqrt{\frac{\color{blue}{x + 1}}{x - 1}}}
\] |
sub-neg [=>]92.4% | \[ \frac{1}{\sqrt{\frac{x + 1}{\color{blue}{x + \left(-1\right)}}}}
\] |
metadata-eval [=>]92.4% | \[ \frac{1}{\sqrt{\frac{x + 1}{x + \color{blue}{-1}}}}
\] |
Taylor expanded in x around inf 92.4%
Final simplification85.3%
| Alternative 1 | |
|---|---|
| Accuracy | 81.6% |
| Cost | 69128 |
| Alternative 2 | |
|---|---|
| Accuracy | 81.6% |
| Cost | 35528 |
| Alternative 3 | |
|---|---|
| Accuracy | 81.6% |
| Cost | 21712 |
| Alternative 4 | |
|---|---|
| Accuracy | 76.5% |
| Cost | 13896 |
| Alternative 5 | |
|---|---|
| Accuracy | 76.0% |
| Cost | 836 |
| Alternative 6 | |
|---|---|
| Accuracy | 75.6% |
| Cost | 452 |
| Alternative 7 | |
|---|---|
| Accuracy | 75.9% |
| Cost | 452 |
| Alternative 8 | |
|---|---|
| Accuracy | 75.2% |
| Cost | 196 |
| Alternative 9 | |
|---|---|
| Accuracy | 38.2% |
| Cost | 64 |
herbie shell --seed 2023165
(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)))))