
(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}
(FPCore (x l t)
:precision binary64
(let* ((t_1
(*
t
(/
(sqrt 2.0)
(sqrt
(+
(/ (* l l) x)
(+
(* 2.0 (+ (* t t) (/ (* t t) x)))
(/ (fma (* t 2.0) t (* l l)) x))))))))
(if (<= t -1.65e-9)
(- (sqrt (/ (+ x -1.0) (+ x 1.0))))
(if (<= t -4.4e-166)
t_1
(if (<= t -2.4e-253) -1.0 (if (<= t 7.6e-5) t_1 (+ 1.0 (/ -1.0 x))))))))
double code(double x, double l, double t) {
double t_1 = t * (sqrt(2.0) / sqrt((((l * l) / x) + ((2.0 * ((t * t) + ((t * t) / x))) + (fma((t * 2.0), t, (l * l)) / x)))));
double tmp;
if (t <= -1.65e-9) {
tmp = -sqrt(((x + -1.0) / (x + 1.0)));
} else if (t <= -4.4e-166) {
tmp = t_1;
} else if (t <= -2.4e-253) {
tmp = -1.0;
} else if (t <= 7.6e-5) {
tmp = t_1;
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
function code(x, l, t) t_1 = Float64(t * Float64(sqrt(2.0) / sqrt(Float64(Float64(Float64(l * l) / x) + Float64(Float64(2.0 * Float64(Float64(t * t) + Float64(Float64(t * t) / x))) + Float64(fma(Float64(t * 2.0), t, Float64(l * l)) / x)))))) tmp = 0.0 if (t <= -1.65e-9) tmp = Float64(-sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)))); elseif (t <= -4.4e-166) tmp = t_1; elseif (t <= -2.4e-253) tmp = -1.0; elseif (t <= 7.6e-5) tmp = t_1; else tmp = Float64(1.0 + Float64(-1.0 / x)); end return tmp end
code[x_, l_, t_] := Block[{t$95$1 = N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(N[(N[(l * l), $MachinePrecision] / x), $MachinePrecision] + N[(N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t * 2.0), $MachinePrecision] * t + N[(l * l), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.65e-9], (-N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[t, -4.4e-166], t$95$1, If[LessEqual[t, -2.4e-253], -1.0, If[LessEqual[t, 7.6e-5], t$95$1, N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{\sqrt{2}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(t \cdot t + \frac{t \cdot t}{x}\right) + \frac{\mathsf{fma}\left(t \cdot 2, t, \ell \cdot \ell\right)}{x}\right)}}\\
\mathbf{if}\;t \leq -1.65 \cdot 10^{-9}:\\
\;\;\;\;-\sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{elif}\;t \leq -4.4 \cdot 10^{-166}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2.4 \cdot 10^{-253}:\\
\;\;\;\;-1\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -1.65000000000000009e-9Initial program 39.9%
associate-/l*40.0%
fma-neg40.0%
remove-double-neg40.0%
fma-neg40.0%
sub-neg40.0%
metadata-eval40.0%
remove-double-neg40.0%
fma-def40.0%
Simplified40.0%
Applied egg-rr82.8%
Taylor expanded in t around -inf 91.4%
mul-1-neg91.4%
sub-neg91.4%
metadata-eval91.4%
Simplified91.4%
if -1.65000000000000009e-9 < t < -4.4000000000000002e-166 or -2.40000000000000009e-253 < t < 7.6000000000000004e-5Initial program 33.6%
associate-*l/33.8%
Simplified33.8%
Taylor expanded in x around inf 67.9%
associate--l+67.9%
unpow267.9%
distribute-lft-out67.9%
unpow267.9%
unpow267.9%
associate-*r/67.9%
mul-1-neg67.9%
+-commutative67.9%
unpow267.9%
associate-*l*67.9%
unpow267.9%
fma-udef67.9%
Simplified67.9%
if -4.4000000000000002e-166 < t < -2.40000000000000009e-253Initial program 2.1%
associate-*l/2.1%
Simplified2.1%
Applied egg-rr55.6%
Taylor expanded in t around -inf 61.2%
mul-1-neg61.2%
sub-neg61.2%
metadata-eval61.2%
Simplified61.2%
Taylor expanded in x around inf 61.3%
if 7.6000000000000004e-5 < t Initial program 33.0%
associate-*l/33.0%
Simplified33.0%
Applied egg-rr76.7%
Taylor expanded in t around -inf 1.6%
mul-1-neg1.6%
sub-neg1.6%
metadata-eval1.6%
Simplified1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt90.6%
metadata-eval90.6%
Simplified90.6%
Final simplification80.1%
(FPCore (x l t)
:precision binary64
(let* ((t_1 (/ (sqrt 2.0) (/ (sqrt (/ (+ (* l l) (* l l)) x)) t))))
(if (<= t -1.7e-255)
(- (sqrt (/ (+ x -1.0) (+ x 1.0))))
(if (<= t 2.6e-227)
t_1
(if (<= t 2.2e-211)
1.0
(if (<= t 6.2e-162)
t_1
(if (<= t 7.6e-5)
(/
(sqrt (* t (* t 2.0)))
(sqrt
(+
(/ (* l l) x)
(+
(* 2.0 (+ (* t t) (/ (* t t) x)))
(/ (+ (* l l) (* 2.0 (* t t))) x)))))
(+ 1.0 (/ -1.0 x)))))))))
double code(double x, double l, double t) {
double t_1 = sqrt(2.0) / (sqrt((((l * l) + (l * l)) / x)) / t);
double tmp;
if (t <= -1.7e-255) {
tmp = -sqrt(((x + -1.0) / (x + 1.0)));
} else if (t <= 2.6e-227) {
tmp = t_1;
} else if (t <= 2.2e-211) {
tmp = 1.0;
} else if (t <= 6.2e-162) {
tmp = t_1;
} else if (t <= 7.6e-5) {
tmp = sqrt((t * (t * 2.0))) / sqrt((((l * l) / x) + ((2.0 * ((t * t) + ((t * t) / x))) + (((l * l) + (2.0 * (t * t))) / x))));
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
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(2.0d0) / (sqrt((((l * l) + (l * l)) / x)) / t)
if (t <= (-1.7d-255)) then
tmp = -sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
else if (t <= 2.6d-227) then
tmp = t_1
else if (t <= 2.2d-211) then
tmp = 1.0d0
else if (t <= 6.2d-162) then
tmp = t_1
else if (t <= 7.6d-5) then
tmp = sqrt((t * (t * 2.0d0))) / sqrt((((l * l) / x) + ((2.0d0 * ((t * t) + ((t * t) / x))) + (((l * l) + (2.0d0 * (t * t))) / x))))
else
tmp = 1.0d0 + ((-1.0d0) / x)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(2.0) / (Math.sqrt((((l * l) + (l * l)) / x)) / t);
double tmp;
if (t <= -1.7e-255) {
tmp = -Math.sqrt(((x + -1.0) / (x + 1.0)));
} else if (t <= 2.6e-227) {
tmp = t_1;
} else if (t <= 2.2e-211) {
tmp = 1.0;
} else if (t <= 6.2e-162) {
tmp = t_1;
} else if (t <= 7.6e-5) {
tmp = Math.sqrt((t * (t * 2.0))) / Math.sqrt((((l * l) / x) + ((2.0 * ((t * t) + ((t * t) / x))) + (((l * l) + (2.0 * (t * t))) / x))));
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
def code(x, l, t): t_1 = math.sqrt(2.0) / (math.sqrt((((l * l) + (l * l)) / x)) / t) tmp = 0 if t <= -1.7e-255: tmp = -math.sqrt(((x + -1.0) / (x + 1.0))) elif t <= 2.6e-227: tmp = t_1 elif t <= 2.2e-211: tmp = 1.0 elif t <= 6.2e-162: tmp = t_1 elif t <= 7.6e-5: tmp = math.sqrt((t * (t * 2.0))) / math.sqrt((((l * l) / x) + ((2.0 * ((t * t) + ((t * t) / x))) + (((l * l) + (2.0 * (t * t))) / x)))) else: tmp = 1.0 + (-1.0 / x) return tmp
function code(x, l, t) t_1 = Float64(sqrt(2.0) / Float64(sqrt(Float64(Float64(Float64(l * l) + Float64(l * l)) / x)) / t)) tmp = 0.0 if (t <= -1.7e-255) tmp = Float64(-sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)))); elseif (t <= 2.6e-227) tmp = t_1; elseif (t <= 2.2e-211) tmp = 1.0; elseif (t <= 6.2e-162) tmp = t_1; elseif (t <= 7.6e-5) tmp = Float64(sqrt(Float64(t * Float64(t * 2.0))) / sqrt(Float64(Float64(Float64(l * l) / x) + Float64(Float64(2.0 * Float64(Float64(t * t) + Float64(Float64(t * t) / x))) + Float64(Float64(Float64(l * l) + Float64(2.0 * Float64(t * t))) / x))))); else tmp = Float64(1.0 + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, l, t) t_1 = sqrt(2.0) / (sqrt((((l * l) + (l * l)) / x)) / t); tmp = 0.0; if (t <= -1.7e-255) tmp = -sqrt(((x + -1.0) / (x + 1.0))); elseif (t <= 2.6e-227) tmp = t_1; elseif (t <= 2.2e-211) tmp = 1.0; elseif (t <= 6.2e-162) tmp = t_1; elseif (t <= 7.6e-5) tmp = sqrt((t * (t * 2.0))) / sqrt((((l * l) / x) + ((2.0 * ((t * t) + ((t * t) / x))) + (((l * l) + (2.0 * (t * t))) / x)))); else tmp = 1.0 + (-1.0 / x); end tmp_2 = tmp; end
code[x_, l_, t_] := Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[Sqrt[N[(N[(N[(l * l), $MachinePrecision] + N[(l * l), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.7e-255], (-N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[t, 2.6e-227], t$95$1, If[LessEqual[t, 2.2e-211], 1.0, If[LessEqual[t, 6.2e-162], t$95$1, If[LessEqual[t, 7.6e-5], N[(N[Sqrt[N[(t * N[(t * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(N[(l * l), $MachinePrecision] / x), $MachinePrecision] + N[(N[(2.0 * N[(N[(t * t), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sqrt{2}}{\frac{\sqrt{\frac{\ell \cdot \ell + \ell \cdot \ell}{x}}}{t}}\\
\mathbf{if}\;t \leq -1.7 \cdot 10^{-255}:\\
\;\;\;\;-\sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-227}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-211}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-162}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{t \cdot \left(t \cdot 2\right)}}{\sqrt{\frac{\ell \cdot \ell}{x} + \left(2 \cdot \left(t \cdot t + \frac{t \cdot t}{x}\right) + \frac{\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -1.69999999999999992e-255Initial program 36.7%
associate-/l*36.7%
fma-neg36.7%
remove-double-neg36.7%
fma-neg36.7%
sub-neg36.7%
metadata-eval36.7%
remove-double-neg36.7%
fma-def36.7%
Simplified36.7%
Applied egg-rr72.7%
Taylor expanded in t around -inf 81.6%
mul-1-neg81.6%
sub-neg81.6%
metadata-eval81.6%
Simplified81.6%
if -1.69999999999999992e-255 < t < 2.60000000000000011e-227 or 2.19999999999999998e-211 < t < 6.1999999999999997e-162Initial program 2.0%
associate-/l*2.0%
fma-neg2.0%
remove-double-neg2.0%
fma-neg2.0%
sub-neg2.0%
metadata-eval2.0%
remove-double-neg2.0%
fma-def2.0%
Simplified2.0%
Taylor expanded in t around 0 8.5%
associate-*l/8.5%
*-lft-identity8.5%
*-commutative8.5%
unpow28.5%
+-commutative8.5%
sub-neg8.5%
metadata-eval8.5%
+-commutative8.5%
unpow28.5%
Simplified8.5%
Taylor expanded in x around inf 55.0%
sub-neg55.0%
unpow255.0%
neg-mul-155.0%
remove-double-neg55.0%
unpow255.0%
Simplified55.0%
if 2.60000000000000011e-227 < t < 2.19999999999999998e-211Initial program 3.1%
associate-*l/3.1%
Simplified3.1%
Applied egg-rr55.6%
Taylor expanded in t around -inf 1.6%
mul-1-neg1.6%
sub-neg1.6%
metadata-eval1.6%
Simplified1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt81.7%
metadata-eval81.7%
Simplified81.7%
if 6.1999999999999997e-162 < t < 7.6000000000000004e-5Initial program 56.2%
add-sqr-sqrt56.0%
sqrt-prod57.7%
sqrt-prod58.2%
associate-*r*56.7%
Applied egg-rr56.7%
Taylor expanded in x around inf 77.8%
associate--l+77.8%
unpow277.8%
distribute-lft-out77.8%
unpow277.8%
unpow277.8%
associate-*r/77.8%
mul-1-neg77.8%
unpow277.8%
unpow277.8%
Simplified77.8%
if 7.6000000000000004e-5 < t Initial program 33.0%
associate-*l/33.0%
Simplified33.0%
Applied egg-rr76.7%
Taylor expanded in t around -inf 1.6%
mul-1-neg1.6%
sub-neg1.6%
metadata-eval1.6%
Simplified1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt90.6%
metadata-eval90.6%
Simplified90.6%
Final simplification79.7%
(FPCore (x l t)
:precision binary64
(let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0)))))
(if (<= t -1.1e-252)
(- t_1)
(if (<= t 3.6e-227)
(/ (sqrt 2.0) (/ (sqrt (/ (+ (* l l) (* l l)) x)) t))
t_1))))
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.1e-252) {
tmp = -t_1;
} else if (t <= 3.6e-227) {
tmp = sqrt(2.0) / (sqrt((((l * l) + (l * l)) / x)) / t);
} else {
tmp = t_1;
}
return tmp;
}
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.1d-252)) then
tmp = -t_1
else if (t <= 3.6d-227) then
tmp = sqrt(2.0d0) / (sqrt((((l * l) + (l * l)) / x)) / t)
else
tmp = t_1
end if
code = tmp
end function
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.1e-252) {
tmp = -t_1;
} else if (t <= 3.6e-227) {
tmp = Math.sqrt(2.0) / (Math.sqrt((((l * l) + (l * l)) / x)) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -1.1e-252: tmp = -t_1 elif t <= 3.6e-227: tmp = math.sqrt(2.0) / (math.sqrt((((l * l) + (l * l)) / x)) / t) else: tmp = t_1 return tmp
function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -1.1e-252) tmp = Float64(-t_1); elseif (t <= 3.6e-227) tmp = Float64(sqrt(2.0) / Float64(sqrt(Float64(Float64(Float64(l * l) + Float64(l * l)) / x)) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -1.1e-252) tmp = -t_1; elseif (t <= 3.6e-227) tmp = sqrt(2.0) / (sqrt((((l * l) + (l * l)) / x)) / t); else tmp = t_1; end tmp_2 = tmp; end
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.1e-252], (-t$95$1), If[LessEqual[t, 3.6e-227], N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[Sqrt[N[(N[(N[(l * l), $MachinePrecision] + N[(l * l), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -1.1 \cdot 10^{-252}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-227}:\\
\;\;\;\;\frac{\sqrt{2}}{\frac{\sqrt{\frac{\ell \cdot \ell + \ell \cdot \ell}{x}}}{t}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.09999999999999995e-252Initial program 36.7%
associate-/l*36.7%
fma-neg36.7%
remove-double-neg36.7%
fma-neg36.7%
sub-neg36.7%
metadata-eval36.7%
remove-double-neg36.7%
fma-def36.7%
Simplified36.7%
Applied egg-rr72.7%
Taylor expanded in t around -inf 81.6%
mul-1-neg81.6%
sub-neg81.6%
metadata-eval81.6%
Simplified81.6%
if -1.09999999999999995e-252 < t < 3.5999999999999999e-227Initial program 2.1%
associate-/l*2.1%
fma-neg2.1%
remove-double-neg2.1%
fma-neg2.1%
sub-neg2.1%
metadata-eval2.1%
remove-double-neg2.1%
fma-def2.1%
Simplified2.1%
Taylor expanded in t around 0 12.2%
associate-*l/12.2%
*-lft-identity12.2%
*-commutative12.2%
unpow212.2%
+-commutative12.2%
sub-neg12.2%
metadata-eval12.2%
+-commutative12.2%
unpow212.2%
Simplified12.2%
Taylor expanded in x around inf 58.1%
sub-neg58.1%
unpow258.1%
neg-mul-158.1%
remove-double-neg58.1%
unpow258.1%
Simplified58.1%
if 3.5999999999999999e-227 < t Initial program 36.1%
associate-/l*36.1%
fma-neg36.1%
remove-double-neg36.1%
fma-neg36.1%
sub-neg36.1%
metadata-eval36.1%
remove-double-neg36.1%
fma-def36.1%
Simplified36.1%
Applied egg-rr69.8%
Taylor expanded in t around inf 76.6%
Final simplification77.4%
(FPCore (x l t) :precision binary64 (let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0))))) (if (<= t -5e-311) (- t_1) t_1)))
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -5e-311) {
tmp = -t_1;
} else {
tmp = t_1;
}
return tmp;
}
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-311)) then
tmp = -t_1
else
tmp = t_1
end if
code = tmp
end function
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-311) {
tmp = -t_1;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -5e-311: tmp = -t_1 else: tmp = t_1 return tmp
function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -5e-311) tmp = Float64(-t_1); else tmp = t_1; end return tmp end
function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -5e-311) tmp = -t_1; else tmp = t_1; end tmp_2 = tmp; end
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-311], (-t$95$1), t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -5 \cdot 10^{-311}:\\
\;\;\;\;-t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -5.00000000000023e-311Initial program 34.5%
associate-/l*34.5%
fma-neg34.5%
remove-double-neg34.5%
fma-neg34.5%
sub-neg34.5%
metadata-eval34.5%
remove-double-neg34.5%
fma-def34.5%
Simplified34.5%
Applied egg-rr69.3%
Taylor expanded in t around -inf 78.3%
mul-1-neg78.3%
sub-neg78.3%
metadata-eval78.3%
Simplified78.3%
if -5.00000000000023e-311 < t Initial program 32.6%
associate-/l*32.6%
fma-neg32.6%
remove-double-neg32.6%
fma-neg32.6%
sub-neg32.6%
metadata-eval32.6%
remove-double-neg32.6%
fma-def32.6%
Simplified32.6%
Applied egg-rr66.3%
Taylor expanded in t around inf 71.9%
Final simplification75.1%
(FPCore (x l t) :precision binary64 (if (<= t -4.8e-308) (+ (/ 1.0 x) (- -1.0 (/ 0.5 (* x x)))) (sqrt (/ (+ x -1.0) (+ x 1.0)))))
double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = sqrt(((x + -1.0) / (x + 1.0)));
}
return tmp;
}
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 <= (-4.8d-308)) 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
public static double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -4.8e-308: tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))) else: tmp = math.sqrt(((x + -1.0) / (x + 1.0))) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -4.8e-308) 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
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -4.8e-308) tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))); else tmp = sqrt(((x + -1.0) / (x + 1.0))); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -4.8e-308], 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}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-308}:\\
\;\;\;\;\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.80000000000000016e-308Initial program 34.8%
associate-*l/34.9%
Simplified34.9%
Applied egg-rr63.6%
Taylor expanded in t around -inf 78.6%
mul-1-neg78.6%
sub-neg78.6%
metadata-eval78.6%
Simplified78.6%
Taylor expanded in x around inf 78.5%
associate-*r/78.5%
metadata-eval78.5%
unpow278.5%
Simplified78.5%
if -4.80000000000000016e-308 < t Initial program 32.4%
associate-/l*32.4%
fma-neg32.4%
remove-double-neg32.4%
fma-neg32.4%
sub-neg32.4%
metadata-eval32.4%
remove-double-neg32.4%
fma-def32.4%
Simplified32.4%
Applied egg-rr66.6%
Taylor expanded in t around inf 71.3%
Final simplification74.9%
(FPCore (x l t) :precision binary64 (if (<= t -4.8e-308) (+ (/ 1.0 x) (- -1.0 (/ 0.5 (* x x)))) (+ 1.0 (/ -1.0 x))))
double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
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 <= (-4.8d-308)) then
tmp = (1.0d0 / x) + ((-1.0d0) - (0.5d0 / (x * x)))
else
tmp = 1.0d0 + ((-1.0d0) / x)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x)));
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -4.8e-308: tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))) else: tmp = 1.0 + (-1.0 / x) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -4.8e-308) tmp = Float64(Float64(1.0 / x) + Float64(-1.0 - Float64(0.5 / Float64(x * x)))); else tmp = Float64(1.0 + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -4.8e-308) tmp = (1.0 / x) + (-1.0 - (0.5 / (x * x))); else tmp = 1.0 + (-1.0 / x); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -4.8e-308], N[(N[(1.0 / x), $MachinePrecision] + N[(-1.0 - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{1}{x} + \left(-1 - \frac{0.5}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -4.80000000000000016e-308Initial program 34.8%
associate-*l/34.9%
Simplified34.9%
Applied egg-rr63.6%
Taylor expanded in t around -inf 78.6%
mul-1-neg78.6%
sub-neg78.6%
metadata-eval78.6%
Simplified78.6%
Taylor expanded in x around inf 78.5%
associate-*r/78.5%
metadata-eval78.5%
unpow278.5%
Simplified78.5%
if -4.80000000000000016e-308 < t Initial program 32.4%
associate-*l/32.5%
Simplified32.5%
Applied egg-rr61.6%
Taylor expanded in t around -inf 1.8%
mul-1-neg1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt71.3%
metadata-eval71.3%
Simplified71.3%
Final simplification74.9%
(FPCore (x l t) :precision binary64 (if (<= t -4.8e-308) -1.0 (+ 1.0 (/ -1.0 x))))
double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = -1.0;
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
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 <= (-4.8d-308)) then
tmp = -1.0d0
else
tmp = 1.0d0 + ((-1.0d0) / x)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = -1.0;
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -4.8e-308: tmp = -1.0 else: tmp = 1.0 + (-1.0 / x) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -4.8e-308) tmp = -1.0; else tmp = Float64(1.0 + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -4.8e-308) tmp = -1.0; else tmp = 1.0 + (-1.0 / x); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -4.8e-308], -1.0, N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-308}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -4.80000000000000016e-308Initial program 34.8%
associate-*l/34.9%
Simplified34.9%
Applied egg-rr63.6%
Taylor expanded in t around -inf 78.6%
mul-1-neg78.6%
sub-neg78.6%
metadata-eval78.6%
Simplified78.6%
Taylor expanded in x around inf 77.3%
if -4.80000000000000016e-308 < t Initial program 32.4%
associate-*l/32.5%
Simplified32.5%
Applied egg-rr61.6%
Taylor expanded in t around -inf 1.8%
mul-1-neg1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt71.3%
metadata-eval71.3%
Simplified71.3%
Final simplification74.3%
(FPCore (x l t) :precision binary64 (if (<= t -4.8e-308) (+ -1.0 (/ 1.0 x)) (+ 1.0 (/ -1.0 x))))
double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
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 <= (-4.8d-308)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = 1.0d0 + ((-1.0d0) / x)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -4.8e-308: tmp = -1.0 + (1.0 / x) else: tmp = 1.0 + (-1.0 / x) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -4.8e-308) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = Float64(1.0 + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -4.8e-308) tmp = -1.0 + (1.0 / x); else tmp = 1.0 + (-1.0 / x); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -4.8e-308], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-308}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -4.80000000000000016e-308Initial program 34.8%
associate-*l/34.9%
Simplified34.9%
Applied egg-rr63.6%
Taylor expanded in t around -inf 78.6%
mul-1-neg78.6%
sub-neg78.6%
metadata-eval78.6%
Simplified78.6%
Taylor expanded in x around inf 78.1%
if -4.80000000000000016e-308 < t Initial program 32.4%
associate-*l/32.5%
Simplified32.5%
Applied egg-rr61.6%
Taylor expanded in t around -inf 1.8%
mul-1-neg1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt71.3%
metadata-eval71.3%
Simplified71.3%
Final simplification74.7%
(FPCore (x l t) :precision binary64 (if (<= t -4.8e-308) -1.0 1.0))
double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
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 <= (-4.8d-308)) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -4.8e-308) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -4.8e-308: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, l, t) tmp = 0.0 if (t <= -4.8e-308) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -4.8e-308) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -4.8e-308], -1.0, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-308}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -4.80000000000000016e-308Initial program 34.8%
associate-*l/34.9%
Simplified34.9%
Applied egg-rr63.6%
Taylor expanded in t around -inf 78.6%
mul-1-neg78.6%
sub-neg78.6%
metadata-eval78.6%
Simplified78.6%
Taylor expanded in x around inf 77.3%
if -4.80000000000000016e-308 < t Initial program 32.4%
associate-*l/32.5%
Simplified32.5%
Applied egg-rr61.6%
Taylor expanded in t around -inf 1.8%
mul-1-neg1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt71.1%
metadata-eval71.1%
Simplified71.1%
Final simplification74.2%
(FPCore (x l t) :precision binary64 -1.0)
double code(double x, double l, double t) {
return -1.0;
}
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
public static double code(double x, double l, double t) {
return -1.0;
}
def code(x, l, t): return -1.0
function code(x, l, t) return -1.0 end
function tmp = code(x, l, t) tmp = -1.0; end
code[x_, l_, t_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 33.6%
associate-*l/33.7%
Simplified33.7%
Applied egg-rr62.6%
Taylor expanded in t around -inf 39.9%
mul-1-neg39.9%
sub-neg39.9%
metadata-eval39.9%
Simplified39.9%
Taylor expanded in x around inf 39.3%
Final simplification39.3%
herbie shell --seed 2023221
(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)))))