| Alternative 1 | |
|---|---|
| Error | 9.0 |
| Cost | 40208 |
(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 (* t (sqrt 2.0)))
(t_3 (* t (* t 2.0)))
(t_4 (cbrt (fma l l t_3)))
(t_5 (+ 1.0 (/ 2.0 x)))
(t_6 (sqrt (* 2.0 t_5)))
(t_7 (sqrt (* 2.0 (+ (* t (+ t (/ t x))) t_1)))))
(if (<= t -1.1292640349786462e+46)
(/ t_2 (- (fma t t_6 (* (sqrt (/ 0.5 t_5)) (/ (* l (/ l t)) x)))))
(if (<= t -8.6e-151)
(/ t_2 t_7)
(if (<= t -2.1e-184)
(/ t_2 (* t_6 (- t)))
(if (<= t -1e-190)
(/
t_2
(sqrt
(+
(/ l (/ x l))
(fma
2.0
(+ (/ t (/ x t)) (* t t))
(* (pow t_4 2.0) (* t_4 (/ 1.0 x)))))))
(if (<= t 5.4e-272)
(/ t_2 (sqrt (* 2.0 t_1)))
(if (<= t 4.5e-150)
(*
(sqrt 2.0)
(/
t
(fma
t
(sqrt 2.0)
(*
(/ 0.5 (sqrt 2.0))
(/ (* 2.0 (fma 2.0 (* t t) (* l l))) (* t x))))))
(if (<= t 2.2960935021905734e+108)
(/ (sqrt t_3) t_7)
(sqrt (/ (+ x -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 = l * (l / x);
double t_2 = t * sqrt(2.0);
double t_3 = t * (t * 2.0);
double t_4 = cbrt(fma(l, l, t_3));
double t_5 = 1.0 + (2.0 / x);
double t_6 = sqrt((2.0 * t_5));
double t_7 = sqrt((2.0 * ((t * (t + (t / x))) + t_1)));
double tmp;
if (t <= -1.1292640349786462e+46) {
tmp = t_2 / -fma(t, t_6, (sqrt((0.5 / t_5)) * ((l * (l / t)) / x)));
} else if (t <= -8.6e-151) {
tmp = t_2 / t_7;
} else if (t <= -2.1e-184) {
tmp = t_2 / (t_6 * -t);
} else if (t <= -1e-190) {
tmp = t_2 / sqrt(((l / (x / l)) + fma(2.0, ((t / (x / t)) + (t * t)), (pow(t_4, 2.0) * (t_4 * (1.0 / x))))));
} else if (t <= 5.4e-272) {
tmp = t_2 / sqrt((2.0 * t_1));
} else if (t <= 4.5e-150) {
tmp = sqrt(2.0) * (t / fma(t, sqrt(2.0), ((0.5 / sqrt(2.0)) * ((2.0 * fma(2.0, (t * t), (l * l))) / (t * x)))));
} else if (t <= 2.2960935021905734e+108) {
tmp = sqrt(t_3) / t_7;
} else {
tmp = sqrt(((x + -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(l * Float64(l / x)) t_2 = Float64(t * sqrt(2.0)) t_3 = Float64(t * Float64(t * 2.0)) t_4 = cbrt(fma(l, l, t_3)) t_5 = Float64(1.0 + Float64(2.0 / x)) t_6 = sqrt(Float64(2.0 * t_5)) t_7 = sqrt(Float64(2.0 * Float64(Float64(t * Float64(t + Float64(t / x))) + t_1))) tmp = 0.0 if (t <= -1.1292640349786462e+46) tmp = Float64(t_2 / Float64(-fma(t, t_6, Float64(sqrt(Float64(0.5 / t_5)) * Float64(Float64(l * Float64(l / t)) / x))))); elseif (t <= -8.6e-151) tmp = Float64(t_2 / t_7); elseif (t <= -2.1e-184) tmp = Float64(t_2 / Float64(t_6 * Float64(-t))); elseif (t <= -1e-190) tmp = Float64(t_2 / sqrt(Float64(Float64(l / Float64(x / l)) + fma(2.0, Float64(Float64(t / Float64(x / t)) + Float64(t * t)), Float64((t_4 ^ 2.0) * Float64(t_4 * Float64(1.0 / x))))))); elseif (t <= 5.4e-272) tmp = Float64(t_2 / sqrt(Float64(2.0 * t_1))); elseif (t <= 4.5e-150) tmp = Float64(sqrt(2.0) * Float64(t / fma(t, sqrt(2.0), Float64(Float64(0.5 / sqrt(2.0)) * Float64(Float64(2.0 * fma(2.0, Float64(t * t), Float64(l * l))) / Float64(t * x)))))); elseif (t <= 2.2960935021905734e+108) tmp = Float64(sqrt(t_3) / t_7); else tmp = sqrt(Float64(Float64(x + -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[(l * N[(l / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t * N[(t * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(l * l + t$95$3), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$5 = N[(1.0 + N[(2.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[N[(2.0 * t$95$5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[N[(2.0 * N[(N[(t * N[(t + N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.1292640349786462e+46], N[(t$95$2 / (-N[(t * t$95$6 + N[(N[Sqrt[N[(0.5 / t$95$5), $MachinePrecision]], $MachinePrecision] * N[(N[(l * N[(l / t), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[t, -8.6e-151], N[(t$95$2 / t$95$7), $MachinePrecision], If[LessEqual[t, -2.1e-184], N[(t$95$2 / N[(t$95$6 * (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1e-190], N[(t$95$2 / N[Sqrt[N[(N[(l / N[(x / l), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[(t / N[(x / t), $MachinePrecision]), $MachinePrecision] + N[(t * t), $MachinePrecision]), $MachinePrecision] + N[(N[Power[t$95$4, 2.0], $MachinePrecision] * N[(t$95$4 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.4e-272], N[(t$95$2 / N[Sqrt[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.5e-150], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t / N[(t * N[Sqrt[2.0], $MachinePrecision] + N[(N[(0.5 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(2.0 * N[(t * t), $MachinePrecision] + N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.2960935021905734e+108], N[(N[Sqrt[t$95$3], $MachinePrecision] / t$95$7), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(1.0 + x), $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 := \ell \cdot \frac{\ell}{x}\\
t_2 := t \cdot \sqrt{2}\\
t_3 := t \cdot \left(t \cdot 2\right)\\
t_4 := \sqrt[3]{\mathsf{fma}\left(\ell, \ell, t_3\right)}\\
t_5 := 1 + \frac{2}{x}\\
t_6 := \sqrt{2 \cdot t_5}\\
t_7 := \sqrt{2 \cdot \left(t \cdot \left(t + \frac{t}{x}\right) + t_1\right)}\\
\mathbf{if}\;t \leq -1.1292640349786462 \cdot 10^{+46}:\\
\;\;\;\;\frac{t_2}{-\mathsf{fma}\left(t, t_6, \sqrt{\frac{0.5}{t_5}} \cdot \frac{\ell \cdot \frac{\ell}{t}}{x}\right)}\\
\mathbf{elif}\;t \leq -8.6 \cdot 10^{-151}:\\
\;\;\;\;\frac{t_2}{t_7}\\
\mathbf{elif}\;t \leq -2.1 \cdot 10^{-184}:\\
\;\;\;\;\frac{t_2}{t_6 \cdot \left(-t\right)}\\
\mathbf{elif}\;t \leq -1 \cdot 10^{-190}:\\
\;\;\;\;\frac{t_2}{\sqrt{\frac{\ell}{\frac{x}{\ell}} + \mathsf{fma}\left(2, \frac{t}{\frac{x}{t}} + t \cdot t, {t_4}^{2} \cdot \left(t_4 \cdot \frac{1}{x}\right)\right)}}\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{-272}:\\
\;\;\;\;\frac{t_2}{\sqrt{2 \cdot t_1}}\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{-150}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t}{\mathsf{fma}\left(t, \sqrt{2}, \frac{0.5}{\sqrt{2}} \cdot \frac{2 \cdot \mathsf{fma}\left(2, t \cdot t, \ell \cdot \ell\right)}{t \cdot x}\right)}\\
\mathbf{elif}\;t \leq 2.2960935021905734 \cdot 10^{+108}:\\
\;\;\;\;\frac{\sqrt{t_3}}{t_7}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
if t < -1.129264034978646e46Initial program 43.6
Taylor expanded in x around inf 42.5
Simplified42.5
Taylor expanded in t around -inf 13.0
Simplified5.5
if -1.129264034978646e46 < t < -8.60000000000000035e-151Initial program 27.9
Taylor expanded in x around inf 9.4
Simplified9.4
Taylor expanded in t around 0 9.6
Simplified4.3
Taylor expanded in l around 0 9.6
Simplified4.3
if -8.60000000000000035e-151 < t < -2.0999999999999999e-184Initial program 56.4
Taylor expanded in x around inf 32.7
Simplified32.7
Taylor expanded in t around -inf 28.0
Simplified28.0
if -2.0999999999999999e-184 < t < -1e-190Initial program 64.0
Taylor expanded in x around inf 35.3
Simplified35.4
Applied egg-rr35.3
if -1e-190 < t < 5.39999999999999985e-272Initial program 63.1
Taylor expanded in x around inf 32.3
Simplified32.3
Taylor expanded in t around 0 32.3
Simplified31.4
Taylor expanded in l around inf 32.3
Simplified31.4
if 5.39999999999999985e-272 < t < 4.5000000000000002e-150Initial program 62.1
Simplified63.4
Taylor expanded in x around inf 23.7
Simplified23.7
if 4.5000000000000002e-150 < t < 2.29609350219057336e108Initial program 25.8
Taylor expanded in x around inf 10.8
Simplified10.8
Taylor expanded in t around 0 11.2
Simplified5.4
Taylor expanded in l around 0 11.2
Simplified5.4
Applied egg-rr5.0
if 2.29609350219057336e108 < t Initial program 51.4
Applied egg-rr52.5
Taylor expanded in t around inf 2.2
Final simplification9.0
| Alternative 1 | |
|---|---|
| Error | 9.0 |
| Cost | 40208 |
| Alternative 2 | |
|---|---|
| Error | 9.0 |
| Cost | 33868 |
| Alternative 3 | |
|---|---|
| Error | 9.8 |
| Cost | 27524 |
| Alternative 4 | |
|---|---|
| Error | 9.5 |
| Cost | 14280 |
| Alternative 5 | |
|---|---|
| Error | 15.1 |
| Cost | 14032 |
| Alternative 6 | |
|---|---|
| Error | 14.5 |
| Cost | 14032 |
| Alternative 7 | |
|---|---|
| Error | 15.0 |
| Cost | 13640 |
| Alternative 8 | |
|---|---|
| Error | 15.3 |
| Cost | 13188 |
| Alternative 9 | |
|---|---|
| Error | 38.2 |
| Cost | 7108 |
| Alternative 10 | |
|---|---|
| Error | 38.4 |
| Cost | 7044 |
| Alternative 11 | |
|---|---|
| Error | 39.2 |
| Cost | 6848 |
| Alternative 12 | |
|---|---|
| Error | 39.4 |
| Cost | 448 |
| Alternative 13 | |
|---|---|
| Error | 39.4 |
| Cost | 320 |
| Alternative 14 | |
|---|---|
| Error | 62.1 |
| Cost | 64 |
| Alternative 15 | |
|---|---|
| Error | 39.6 |
| Cost | 64 |
herbie shell --seed 2022316
(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)))))