| Alternative 1 | |
|---|---|
| Error | 9.5 |
| Cost | 22344 |
(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 (+ 2.0 (/ 2.0 x))))
(if (<= t -2.113404131062392e+33)
(- (sqrt (* 2.0 (/ (* 0.5 (+ x -1.0)) (+ x 1.0)))))
(if (<= t -1e-220)
(/
t_2
(sqrt
(+
(/ l (/ x l))
(+
(+ (fma 2.0 (* t t) (* (/ l x) (/ l x))) (* (/ t (/ x t)) t_3))
(* t_1 (+ 1.0 (/ 1.0 x)))))))
(if (<= t 1e-165)
(/ t_2 (hypot (* (sqrt 2.0) (/ l (sqrt x))) (* t (sqrt t_3))))
(if (<= t 1.8896406000205735e+52)
(/ (sqrt (* 2.0 (* t t))) (sqrt (+ (* (* t t) t_3) (* 2.0 t_1))))
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 * (l / x);
double t_2 = t * sqrt(2.0);
double t_3 = 2.0 + (2.0 / x);
double tmp;
if (t <= -2.113404131062392e+33) {
tmp = -sqrt((2.0 * ((0.5 * (x + -1.0)) / (x + 1.0))));
} else if (t <= -1e-220) {
tmp = t_2 / sqrt(((l / (x / l)) + ((fma(2.0, (t * t), ((l / x) * (l / x))) + ((t / (x / t)) * t_3)) + (t_1 * (1.0 + (1.0 / x))))));
} else if (t <= 1e-165) {
tmp = t_2 / hypot((sqrt(2.0) * (l / sqrt(x))), (t * sqrt(t_3)));
} else if (t <= 1.8896406000205735e+52) {
tmp = sqrt((2.0 * (t * t))) / sqrt((((t * t) * t_3) + (2.0 * t_1)));
} 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 * Float64(l / x)) t_2 = Float64(t * sqrt(2.0)) t_3 = Float64(2.0 + Float64(2.0 / x)) tmp = 0.0 if (t <= -2.113404131062392e+33) tmp = Float64(-sqrt(Float64(2.0 * Float64(Float64(0.5 * Float64(x + -1.0)) / Float64(x + 1.0))))); elseif (t <= -1e-220) tmp = Float64(t_2 / sqrt(Float64(Float64(l / Float64(x / l)) + Float64(Float64(fma(2.0, Float64(t * t), Float64(Float64(l / x) * Float64(l / x))) + Float64(Float64(t / Float64(x / t)) * t_3)) + Float64(t_1 * Float64(1.0 + Float64(1.0 / x))))))); elseif (t <= 1e-165) tmp = Float64(t_2 / hypot(Float64(sqrt(2.0) * Float64(l / sqrt(x))), Float64(t * sqrt(t_3)))); elseif (t <= 1.8896406000205735e+52) tmp = Float64(sqrt(Float64(2.0 * Float64(t * t))) / sqrt(Float64(Float64(Float64(t * t) * t_3) + Float64(2.0 * t_1)))); 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[(l / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 + N[(2.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.113404131062392e+33], (-N[Sqrt[N[(2.0 * N[(N[(0.5 * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[t, -1e-220], N[(t$95$2 / N[Sqrt[N[(N[(l / N[(x / l), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(2.0 * N[(t * t), $MachinePrecision] + N[(N[(l / x), $MachinePrecision] * N[(l / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(x / t), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-165], N[(t$95$2 / N[Sqrt[N[(N[Sqrt[2.0], $MachinePrecision] * N[(l / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + N[(t * N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.8896406000205735e+52], N[(N[Sqrt[N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(N[(t * t), $MachinePrecision] * t$95$3), $MachinePrecision] + N[(2.0 * t$95$1), $MachinePrecision]), $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 := \ell \cdot \frac{\ell}{x}\\
t_2 := t \cdot \sqrt{2}\\
t_3 := 2 + \frac{2}{x}\\
\mathbf{if}\;t \leq -2.113404131062392 \cdot 10^{+33}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{0.5 \cdot \left(x + -1\right)}{x + 1}}\\
\mathbf{elif}\;t \leq -1 \cdot 10^{-220}:\\
\;\;\;\;\frac{t_2}{\sqrt{\frac{\ell}{\frac{x}{\ell}} + \left(\left(\mathsf{fma}\left(2, t \cdot t, \frac{\ell}{x} \cdot \frac{\ell}{x}\right) + \frac{t}{\frac{x}{t}} \cdot t_3\right) + t_1 \cdot \left(1 + \frac{1}{x}\right)\right)}}\\
\mathbf{elif}\;t \leq 10^{-165}:\\
\;\;\;\;\frac{t_2}{\mathsf{hypot}\left(\sqrt{2} \cdot \frac{\ell}{\sqrt{x}}, t \cdot \sqrt{t_3}\right)}\\
\mathbf{elif}\;t \leq 1.8896406000205735 \cdot 10^{+52}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(t \cdot t\right)}}{\sqrt{\left(t \cdot t\right) \cdot t_3 + 2 \cdot t_1}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
if t < -2.1134041310623919e33Initial program 42.6
Simplified42.6
Applied egg-rr55.3
Taylor expanded in t around -inf 4.7
Simplified4.7
Applied egg-rr3.8
if -2.1134041310623919e33 < t < -9.99999999999999992e-221Initial program 35.8
Taylor expanded in x around inf 16.4
Simplified15.5
Taylor expanded in t around 0 15.7
Simplified11.2
if -9.99999999999999992e-221 < t < 1e-165Initial program 63.1
Taylor expanded in x around inf 38.1
Simplified33.2
Taylor expanded in t around 0 33.2
Simplified32.1
Taylor expanded in x around inf 33.3
Simplified32.2
Applied egg-rr12.4
if 1e-165 < t < 1.8896406000205735e52Initial program 29.1
Taylor expanded in x around inf 10.0
Simplified9.5
Taylor expanded in t around 0 9.8
Simplified5.3
Taylor expanded in x around inf 9.9
Simplified5.4
Applied egg-rr5.1
if 1.8896406000205735e52 < t Initial program 45.0
Simplified45.1
Taylor expanded in x around inf 4.6
Applied egg-rr4.8
Applied egg-rr5.8
Taylor expanded in t around 0 4.4
Final simplification6.7
| Alternative 1 | |
|---|---|
| Error | 9.5 |
| Cost | 22344 |
| Alternative 2 | |
|---|---|
| Error | 9.6 |
| Cost | 14408 |
| Alternative 3 | |
|---|---|
| Error | 14.0 |
| Cost | 13772 |
| Alternative 4 | |
|---|---|
| Error | 13.4 |
| Cost | 13768 |
| Alternative 5 | |
|---|---|
| Error | 14.0 |
| Cost | 13640 |
| Alternative 6 | |
|---|---|
| Error | 14.4 |
| Cost | 7300 |
| Alternative 7 | |
|---|---|
| Error | 14.6 |
| Cost | 1092 |
| Alternative 8 | |
|---|---|
| Error | 14.6 |
| Cost | 836 |
| Alternative 9 | |
|---|---|
| Error | 14.6 |
| Cost | 836 |
| Alternative 10 | |
|---|---|
| Error | 14.9 |
| Cost | 452 |
| Alternative 11 | |
|---|---|
| Error | 14.7 |
| Cost | 452 |
| Alternative 12 | |
|---|---|
| Error | 15.1 |
| Cost | 196 |
| Alternative 13 | |
|---|---|
| Error | 39.0 |
| Cost | 64 |

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