| Alternative 1 | |
|---|---|
| Error | 7.2 |
| Cost | 26768 |
(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)))
(t_2 (sqrt (/ (+ x 1.0) (+ x -1.0))))
(t_3 (/ t_1 (* t_2 (* t (- (sqrt 2.0)))))))
(if (<= t -1.3682754575575214e+144)
t_3
(if (<= t -1.2e-164)
(/ t_1 (sqrt (* 2.0 (+ (/ l (/ x l)) (* t t)))))
(if (<= t -3.2e-201)
t_3
(if (<= t 1.55e-252)
(/ t_1 (* (sqrt 2.0) (hypot t (/ l (sqrt x)))))
(if (<= t 9.5e-178)
(/
t_1
(fma (sqrt 2.0) t (* (/ (sqrt 2.0) (/ (/ t l) l)) (/ 0.5 x))))
(if (<= t 1.301854491159175e+143)
(/ t_1 (sqrt (* 2.0 (+ (* t t) (* l (/ l x))))))
(/ t_1 (* t_1 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 = t * sqrt(2.0);
double t_2 = sqrt(((x + 1.0) / (x + -1.0)));
double t_3 = t_1 / (t_2 * (t * -sqrt(2.0)));
double tmp;
if (t <= -1.3682754575575214e+144) {
tmp = t_3;
} else if (t <= -1.2e-164) {
tmp = t_1 / sqrt((2.0 * ((l / (x / l)) + (t * t))));
} else if (t <= -3.2e-201) {
tmp = t_3;
} else if (t <= 1.55e-252) {
tmp = t_1 / (sqrt(2.0) * hypot(t, (l / sqrt(x))));
} else if (t <= 9.5e-178) {
tmp = t_1 / fma(sqrt(2.0), t, ((sqrt(2.0) / ((t / l) / l)) * (0.5 / x)));
} else if (t <= 1.301854491159175e+143) {
tmp = t_1 / sqrt((2.0 * ((t * t) + (l * (l / x)))));
} else {
tmp = t_1 / (t_1 * 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(t * sqrt(2.0)) t_2 = sqrt(Float64(Float64(x + 1.0) / Float64(x + -1.0))) t_3 = Float64(t_1 / Float64(t_2 * Float64(t * Float64(-sqrt(2.0))))) tmp = 0.0 if (t <= -1.3682754575575214e+144) tmp = t_3; elseif (t <= -1.2e-164) tmp = Float64(t_1 / sqrt(Float64(2.0 * Float64(Float64(l / Float64(x / l)) + Float64(t * t))))); elseif (t <= -3.2e-201) tmp = t_3; elseif (t <= 1.55e-252) tmp = Float64(t_1 / Float64(sqrt(2.0) * hypot(t, Float64(l / sqrt(x))))); elseif (t <= 9.5e-178) tmp = Float64(t_1 / fma(sqrt(2.0), t, Float64(Float64(sqrt(2.0) / Float64(Float64(t / l) / l)) * Float64(0.5 / x)))); elseif (t <= 1.301854491159175e+143) tmp = Float64(t_1 / sqrt(Float64(2.0 * Float64(Float64(t * t) + Float64(l * Float64(l / x)))))); else tmp = Float64(t_1 / Float64(t_1 * 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[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / N[(t$95$2 * N[(t * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.3682754575575214e+144], t$95$3, If[LessEqual[t, -1.2e-164], N[(t$95$1 / N[Sqrt[N[(2.0 * N[(N[(l / N[(x / l), $MachinePrecision]), $MachinePrecision] + N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.2e-201], t$95$3, If[LessEqual[t, 1.55e-252], N[(t$95$1 / N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[t ^ 2 + N[(l / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e-178], N[(t$95$1 / N[(N[Sqrt[2.0], $MachinePrecision] * t + N[(N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.301854491159175e+143], N[(t$95$1 / N[Sqrt[N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(l * N[(l / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(t$95$1 * t$95$2), $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 := t \cdot \sqrt{2}\\
t_2 := \sqrt{\frac{x + 1}{x + -1}}\\
t_3 := \frac{t_1}{t_2 \cdot \left(t \cdot \left(-\sqrt{2}\right)\right)}\\
\mathbf{if}\;t \leq -1.3682754575575214 \cdot 10^{+144}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq -1.2 \cdot 10^{-164}:\\
\;\;\;\;\frac{t_1}{\sqrt{2 \cdot \left(\frac{\ell}{\frac{x}{\ell}} + t \cdot t\right)}}\\
\mathbf{elif}\;t \leq -3.2 \cdot 10^{-201}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{-252}:\\
\;\;\;\;\frac{t_1}{\sqrt{2} \cdot \mathsf{hypot}\left(t, \frac{\ell}{\sqrt{x}}\right)}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{-178}:\\
\;\;\;\;\frac{t_1}{\mathsf{fma}\left(\sqrt{2}, t, \frac{\sqrt{2}}{\frac{\frac{t}{\ell}}{\ell}} \cdot \frac{0.5}{x}\right)}\\
\mathbf{elif}\;t \leq 1.301854491159175 \cdot 10^{+143}:\\
\;\;\;\;\frac{t_1}{\sqrt{2 \cdot \left(t \cdot t + \ell \cdot \frac{\ell}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{t_1 \cdot t_2}\\
\end{array}
if t < -1.36827545755752137e144 or -1.19999999999999992e-164 < t < -3.2000000000000001e-201Initial program 59.9
Taylor expanded in t around -inf 5.1
Simplified5.1
if -1.36827545755752137e144 < t < -1.19999999999999992e-164Initial program 24.5
Applied egg-rr30.5
Taylor expanded in x around -inf 25.1
Simplified11.0
Taylor expanded in t around 0 11.4
Simplified6.0
Applied egg-rr6.0
if -3.2000000000000001e-201 < t < 1.5499999999999999e-252Initial program 63.0
Applied egg-rr60.8
Taylor expanded in x around -inf 63.0
Simplified32.0
Taylor expanded in t around 0 32.0
Simplified30.8
Applied egg-rr11.6
if 1.5499999999999999e-252 < t < 9.50000000000000009e-178Initial program 63.0
Applied egg-rr62.2
Taylor expanded in x around -inf 63.1
Simplified34.7
Taylor expanded in t around 0 34.7
Simplified32.7
Taylor expanded in l around 0 22.5
Simplified22.3
if 9.50000000000000009e-178 < t < 1.301854491159175e143Initial program 26.3
Applied egg-rr32.4
Taylor expanded in x around -inf 26.8
Simplified11.7
Taylor expanded in t around 0 12.1
Simplified7.1
if 1.301854491159175e143 < t Initial program 59.3
Taylor expanded in l around 0 1.5
Final simplification6.7
| Alternative 1 | |
|---|---|
| Error | 7.2 |
| Cost | 26768 |
| Alternative 2 | |
|---|---|
| Error | 9.2 |
| Cost | 20952 |
| Alternative 3 | |
|---|---|
| Error | 9.5 |
| Cost | 20688 |
| Alternative 4 | |
|---|---|
| Error | 9.6 |
| Cost | 20560 |
| Alternative 5 | |
|---|---|
| Error | 9.6 |
| Cost | 20100 |
| Alternative 6 | |
|---|---|
| Error | 9.5 |
| Cost | 14288 |
| Alternative 7 | |
|---|---|
| Error | 9.5 |
| Cost | 14288 |
| Alternative 8 | |
|---|---|
| Error | 9.5 |
| Cost | 14288 |
| Alternative 9 | |
|---|---|
| Error | 14.6 |
| Cost | 13768 |
| Alternative 10 | |
|---|---|
| Error | 14.5 |
| Cost | 13768 |
| Alternative 11 | |
|---|---|
| Error | 14.2 |
| Cost | 13768 |
| Alternative 12 | |
|---|---|
| Error | 14.0 |
| Cost | 13768 |
| Alternative 13 | |
|---|---|
| Error | 14.7 |
| Cost | 13444 |
| Alternative 14 | |
|---|---|
| Error | 15.0 |
| Cost | 13188 |
| Alternative 15 | |
|---|---|
| Error | 34.3 |
| Cost | 7180 |
| Alternative 16 | |
|---|---|
| Error | 34.3 |
| Cost | 7180 |
| Alternative 17 | |
|---|---|
| Error | 34.3 |
| Cost | 7180 |
| Alternative 18 | |
|---|---|
| Error | 35.2 |
| Cost | 6852 |
| Alternative 19 | |
|---|---|
| Error | 34.6 |
| Cost | 6852 |
| Alternative 20 | |
|---|---|
| Error | 38.9 |
| Cost | 64 |
herbie shell --seed 2022310
(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)))))