
(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)))))
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)));
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
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)));
}
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)))
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 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
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]
\begin{array}{l}
\\
\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}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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)))))
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)));
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
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)));
}
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)))
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 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
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]
\begin{array}{l}
\\
\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}}
\end{array}
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))) (t_2 (sqrt (/ (+ x -1.0) (+ x 1.0)))))
(if (<= t -1.2e-192)
(- t_2)
(if (<= t 5.8e-291)
(/ t_1 (* l (sqrt (+ (/ 2.0 x) (/ (/ 2.0 x) x)))))
(if (<= t 6.3e-90)
(*
t
(/
(sqrt 2.0)
(fma
0.5
(/
(+ (* l l) (+ (* l l) (* 2.0 (+ (* t t) (* t t)))))
(* (sqrt 2.0) (* t x)))
t_1)))
t_2)))))l = abs(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 tmp;
if (t <= -1.2e-192) {
tmp = -t_2;
} else if (t <= 5.8e-291) {
tmp = t_1 / (l * sqrt(((2.0 / x) + ((2.0 / x) / x))));
} else if (t <= 6.3e-90) {
tmp = t * (sqrt(2.0) / fma(0.5, (((l * l) + ((l * l) + (2.0 * ((t * t) + (t * t))))) / (sqrt(2.0) * (t * x))), t_1));
} else {
tmp = t_2;
}
return tmp;
}
l = abs(l) function code(x, l, t) t_1 = Float64(t * sqrt(2.0)) t_2 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -1.2e-192) tmp = Float64(-t_2); elseif (t <= 5.8e-291) tmp = Float64(t_1 / Float64(l * sqrt(Float64(Float64(2.0 / x) + Float64(Float64(2.0 / x) / x))))); elseif (t <= 6.3e-90) tmp = Float64(t * Float64(sqrt(2.0) / fma(0.5, Float64(Float64(Float64(l * l) + Float64(Float64(l * l) + Float64(2.0 * Float64(Float64(t * t) + Float64(t * t))))) / Float64(sqrt(2.0) * Float64(t * x))), t_1))); else tmp = t_2; end return tmp end
NOTE: l should be positive before calling this function
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]}, If[LessEqual[t, -1.2e-192], (-t$95$2), If[LessEqual[t, 5.8e-291], N[(t$95$1 / N[(l * N[Sqrt[N[(N[(2.0 / x), $MachinePrecision] + N[(N[(2.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.3e-90], N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[(0.5 * N[(N[(N[(l * l), $MachinePrecision] + N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[2.0], $MachinePrecision] * N[(t * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
t_2 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -1.2 \cdot 10^{-192}:\\
\;\;\;\;-t_2\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{-291}:\\
\;\;\;\;\frac{t_1}{\ell \cdot \sqrt{\frac{2}{x} + \frac{\frac{2}{x}}{x}}}\\
\mathbf{elif}\;t \leq 6.3 \cdot 10^{-90}:\\
\;\;\;\;t \cdot \frac{\sqrt{2}}{\mathsf{fma}\left(0.5, \frac{\ell \cdot \ell + \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t + t \cdot t\right)\right)}{\sqrt{2} \cdot \left(t \cdot x\right)}, t_1\right)}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.2e-192Initial program 38.9%
associate-*l/38.9%
Simplified38.9%
Applied egg-rr78.7%
Taylor expanded in t around -inf 88.8%
mul-1-neg88.8%
sub-neg88.8%
metadata-eval88.8%
Simplified88.8%
if -1.2e-192 < t < 5.80000000000000003e-291Initial program 8.9%
associate-*r/8.9%
fma-neg9.0%
remove-double-neg9.0%
fma-neg8.9%
sub-neg8.9%
metadata-eval8.9%
remove-double-neg8.9%
+-commutative8.9%
fma-def8.9%
Simplified8.9%
Taylor expanded in l around inf 8.3%
*-commutative8.3%
associate--l+8.4%
sub-neg8.4%
metadata-eval8.4%
+-commutative8.4%
sub-neg8.4%
metadata-eval8.4%
+-commutative8.4%
Simplified8.4%
Taylor expanded in x around inf 56.1%
associate-*r/56.1%
metadata-eval56.1%
unpow256.1%
associate-*r/56.1%
metadata-eval56.1%
Simplified56.1%
associate-*r/56.0%
associate-/r*56.0%
Applied egg-rr56.0%
if 5.80000000000000003e-291 < t < 6.29999999999999977e-90Initial program 23.3%
associate-*l/23.4%
Simplified23.4%
Taylor expanded in t around 0 27.6%
associate--l+33.9%
fma-udef33.9%
associate-/l*12.9%
+-commutative12.9%
sub-neg12.9%
metadata-eval12.9%
+-commutative12.9%
unpow212.9%
associate-/l*7.9%
+-commutative7.9%
sub-neg7.9%
metadata-eval7.9%
+-commutative7.9%
unpow27.9%
unpow27.9%
Simplified7.9%
Taylor expanded in x around inf 83.1%
fma-def83.1%
associate--l+83.1%
unpow283.1%
unpow283.1%
mul-1-neg83.1%
unpow283.1%
neg-mul-183.1%
unpow283.1%
distribute-rgt-neg-in83.1%
*-commutative83.1%
Simplified83.1%
if 6.29999999999999977e-90 < t Initial program 44.6%
associate-*l/44.7%
Simplified44.7%
Applied egg-rr85.9%
Taylor expanded in t around inf 93.4%
Final simplification87.0%
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0)))))
(if (<= t -7e-194)
(- t_1)
(if (<= t 3.15e-276)
(* (sqrt 2.0) (/ t (* l (sqrt (+ (/ 2.0 x) (/ 2.0 (* x x)))))))
t_1))))l = abs(l);
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -7e-194) {
tmp = -t_1;
} else if (t <= 3.15e-276) {
tmp = sqrt(2.0) * (t / (l * sqrt(((2.0 / x) + (2.0 / (x * x))))));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
if (t <= (-7d-194)) then
tmp = -t_1
else if (t <= 3.15d-276) then
tmp = sqrt(2.0d0) * (t / (l * sqrt(((2.0d0 / x) + (2.0d0 / (x * x))))))
else
tmp = t_1
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -7e-194) {
tmp = -t_1;
} else if (t <= 3.15e-276) {
tmp = Math.sqrt(2.0) * (t / (l * Math.sqrt(((2.0 / x) + (2.0 / (x * x))))));
} else {
tmp = t_1;
}
return tmp;
}
l = abs(l) def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -7e-194: tmp = -t_1 elif t <= 3.15e-276: tmp = math.sqrt(2.0) * (t / (l * math.sqrt(((2.0 / x) + (2.0 / (x * x)))))) else: tmp = t_1 return tmp
l = abs(l) function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -7e-194) tmp = Float64(-t_1); elseif (t <= 3.15e-276) tmp = Float64(sqrt(2.0) * Float64(t / Float64(l * sqrt(Float64(Float64(2.0 / x) + Float64(2.0 / Float64(x * x))))))); else tmp = t_1; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -7e-194) tmp = -t_1; elseif (t <= 3.15e-276) tmp = sqrt(2.0) * (t / (l * sqrt(((2.0 / x) + (2.0 / (x * x)))))); else tmp = t_1; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -7e-194], (-t$95$1), If[LessEqual[t, 3.15e-276], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t / N[(l * N[Sqrt[N[(N[(2.0 / x), $MachinePrecision] + N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -7 \cdot 10^{-194}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;t \leq 3.15 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t}{\ell \cdot \sqrt{\frac{2}{x} + \frac{2}{x \cdot x}}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -7.0000000000000006e-194Initial program 38.9%
associate-*l/38.9%
Simplified38.9%
Applied egg-rr78.7%
Taylor expanded in t around -inf 88.8%
mul-1-neg88.8%
sub-neg88.8%
metadata-eval88.8%
Simplified88.8%
if -7.0000000000000006e-194 < t < 3.1499999999999999e-276Initial program 8.9%
associate-*r/8.9%
fma-neg9.0%
remove-double-neg9.0%
fma-neg8.9%
sub-neg8.9%
metadata-eval8.9%
remove-double-neg8.9%
+-commutative8.9%
fma-def8.9%
Simplified8.9%
Taylor expanded in l around inf 8.3%
*-commutative8.3%
associate--l+8.4%
sub-neg8.4%
metadata-eval8.4%
+-commutative8.4%
sub-neg8.4%
metadata-eval8.4%
+-commutative8.4%
Simplified8.4%
Taylor expanded in x around inf 56.1%
associate-*r/56.1%
metadata-eval56.1%
unpow256.1%
associate-*r/56.1%
metadata-eval56.1%
Simplified56.1%
if 3.1499999999999999e-276 < t Initial program 40.1%
associate-*l/40.2%
Simplified40.2%
Applied egg-rr78.2%
Taylor expanded in t around inf 87.1%
Final simplification85.0%
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0)))))
(if (<= t -1.4e-192)
(- t_1)
(if (<= t 3.7e-280)
(/ (* t (sqrt 2.0)) (* l (sqrt (+ (/ 2.0 x) (/ (/ 2.0 x) x)))))
t_1))))l = abs(l);
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.4e-192) {
tmp = -t_1;
} else if (t <= 3.7e-280) {
tmp = (t * sqrt(2.0)) / (l * sqrt(((2.0 / x) + ((2.0 / x) / x))));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
if (t <= (-1.4d-192)) then
tmp = -t_1
else if (t <= 3.7d-280) then
tmp = (t * sqrt(2.0d0)) / (l * sqrt(((2.0d0 / x) + ((2.0d0 / x) / x))))
else
tmp = t_1
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.4e-192) {
tmp = -t_1;
} else if (t <= 3.7e-280) {
tmp = (t * Math.sqrt(2.0)) / (l * Math.sqrt(((2.0 / x) + ((2.0 / x) / x))));
} else {
tmp = t_1;
}
return tmp;
}
l = abs(l) def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -1.4e-192: tmp = -t_1 elif t <= 3.7e-280: tmp = (t * math.sqrt(2.0)) / (l * math.sqrt(((2.0 / x) + ((2.0 / x) / x)))) else: tmp = t_1 return tmp
l = abs(l) function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -1.4e-192) tmp = Float64(-t_1); elseif (t <= 3.7e-280) tmp = Float64(Float64(t * sqrt(2.0)) / Float64(l * sqrt(Float64(Float64(2.0 / x) + Float64(Float64(2.0 / x) / x))))); else tmp = t_1; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -1.4e-192) tmp = -t_1; elseif (t <= 3.7e-280) tmp = (t * sqrt(2.0)) / (l * sqrt(((2.0 / x) + ((2.0 / x) / x)))); else tmp = t_1; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.4e-192], (-t$95$1), If[LessEqual[t, 3.7e-280], N[(N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[(l * N[Sqrt[N[(N[(2.0 / x), $MachinePrecision] + N[(N[(2.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -1.4 \cdot 10^{-192}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{-280}:\\
\;\;\;\;\frac{t \cdot \sqrt{2}}{\ell \cdot \sqrt{\frac{2}{x} + \frac{\frac{2}{x}}{x}}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.40000000000000002e-192Initial program 38.9%
associate-*l/38.9%
Simplified38.9%
Applied egg-rr78.7%
Taylor expanded in t around -inf 88.8%
mul-1-neg88.8%
sub-neg88.8%
metadata-eval88.8%
Simplified88.8%
if -1.40000000000000002e-192 < t < 3.6999999999999998e-280Initial program 8.9%
associate-*r/8.9%
fma-neg9.0%
remove-double-neg9.0%
fma-neg8.9%
sub-neg8.9%
metadata-eval8.9%
remove-double-neg8.9%
+-commutative8.9%
fma-def8.9%
Simplified8.9%
Taylor expanded in l around inf 8.3%
*-commutative8.3%
associate--l+8.4%
sub-neg8.4%
metadata-eval8.4%
+-commutative8.4%
sub-neg8.4%
metadata-eval8.4%
+-commutative8.4%
Simplified8.4%
Taylor expanded in x around inf 56.1%
associate-*r/56.1%
metadata-eval56.1%
unpow256.1%
associate-*r/56.1%
metadata-eval56.1%
Simplified56.1%
associate-*r/56.0%
associate-/r*56.0%
Applied egg-rr56.0%
if 3.6999999999999998e-280 < t Initial program 40.1%
associate-*l/40.2%
Simplified40.2%
Applied egg-rr78.2%
Taylor expanded in t around inf 87.1%
Final simplification85.0%
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0)))))
(if (<= t -1.66e-192)
(- t_1)
(if (<= t 3.8e-284) (* (sqrt 2.0) (/ t (* l (sqrt (/ 2.0 x))))) t_1))))l = abs(l);
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.66e-192) {
tmp = -t_1;
} else if (t <= 3.8e-284) {
tmp = sqrt(2.0) * (t / (l * sqrt((2.0 / x))));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
if (t <= (-1.66d-192)) then
tmp = -t_1
else if (t <= 3.8d-284) then
tmp = sqrt(2.0d0) * (t / (l * sqrt((2.0d0 / x))))
else
tmp = t_1
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.66e-192) {
tmp = -t_1;
} else if (t <= 3.8e-284) {
tmp = Math.sqrt(2.0) * (t / (l * Math.sqrt((2.0 / x))));
} else {
tmp = t_1;
}
return tmp;
}
l = abs(l) def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -1.66e-192: tmp = -t_1 elif t <= 3.8e-284: tmp = math.sqrt(2.0) * (t / (l * math.sqrt((2.0 / x)))) else: tmp = t_1 return tmp
l = abs(l) function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -1.66e-192) tmp = Float64(-t_1); elseif (t <= 3.8e-284) tmp = Float64(sqrt(2.0) * Float64(t / Float64(l * sqrt(Float64(2.0 / x))))); else tmp = t_1; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -1.66e-192) tmp = -t_1; elseif (t <= 3.8e-284) tmp = sqrt(2.0) * (t / (l * sqrt((2.0 / x)))); else tmp = t_1; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.66e-192], (-t$95$1), If[LessEqual[t, 3.8e-284], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t / N[(l * N[Sqrt[N[(2.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -1.66 \cdot 10^{-192}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-284}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t}{\ell \cdot \sqrt{\frac{2}{x}}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.6600000000000001e-192Initial program 38.9%
associate-*l/38.9%
Simplified38.9%
Applied egg-rr78.7%
Taylor expanded in t around -inf 88.8%
mul-1-neg88.8%
sub-neg88.8%
metadata-eval88.8%
Simplified88.8%
if -1.6600000000000001e-192 < t < 3.7999999999999999e-284Initial program 8.9%
associate-*r/8.9%
fma-neg9.0%
remove-double-neg9.0%
fma-neg8.9%
sub-neg8.9%
metadata-eval8.9%
remove-double-neg8.9%
+-commutative8.9%
fma-def8.9%
Simplified8.9%
Taylor expanded in l around inf 8.3%
*-commutative8.3%
associate--l+8.4%
sub-neg8.4%
metadata-eval8.4%
+-commutative8.4%
sub-neg8.4%
metadata-eval8.4%
+-commutative8.4%
Simplified8.4%
Taylor expanded in x around inf 56.1%
if 3.7999999999999999e-284 < t Initial program 40.1%
associate-*l/40.2%
Simplified40.2%
Applied egg-rr78.2%
Taylor expanded in t around inf 87.1%
Final simplification85.0%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0))))) (if (<= t -5e-310) (- t_1) t_1)))
l = abs(l);
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -5e-310) {
tmp = -t_1;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
if (t <= (-5d-310)) then
tmp = -t_1
else
tmp = t_1
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -5e-310) {
tmp = -t_1;
} else {
tmp = t_1;
}
return tmp;
}
l = abs(l) def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -5e-310: tmp = -t_1 else: tmp = t_1 return tmp
l = abs(l) function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-t_1); else tmp = t_1; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -5e-310) tmp = -t_1; else tmp = t_1; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -5e-310], (-t$95$1), t$95$1]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 34.2%
associate-*l/34.2%
Simplified34.2%
Applied egg-rr72.7%
Taylor expanded in t around -inf 78.4%
mul-1-neg78.4%
sub-neg78.4%
metadata-eval78.4%
Simplified78.4%
if -4.999999999999985e-310 < t Initial program 39.4%
associate-*l/39.4%
Simplified39.4%
Applied egg-rr76.9%
Taylor expanded in t around inf 84.5%
Final simplification81.5%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ (/ 1.0 x) (- -1.0 (/ 0.5 (* x x)))) (sqrt (/ (+ x -1.0) (+ x 1.0)))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = sqrt(((x + -1.0) / (x + 1.0)));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (1.0d0 / x) + ((-1.0d0) - (0.5d0 / (x * x)))
else
tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))) else: tmp = math.sqrt(((x + -1.0) / (x + 1.0))) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(Float64(1.0 / x) + Float64(-1.0 - Float64(0.5 / Float64(x * x)))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))); else tmp = sqrt(((x + -1.0) / (x + 1.0))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(N[(1.0 / x), $MachinePrecision] + N[(-1.0 - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{x} + \left(-1 - \frac{0.5}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 34.2%
associate-*l/34.2%
Simplified34.2%
Taylor expanded in t around -inf 78.1%
associate-*r*78.1%
*-commutative78.1%
neg-mul-178.1%
distribute-rgt-neg-in78.1%
+-commutative78.1%
sub-neg78.1%
metadata-eval78.1%
+-commutative78.1%
Simplified78.1%
Taylor expanded in x around inf 78.0%
associate-*r/78.0%
metadata-eval78.0%
unpow278.0%
Simplified78.0%
if -4.999999999999985e-310 < t Initial program 39.4%
associate-*l/39.4%
Simplified39.4%
Applied egg-rr76.9%
Taylor expanded in t around inf 84.5%
Final simplification81.3%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ (/ 1.0 x) (- -1.0 (/ 0.5 (* x x)))) (- (/ -1.0 x) -1.0)))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = (-1.0 / x) - -1.0;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (1.0d0 / x) + ((-1.0d0) - (0.5d0 / (x * x)))
else
tmp = ((-1.0d0) / x) - (-1.0d0)
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = (-1.0 / x) - -1.0;
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))) else: tmp = (-1.0 / x) - -1.0 return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(Float64(1.0 / x) + Float64(-1.0 - Float64(0.5 / Float64(x * x)))); else tmp = Float64(Float64(-1.0 / x) - -1.0); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))); else tmp = (-1.0 / x) - -1.0; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(N[(1.0 / x), $MachinePrecision] + N[(-1.0 - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / x), $MachinePrecision] - -1.0), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{x} + \left(-1 - \frac{0.5}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x} - -1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 34.2%
associate-*l/34.2%
Simplified34.2%
Taylor expanded in t around -inf 78.1%
associate-*r*78.1%
*-commutative78.1%
neg-mul-178.1%
distribute-rgt-neg-in78.1%
+-commutative78.1%
sub-neg78.1%
metadata-eval78.1%
+-commutative78.1%
Simplified78.1%
Taylor expanded in x around inf 78.0%
associate-*r/78.0%
metadata-eval78.0%
unpow278.0%
Simplified78.0%
if -4.999999999999985e-310 < t Initial program 39.4%
associate-*l/39.4%
Simplified39.4%
Applied egg-rr76.9%
Taylor expanded in t around -inf 1.7%
mul-1-neg1.7%
sub-neg1.7%
metadata-eval1.7%
Simplified1.7%
Taylor expanded in x around -inf 0.0%
+-commutative0.0%
unpow20.0%
rem-square-sqrt83.1%
Simplified83.1%
Final simplification80.6%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) (- (/ -1.0 x) -1.0)))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = (-1.0 / x) - -1.0;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = ((-1.0d0) / x) - (-1.0d0)
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = (-1.0 / x) - -1.0;
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + (1.0 / x) else: tmp = (-1.0 / x) - -1.0 return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = Float64(Float64(-1.0 / x) - -1.0); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + (1.0 / x); else tmp = (-1.0 / x) - -1.0; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 / x), $MachinePrecision] - -1.0), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x} - -1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 34.2%
associate-*l/34.2%
Simplified34.2%
Taylor expanded in t around -inf 78.1%
associate-*r*78.1%
*-commutative78.1%
neg-mul-178.1%
distribute-rgt-neg-in78.1%
+-commutative78.1%
sub-neg78.1%
metadata-eval78.1%
+-commutative78.1%
Simplified78.1%
Taylor expanded in x around inf 78.0%
if -4.999999999999985e-310 < t Initial program 39.4%
associate-*l/39.4%
Simplified39.4%
Applied egg-rr76.9%
Taylor expanded in t around -inf 1.7%
mul-1-neg1.7%
sub-neg1.7%
metadata-eval1.7%
Simplified1.7%
Taylor expanded in x around -inf 0.0%
+-commutative0.0%
unpow20.0%
rem-square-sqrt83.1%
Simplified83.1%
Final simplification80.5%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (+ -1.0 (/ 1.0 x)))
l = abs(l);
double code(double x, double l, double t) {
return -1.0 + (1.0 / x);
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (-1.0d0) + (1.0d0 / x)
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
return -1.0 + (1.0 / x);
}
l = abs(l) def code(x, l, t): return -1.0 + (1.0 / x)
l = abs(l) function code(x, l, t) return Float64(-1.0 + Float64(1.0 / x)) end
l = abs(l) function tmp = code(x, l, t) tmp = -1.0 + (1.0 / x); end
NOTE: l should be positive before calling this function code[x_, l_, t_] := N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l = |l|\\
\\
-1 + \frac{1}{x}
\end{array}
Initial program 36.8%
associate-*l/36.8%
Simplified36.8%
Taylor expanded in t around -inf 39.9%
associate-*r*39.9%
*-commutative39.9%
neg-mul-139.9%
distribute-rgt-neg-in39.9%
+-commutative39.9%
sub-neg39.9%
metadata-eval39.9%
+-commutative39.9%
Simplified39.9%
Taylor expanded in x around inf 39.8%
Final simplification39.8%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 -1.0)
l = abs(l);
double code(double x, double l, double t) {
return -1.0;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = -1.0d0
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
return -1.0;
}
l = abs(l) def code(x, l, t): return -1.0
l = abs(l) function code(x, l, t) return -1.0 end
l = abs(l) function tmp = code(x, l, t) tmp = -1.0; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := -1.0
\begin{array}{l}
l = |l|\\
\\
-1
\end{array}
Initial program 36.8%
associate-*l/36.8%
Simplified36.8%
Taylor expanded in t around -inf 39.9%
associate-*r*39.9%
*-commutative39.9%
neg-mul-139.9%
distribute-rgt-neg-in39.9%
+-commutative39.9%
sub-neg39.9%
metadata-eval39.9%
+-commutative39.9%
Simplified39.9%
Taylor expanded in x around inf 39.7%
Taylor expanded in t around 0 39.8%
Final simplification39.8%
herbie shell --seed 2023256
(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)))))