| Alternative 1 | |
|---|---|
| Error | 10.7 |
| Cost | 23640 |
(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 x) (+ 2.0 (/ 2.0 x))))
(t_4 (/ (* l l) x))
(t_5 (- (* (* t t) -2.0) (* l l)))
(t_6 (* 2.0 (+ (* t t) (/ (* t t) x))))
(t_7 (/ (+ (* l l) (* 2.0 (* t t))) x)))
(if (<= t -3.7e-5)
(+ -1.0 (+ (/ 1.0 x) (/ -0.5 (* x x))))
(if (<= t -3.6e-169)
(/ t_2 (sqrt (+ t_4 (+ t_6 t_1))))
(if (<= t -6.8e-235)
(+ (/ 1.0 x) -1.0)
(if (<= t 4.6e-301)
(* (sqrt 2.0) (/ t (sqrt (+ (+ t_4 t_6) t_7))))
(if (<= t 2.1e-161)
(/
t_2
(fma
t
(sqrt t_3)
(* (sqrt (/ 1.0 t_3)) (* 0.5 (/ (* 2.0 t_1) t)))))
(if (<= t 8800000000000.0)
(/
t_2
(sqrt (+ (+ t_4 (fma -1.0 (/ (+ t_5 t_5) (* x x)) t_6)) 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 = (2.0 / x) + (2.0 + (2.0 / x));
double t_4 = (l * l) / x;
double t_5 = ((t * t) * -2.0) - (l * l);
double t_6 = 2.0 * ((t * t) + ((t * t) / x));
double t_7 = ((l * l) + (2.0 * (t * t))) / x;
double tmp;
if (t <= -3.7e-5) {
tmp = -1.0 + ((1.0 / x) + (-0.5 / (x * x)));
} else if (t <= -3.6e-169) {
tmp = t_2 / sqrt((t_4 + (t_6 + t_1)));
} else if (t <= -6.8e-235) {
tmp = (1.0 / x) + -1.0;
} else if (t <= 4.6e-301) {
tmp = sqrt(2.0) * (t / sqrt(((t_4 + t_6) + t_7)));
} else if (t <= 2.1e-161) {
tmp = t_2 / fma(t, sqrt(t_3), (sqrt((1.0 / t_3)) * (0.5 * ((2.0 * t_1) / t))));
} else if (t <= 8800000000000.0) {
tmp = t_2 / sqrt(((t_4 + fma(-1.0, ((t_5 + t_5) / (x * x)), t_6)) + 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(Float64(2.0 / x) + Float64(2.0 + Float64(2.0 / x))) t_4 = Float64(Float64(l * l) / x) t_5 = Float64(Float64(Float64(t * t) * -2.0) - Float64(l * l)) t_6 = Float64(2.0 * Float64(Float64(t * t) + Float64(Float64(t * t) / x))) t_7 = Float64(Float64(Float64(l * l) + Float64(2.0 * Float64(t * t))) / x) tmp = 0.0 if (t <= -3.7e-5) tmp = Float64(-1.0 + Float64(Float64(1.0 / x) + Float64(-0.5 / Float64(x * x)))); elseif (t <= -3.6e-169) tmp = Float64(t_2 / sqrt(Float64(t_4 + Float64(t_6 + t_1)))); elseif (t <= -6.8e-235) tmp = Float64(Float64(1.0 / x) + -1.0); elseif (t <= 4.6e-301) tmp = Float64(sqrt(2.0) * Float64(t / sqrt(Float64(Float64(t_4 + t_6) + t_7)))); elseif (t <= 2.1e-161) tmp = Float64(t_2 / fma(t, sqrt(t_3), Float64(sqrt(Float64(1.0 / t_3)) * Float64(0.5 * Float64(Float64(2.0 * t_1) / t))))); elseif (t <= 8800000000000.0) tmp = Float64(t_2 / sqrt(Float64(Float64(t_4 + fma(-1.0, Float64(Float64(t_5 + t_5) / Float64(x * x)), t_6)) + 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[(N[(2.0 / x), $MachinePrecision] + N[(2.0 + N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(l * l), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(t * t), $MachinePrecision] * -2.0), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t, -3.7e-5], N[(-1.0 + N[(N[(1.0 / x), $MachinePrecision] + N[(-0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.6e-169], N[(t$95$2 / N[Sqrt[N[(t$95$4 + N[(t$95$6 + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -6.8e-235], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[t, 4.6e-301], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t / N[Sqrt[N[(N[(t$95$4 + t$95$6), $MachinePrecision] + t$95$7), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e-161], N[(t$95$2 / N[(t * N[Sqrt[t$95$3], $MachinePrecision] + N[(N[Sqrt[N[(1.0 / t$95$3), $MachinePrecision]], $MachinePrecision] * N[(0.5 * N[(N[(2.0 * t$95$1), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8800000000000.0], N[(t$95$2 / N[Sqrt[N[(N[(t$95$4 + N[(-1.0 * N[(N[(t$95$5 + t$95$5), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision]), $MachinePrecision] + t$95$7), $MachinePrecision]], $MachinePrecision]), $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 := \frac{2}{x} + \left(2 + \frac{2}{x}\right)\\
t_4 := \frac{\ell \cdot \ell}{x}\\
t_5 := \left(t \cdot t\right) \cdot -2 - \ell \cdot \ell\\
t_6 := 2 \cdot \left(t \cdot t + \frac{t \cdot t}{x}\right)\\
t_7 := \frac{\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)}{x}\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{-5}:\\
\;\;\;\;-1 + \left(\frac{1}{x} + \frac{-0.5}{x \cdot x}\right)\\
\mathbf{elif}\;t \leq -3.6 \cdot 10^{-169}:\\
\;\;\;\;\frac{t_2}{\sqrt{t_4 + \left(t_6 + t_1\right)}}\\
\mathbf{elif}\;t \leq -6.8 \cdot 10^{-235}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{-301}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t}{\sqrt{\left(t_4 + t_6\right) + t_7}}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-161}:\\
\;\;\;\;\frac{t_2}{\mathsf{fma}\left(t, \sqrt{t_3}, \sqrt{\frac{1}{t_3}} \cdot \left(0.5 \cdot \frac{2 \cdot t_1}{t}\right)\right)}\\
\mathbf{elif}\;t \leq 8800000000000:\\
\;\;\;\;\frac{t_2}{\sqrt{\left(t_4 + \mathsf{fma}\left(-1, \frac{t_5 + t_5}{x \cdot x}, t_6\right)\right) + t_7}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
if t < -3.69999999999999981e-5Initial program 41.6
Simplified41.6
Taylor expanded in t around inf 50.2
Simplified50.2
Taylor expanded in t around -inf 5.2
Simplified5.2
Taylor expanded in x around inf 5.5
Simplified5.5
if -3.69999999999999981e-5 < t < -3.60000000000000001e-169Initial program 32.1
Taylor expanded in x around inf 10.5
Simplified10.5
Taylor expanded in t around 0 10.8
Simplified10.8
if -3.60000000000000001e-169 < t < -6.79999999999999943e-235Initial program 63.5
Simplified63.5
Taylor expanded in t around inf 64.0
Simplified64.0
Taylor expanded in t around -inf 34.0
Simplified34.0
Taylor expanded in x around inf 34.2
if -6.79999999999999943e-235 < t < 4.6000000000000003e-301Initial program 62.4
Simplified62.2
Taylor expanded in x around inf 27.3
Simplified27.3
if 4.6000000000000003e-301 < t < 2.1e-161Initial program 62.6
Taylor expanded in x around inf 33.6
Simplified33.6
Taylor expanded in t around inf 24.8
Simplified24.8
if 2.1e-161 < t < 8.8e12Initial program 30.3
Taylor expanded in x around -inf 10.4
Simplified10.4
if 8.8e12 < t Initial program 42.3
Simplified42.4
Taylor expanded in t around inf 52.3
Simplified52.3
Taylor expanded in t around 0 5.2
Final simplification10.7
| Alternative 1 | |
|---|---|
| Error | 10.7 |
| Cost | 23640 |
| Alternative 2 | |
|---|---|
| Error | 12.1 |
| Cost | 21328 |
| Alternative 3 | |
|---|---|
| Error | 10.6 |
| Cost | 20304 |
| Alternative 4 | |
|---|---|
| Error | 11.9 |
| Cost | 15440 |
| Alternative 5 | |
|---|---|
| Error | 11.9 |
| Cost | 15320 |
| Alternative 6 | |
|---|---|
| Error | 14.5 |
| Cost | 13768 |
| Alternative 7 | |
|---|---|
| Error | 14.8 |
| Cost | 7112 |
| Alternative 8 | |
|---|---|
| Error | 14.9 |
| Cost | 7048 |
| Alternative 9 | |
|---|---|
| Error | 15.7 |
| Cost | 836 |
| Alternative 10 | |
|---|---|
| Error | 15.6 |
| Cost | 836 |
| Alternative 11 | |
|---|---|
| Error | 16.0 |
| Cost | 452 |
| Alternative 12 | |
|---|---|
| Error | 15.8 |
| Cost | 452 |
| Alternative 13 | |
|---|---|
| Error | 16.2 |
| Cost | 196 |
| Alternative 14 | |
|---|---|
| Error | 39.7 |
| Cost | 64 |
herbie shell --seed 2022330
(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)))))