| Alternative 1 | |
|---|---|
| Error | 7.4 |
| Cost | 27788 |
(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 (/ 4.0 x)))
(t_2 (fma t (+ t (/ t x)) (* l (/ l x))))
(t_3 (* t (sqrt 2.0)))
(t_4 (+ 1.0 (/ 2.0 x))))
(if (<= t -1.8141869063142166e+21)
(/ t_3 (* t_3 (- (sqrt (/ (+ x 1.0) (+ x -1.0))))))
(if (<= t -1.6e-164)
(/ t_3 (* (sqrt 2.0) (sqrt t_2)))
(if (<= t -3.2e-271)
(/
t_3
(-
(fma
t
(sqrt (* 2.0 t_4))
(* (sqrt (/ 0.5 t_4)) (/ (* l (/ l t)) x)))))
(if (<= t 3.6e-266)
(/ t_3 (fabs (* l (sqrt (/ 2.0 x)))))
(if (<= t 4.2e-163)
(/
t_3
(+ (* (* l (/ (/ l t) x)) (sqrt (/ 1.0 t_1))) (* t (sqrt t_1))))
(if (<= t 4.299023181944863e+110)
(pow (sqrt (* t (/ (sqrt 2.0) (sqrt (* 2.0 t_2))))) 2.0)
(sqrt (* 2.0 (/ (* 0.5 (+ x -1.0)) (+ x 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 = 2.0 + (4.0 / x);
double t_2 = fma(t, (t + (t / x)), (l * (l / x)));
double t_3 = t * sqrt(2.0);
double t_4 = 1.0 + (2.0 / x);
double tmp;
if (t <= -1.8141869063142166e+21) {
tmp = t_3 / (t_3 * -sqrt(((x + 1.0) / (x + -1.0))));
} else if (t <= -1.6e-164) {
tmp = t_3 / (sqrt(2.0) * sqrt(t_2));
} else if (t <= -3.2e-271) {
tmp = t_3 / -fma(t, sqrt((2.0 * t_4)), (sqrt((0.5 / t_4)) * ((l * (l / t)) / x)));
} else if (t <= 3.6e-266) {
tmp = t_3 / fabs((l * sqrt((2.0 / x))));
} else if (t <= 4.2e-163) {
tmp = t_3 / (((l * ((l / t) / x)) * sqrt((1.0 / t_1))) + (t * sqrt(t_1)));
} else if (t <= 4.299023181944863e+110) {
tmp = pow(sqrt((t * (sqrt(2.0) / sqrt((2.0 * t_2))))), 2.0);
} else {
tmp = sqrt((2.0 * ((0.5 * (x + -1.0)) / (x + 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(2.0 + Float64(4.0 / x)) t_2 = fma(t, Float64(t + Float64(t / x)), Float64(l * Float64(l / x))) t_3 = Float64(t * sqrt(2.0)) t_4 = Float64(1.0 + Float64(2.0 / x)) tmp = 0.0 if (t <= -1.8141869063142166e+21) tmp = Float64(t_3 / Float64(t_3 * Float64(-sqrt(Float64(Float64(x + 1.0) / Float64(x + -1.0)))))); elseif (t <= -1.6e-164) tmp = Float64(t_3 / Float64(sqrt(2.0) * sqrt(t_2))); elseif (t <= -3.2e-271) tmp = Float64(t_3 / Float64(-fma(t, sqrt(Float64(2.0 * t_4)), Float64(sqrt(Float64(0.5 / t_4)) * Float64(Float64(l * Float64(l / t)) / x))))); elseif (t <= 3.6e-266) tmp = Float64(t_3 / abs(Float64(l * sqrt(Float64(2.0 / x))))); elseif (t <= 4.2e-163) tmp = Float64(t_3 / Float64(Float64(Float64(l * Float64(Float64(l / t) / x)) * sqrt(Float64(1.0 / t_1))) + Float64(t * sqrt(t_1)))); elseif (t <= 4.299023181944863e+110) tmp = sqrt(Float64(t * Float64(sqrt(2.0) / sqrt(Float64(2.0 * t_2))))) ^ 2.0; else tmp = sqrt(Float64(2.0 * Float64(Float64(0.5 * Float64(x + -1.0)) / Float64(x + 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[(2.0 + N[(4.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(t + N[(t / x), $MachinePrecision]), $MachinePrecision] + N[(l * N[(l / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 + N[(2.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.8141869063142166e+21], N[(t$95$3 / N[(t$95$3 * (-N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.6e-164], N[(t$95$3 / N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.2e-271], N[(t$95$3 / (-N[(t * N[Sqrt[N[(2.0 * t$95$4), $MachinePrecision]], $MachinePrecision] + N[(N[Sqrt[N[(0.5 / t$95$4), $MachinePrecision]], $MachinePrecision] * N[(N[(l * N[(l / t), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[t, 3.6e-266], N[(t$95$3 / N[Abs[N[(l * N[Sqrt[N[(2.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.2e-163], N[(t$95$3 / N[(N[(N[(l * N[(N[(l / t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.299023181944863e+110], N[Power[N[Sqrt[N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(2.0 * t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision], N[Sqrt[N[(2.0 * N[(N[(0.5 * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $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 + \frac{4}{x}\\
t_2 := \mathsf{fma}\left(t, t + \frac{t}{x}, \ell \cdot \frac{\ell}{x}\right)\\
t_3 := t \cdot \sqrt{2}\\
t_4 := 1 + \frac{2}{x}\\
\mathbf{if}\;t \leq -1.8141869063142166 \cdot 10^{+21}:\\
\;\;\;\;\frac{t_3}{t_3 \cdot \left(-\sqrt{\frac{x + 1}{x + -1}}\right)}\\
\mathbf{elif}\;t \leq -1.6 \cdot 10^{-164}:\\
\;\;\;\;\frac{t_3}{\sqrt{2} \cdot \sqrt{t_2}}\\
\mathbf{elif}\;t \leq -3.2 \cdot 10^{-271}:\\
\;\;\;\;\frac{t_3}{-\mathsf{fma}\left(t, \sqrt{2 \cdot t_4}, \sqrt{\frac{0.5}{t_4}} \cdot \frac{\ell \cdot \frac{\ell}{t}}{x}\right)}\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-266}:\\
\;\;\;\;\frac{t_3}{\left|\ell \cdot \sqrt{\frac{2}{x}}\right|}\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{-163}:\\
\;\;\;\;\frac{t_3}{\left(\ell \cdot \frac{\frac{\ell}{t}}{x}\right) \cdot \sqrt{\frac{1}{t_1}} + t \cdot \sqrt{t_1}}\\
\mathbf{elif}\;t \leq 4.299023181944863 \cdot 10^{+110}:\\
\;\;\;\;{\left(\sqrt{t \cdot \frac{\sqrt{2}}{\sqrt{2 \cdot t_2}}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \frac{0.5 \cdot \left(x + -1\right)}{x + 1}}\\
\end{array}
if t < -1.8141869063142166e21Initial program 42.8
Taylor expanded in t around -inf 4.5
Simplified4.5
if -1.8141869063142166e21 < t < -1.6e-164Initial program 32.0
Taylor expanded in x around inf 10.9
Simplified10.9
Taylor expanded in t around 0 11.2
Simplified5.5
Taylor expanded in l around 0 11.2
Simplified5.5
Applied egg-rr5.2
if -1.6e-164 < t < -3.19999999999999978e-271Initial program 62.7
Taylor expanded in x around inf 36.1
Simplified36.1
Taylor expanded in t around -inf 23.0
Simplified22.9
if -3.19999999999999978e-271 < t < 3.5999999999999999e-266Initial program 63.0
Taylor expanded in x around inf 30.6
Simplified30.6
Taylor expanded in t around 0 30.6
Simplified30.4
Taylor expanded in l around inf 30.6
Simplified30.6
Applied egg-rr18.8
if 3.5999999999999999e-266 < t < 4.19999999999999996e-163Initial program 63.4
Taylor expanded in x around inf 34.5
Simplified34.5
Taylor expanded in t around inf 23.2
Simplified23.1
Applied egg-rr23.1
if 4.19999999999999996e-163 < t < 4.2990231819448629e110Initial program 26.2
Taylor expanded in x around inf 9.8
Simplified9.8
Taylor expanded in t around 0 10.2
Simplified5.4
Taylor expanded in l around 0 10.2
Simplified5.4
Applied egg-rr5.2
if 4.2990231819448629e110 < t Initial program 53.2
Taylor expanded in t around -inf 63.0
Simplified63.0
Applied egg-rr2.3
Final simplification7.5
| Alternative 1 | |
|---|---|
| Error | 7.4 |
| Cost | 27788 |
| Alternative 2 | |
|---|---|
| Error | 8.2 |
| Cost | 27480 |
| Alternative 3 | |
|---|---|
| Error | 8.4 |
| Cost | 26828 |
| Alternative 4 | |
|---|---|
| Error | 8.4 |
| Cost | 21588 |
| Alternative 5 | |
|---|---|
| Error | 9.3 |
| Cost | 21144 |
| Alternative 6 | |
|---|---|
| Error | 9.3 |
| Cost | 21144 |
| Alternative 7 | |
|---|---|
| Error | 9.3 |
| Cost | 20820 |
| Alternative 8 | |
|---|---|
| Error | 9.3 |
| Cost | 20820 |
| Alternative 9 | |
|---|---|
| Error | 8.7 |
| Cost | 20304 |
| Alternative 10 | |
|---|---|
| Error | 9.8 |
| Cost | 14808 |
| Alternative 11 | |
|---|---|
| Error | 14.6 |
| Cost | 14684 |
| Alternative 12 | |
|---|---|
| Error | 14.7 |
| Cost | 14032 |
| Alternative 13 | |
|---|---|
| Error | 14.1 |
| Cost | 13768 |
| Alternative 14 | |
|---|---|
| Error | 14.8 |
| Cost | 7368 |
| Alternative 15 | |
|---|---|
| Error | 14.6 |
| Cost | 7368 |
| Alternative 16 | |
|---|---|
| Error | 14.9 |
| Cost | 7112 |
| Alternative 17 | |
|---|---|
| Error | 15.2 |
| Cost | 7048 |
| Alternative 18 | |
|---|---|
| Error | 14.9 |
| Cost | 6984 |
| Alternative 19 | |
|---|---|
| Error | 15.5 |
| Cost | 452 |
| Alternative 20 | |
|---|---|
| Error | 15.7 |
| Cost | 196 |
| Alternative 21 | |
|---|---|
| Error | 39.3 |
| Cost | 64 |

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