(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 (pow t 2.0)))
(t_2 (+ (pow l 2.0) t_1))
(t_3 (* t (sqrt 2.0)))
(t_4 (hypot l t_3))
(t_5 (sqrt (/ (+ x 1.0) (+ x -1.0))))
(t_6 (- (* (pow t 2.0) -2.0) (pow l 2.0))))
(if (<= t -2.9e-126)
(/ t_3 (* t_3 (- t_5)))
(if (<= t 6.4e-280)
(/
t_3
(hypot
(hypot
(/ l (sqrt x))
(hypot
(sqrt (* 2.0 (+ (* t t) (/ (* t t) x))))
(/ (hypot t_4 t_4) x)))
(/ t_4 (sqrt x))))
(if (<= t 1.3e-194)
(/ t_3 (+ t_3 (* (/ (+ t_6 t_6) (* (sqrt 2.0) (* t x))) -0.5)))
(if (<= t 1.35e-79)
(/
t_3
(sqrt
(+
(+
(/ (pow l 2.0) x)
(+
(/ (+ t_2 t_2) (pow x 2.0))
(+ t_1 (* 2.0 (/ (pow t 2.0) x)))))
(/ t_2 x))))
(/ t_3 (* (sqrt 2.0) (* t t_5)))))))))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 * pow(t, 2.0);
double t_2 = pow(l, 2.0) + t_1;
double t_3 = t * sqrt(2.0);
double t_4 = hypot(l, t_3);
double t_5 = sqrt(((x + 1.0) / (x + -1.0)));
double t_6 = (pow(t, 2.0) * -2.0) - pow(l, 2.0);
double tmp;
if (t <= -2.9e-126) {
tmp = t_3 / (t_3 * -t_5);
} else if (t <= 6.4e-280) {
tmp = t_3 / hypot(hypot((l / sqrt(x)), hypot(sqrt((2.0 * ((t * t) + ((t * t) / x)))), (hypot(t_4, t_4) / x))), (t_4 / sqrt(x)));
} else if (t <= 1.3e-194) {
tmp = t_3 / (t_3 + (((t_6 + t_6) / (sqrt(2.0) * (t * x))) * -0.5));
} else if (t <= 1.35e-79) {
tmp = t_3 / sqrt((((pow(l, 2.0) / x) + (((t_2 + t_2) / pow(x, 2.0)) + (t_1 + (2.0 * (pow(t, 2.0) / x))))) + (t_2 / x)));
} else {
tmp = t_3 / (sqrt(2.0) * (t * t_5));
}
return tmp;
}
public static double code(double x, double l, double t) {
return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
public static double code(double x, double l, double t) {
double t_1 = 2.0 * Math.pow(t, 2.0);
double t_2 = Math.pow(l, 2.0) + t_1;
double t_3 = t * Math.sqrt(2.0);
double t_4 = Math.hypot(l, t_3);
double t_5 = Math.sqrt(((x + 1.0) / (x + -1.0)));
double t_6 = (Math.pow(t, 2.0) * -2.0) - Math.pow(l, 2.0);
double tmp;
if (t <= -2.9e-126) {
tmp = t_3 / (t_3 * -t_5);
} else if (t <= 6.4e-280) {
tmp = t_3 / Math.hypot(Math.hypot((l / Math.sqrt(x)), Math.hypot(Math.sqrt((2.0 * ((t * t) + ((t * t) / x)))), (Math.hypot(t_4, t_4) / x))), (t_4 / Math.sqrt(x)));
} else if (t <= 1.3e-194) {
tmp = t_3 / (t_3 + (((t_6 + t_6) / (Math.sqrt(2.0) * (t * x))) * -0.5));
} else if (t <= 1.35e-79) {
tmp = t_3 / Math.sqrt((((Math.pow(l, 2.0) / x) + (((t_2 + t_2) / Math.pow(x, 2.0)) + (t_1 + (2.0 * (Math.pow(t, 2.0) / x))))) + (t_2 / x)));
} else {
tmp = t_3 / (Math.sqrt(2.0) * (t * t_5));
}
return tmp;
}
def code(x, l, t): return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
def code(x, l, t): t_1 = 2.0 * math.pow(t, 2.0) t_2 = math.pow(l, 2.0) + t_1 t_3 = t * math.sqrt(2.0) t_4 = math.hypot(l, t_3) t_5 = math.sqrt(((x + 1.0) / (x + -1.0))) t_6 = (math.pow(t, 2.0) * -2.0) - math.pow(l, 2.0) tmp = 0 if t <= -2.9e-126: tmp = t_3 / (t_3 * -t_5) elif t <= 6.4e-280: tmp = t_3 / math.hypot(math.hypot((l / math.sqrt(x)), math.hypot(math.sqrt((2.0 * ((t * t) + ((t * t) / x)))), (math.hypot(t_4, t_4) / x))), (t_4 / math.sqrt(x))) elif t <= 1.3e-194: tmp = t_3 / (t_3 + (((t_6 + t_6) / (math.sqrt(2.0) * (t * x))) * -0.5)) elif t <= 1.35e-79: tmp = t_3 / math.sqrt((((math.pow(l, 2.0) / x) + (((t_2 + t_2) / math.pow(x, 2.0)) + (t_1 + (2.0 * (math.pow(t, 2.0) / x))))) + (t_2 / x))) else: tmp = t_3 / (math.sqrt(2.0) * (t * t_5)) 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 * (t ^ 2.0)) t_2 = Float64((l ^ 2.0) + t_1) t_3 = Float64(t * sqrt(2.0)) t_4 = hypot(l, t_3) t_5 = sqrt(Float64(Float64(x + 1.0) / Float64(x + -1.0))) t_6 = Float64(Float64((t ^ 2.0) * -2.0) - (l ^ 2.0)) tmp = 0.0 if (t <= -2.9e-126) tmp = Float64(t_3 / Float64(t_3 * Float64(-t_5))); elseif (t <= 6.4e-280) tmp = Float64(t_3 / hypot(hypot(Float64(l / sqrt(x)), hypot(sqrt(Float64(2.0 * Float64(Float64(t * t) + Float64(Float64(t * t) / x)))), Float64(hypot(t_4, t_4) / x))), Float64(t_4 / sqrt(x)))); elseif (t <= 1.3e-194) tmp = Float64(t_3 / Float64(t_3 + Float64(Float64(Float64(t_6 + t_6) / Float64(sqrt(2.0) * Float64(t * x))) * -0.5))); elseif (t <= 1.35e-79) tmp = Float64(t_3 / sqrt(Float64(Float64(Float64((l ^ 2.0) / x) + Float64(Float64(Float64(t_2 + t_2) / (x ^ 2.0)) + Float64(t_1 + Float64(2.0 * Float64((t ^ 2.0) / x))))) + Float64(t_2 / x)))); else tmp = Float64(t_3 / Float64(sqrt(2.0) * Float64(t * t_5))); end return tmp end
function tmp = code(x, l, t) tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l))); end
function tmp_2 = code(x, l, t) t_1 = 2.0 * (t ^ 2.0); t_2 = (l ^ 2.0) + t_1; t_3 = t * sqrt(2.0); t_4 = hypot(l, t_3); t_5 = sqrt(((x + 1.0) / (x + -1.0))); t_6 = ((t ^ 2.0) * -2.0) - (l ^ 2.0); tmp = 0.0; if (t <= -2.9e-126) tmp = t_3 / (t_3 * -t_5); elseif (t <= 6.4e-280) tmp = t_3 / hypot(hypot((l / sqrt(x)), hypot(sqrt((2.0 * ((t * t) + ((t * t) / x)))), (hypot(t_4, t_4) / x))), (t_4 / sqrt(x))); elseif (t <= 1.3e-194) tmp = t_3 / (t_3 + (((t_6 + t_6) / (sqrt(2.0) * (t * x))) * -0.5)); elseif (t <= 1.35e-79) tmp = t_3 / sqrt(((((l ^ 2.0) / x) + (((t_2 + t_2) / (x ^ 2.0)) + (t_1 + (2.0 * ((t ^ 2.0) / x))))) + (t_2 / x))); else tmp = t_3 / (sqrt(2.0) * (t * t_5)); end tmp_2 = 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[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[l, 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[l ^ 2 + t$95$3 ^ 2], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[Power[t, 2.0], $MachinePrecision] * -2.0), $MachinePrecision] - N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.9e-126], N[(t$95$3 / N[(t$95$3 * (-t$95$5)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.4e-280], N[(t$95$3 / N[Sqrt[N[Sqrt[N[(l / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] ^ 2 + N[Sqrt[N[Sqrt[N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2 + N[(N[Sqrt[t$95$4 ^ 2 + t$95$4 ^ 2], $MachinePrecision] / x), $MachinePrecision] ^ 2], $MachinePrecision] ^ 2], $MachinePrecision] ^ 2 + N[(t$95$4 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e-194], N[(t$95$3 / N[(t$95$3 + N[(N[(N[(t$95$6 + t$95$6), $MachinePrecision] / N[(N[Sqrt[2.0], $MachinePrecision] * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.35e-79], N[(t$95$3 / N[Sqrt[N[(N[(N[(N[Power[l, 2.0], $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[(t$95$2 + t$95$2), $MachinePrecision] / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(2.0 * N[(N[Power[t, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$3 / N[(N[Sqrt[2.0], $MachinePrecision] * N[(t * t$95$5), $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 \cdot {t}^{2}\\
t_2 := {\ell}^{2} + t_1\\
t_3 := t \cdot \sqrt{2}\\
t_4 := \mathsf{hypot}\left(\ell, t_3\right)\\
t_5 := \sqrt{\frac{x + 1}{x + -1}}\\
t_6 := {t}^{2} \cdot -2 - {\ell}^{2}\\
\mathbf{if}\;t \leq -2.9 \cdot 10^{-126}:\\
\;\;\;\;\frac{t_3}{t_3 \cdot \left(-t_5\right)}\\
\mathbf{elif}\;t \leq 6.4 \cdot 10^{-280}:\\
\;\;\;\;\frac{t_3}{\mathsf{hypot}\left(\mathsf{hypot}\left(\frac{\ell}{\sqrt{x}}, \mathsf{hypot}\left(\sqrt{2 \cdot \left(t \cdot t + \frac{t \cdot t}{x}\right)}, \frac{\mathsf{hypot}\left(t_4, t_4\right)}{x}\right)\right), \frac{t_4}{\sqrt{x}}\right)}\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{-194}:\\
\;\;\;\;\frac{t_3}{t_3 + \frac{t_6 + t_6}{\sqrt{2} \cdot \left(t \cdot x\right)} \cdot -0.5}\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-79}:\\
\;\;\;\;\frac{t_3}{\sqrt{\left(\frac{{\ell}^{2}}{x} + \left(\frac{t_2 + t_2}{{x}^{2}} + \left(t_1 + 2 \cdot \frac{{t}^{2}}{x}\right)\right)\right) + \frac{t_2}{x}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_3}{\sqrt{2} \cdot \left(t \cdot t_5\right)}\\
\end{array}
Results
if t < -2.89999999999999988e-126Initial program 38.3
Taylor expanded in t around -inf 8.6
Simplified8.6
if -2.89999999999999988e-126 < t < 6.4000000000000001e-280Initial program 59.0
Taylor expanded in x around -inf 33.4
Applied egg-rr33.4
Applied egg-rr23.2
if 6.4000000000000001e-280 < t < 1.30000000000000001e-194Initial program 63.0
Taylor expanded in x around -inf 39.6
Applied egg-rr39.7
Taylor expanded in x around inf 23.7
if 1.30000000000000001e-194 < t < 1.3500000000000001e-79Initial program 43.1
Taylor expanded in x around -inf 18.2
if 1.3500000000000001e-79 < t Initial program 39.1
Taylor expanded in l around 0 8.0
Simplified8.0
Final simplification11.9
herbie shell --seed 2022210
(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)))))