
(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))))
(if (<= x -5.0)
(/ t (fabs t))
(/
t
(/ (hypot (* (sqrt 2.0) (/ (hypot l t_1) (sqrt x))) t_1) (sqrt 2.0))))))
double code(double x, double l, double t) {
double t_1 = t * sqrt(2.0);
double tmp;
if (x <= -5.0) {
tmp = t / fabs(t);
} else {
tmp = t / (hypot((sqrt(2.0) * (hypot(l, t_1) / sqrt(x))), t_1) / sqrt(2.0));
}
return tmp;
}
public static double code(double x, double l, double t) {
double t_1 = t * Math.sqrt(2.0);
double tmp;
if (x <= -5.0) {
tmp = t / Math.abs(t);
} else {
tmp = t / (Math.hypot((Math.sqrt(2.0) * (Math.hypot(l, t_1) / Math.sqrt(x))), t_1) / Math.sqrt(2.0));
}
return tmp;
}
def code(x, l, t): t_1 = t * math.sqrt(2.0) tmp = 0 if x <= -5.0: tmp = t / math.fabs(t) else: tmp = t / (math.hypot((math.sqrt(2.0) * (math.hypot(l, t_1) / math.sqrt(x))), t_1) / math.sqrt(2.0)) return tmp
function code(x, l, t) t_1 = Float64(t * sqrt(2.0)) tmp = 0.0 if (x <= -5.0) tmp = Float64(t / abs(t)); else tmp = Float64(t / Float64(hypot(Float64(sqrt(2.0) * Float64(hypot(l, t_1) / sqrt(x))), t_1) / sqrt(2.0))); end return tmp end
function tmp_2 = code(x, l, t) t_1 = t * sqrt(2.0); tmp = 0.0; if (x <= -5.0) tmp = t / abs(t); else tmp = t / (hypot((sqrt(2.0) * (hypot(l, t_1) / sqrt(x))), t_1) / sqrt(2.0)); end tmp_2 = tmp; end
code[x_, l_, t_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.0], N[(t / N[Abs[t], $MachinePrecision]), $MachinePrecision], N[(t / N[(N[Sqrt[N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[l ^ 2 + t$95$1 ^ 2], $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
\mathbf{if}\;x \leq -5:\\
\;\;\;\;\frac{t}{\left|t\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{\mathsf{hypot}\left(\sqrt{2} \cdot \frac{\mathsf{hypot}\left(\ell, t_1\right)}{\sqrt{x}}, t_1\right)}{\sqrt{2}}}\\
\end{array}
\end{array}
if x < -5Initial program 43.2%
Simplified43.3%
Taylor expanded in x around inf 46.9%
add-sqr-sqrt45.7%
sqrt-unprod52.6%
pow252.6%
associate-/l*52.7%
sqrt-undiv52.7%
metadata-eval52.7%
metadata-eval52.7%
Applied egg-rr52.7%
/-rgt-identity52.7%
unpow252.7%
rem-sqrt-square98.7%
Simplified98.7%
if -5 < x Initial program 29.9%
Simplified29.9%
Taylor expanded in x around inf 53.9%
add-sqr-sqrt53.9%
add-sqr-sqrt53.9%
hypot-def53.9%
Applied egg-rr97.6%
*-commutative97.6%
*-commutative97.6%
Simplified97.6%
Final simplification98.1%
(FPCore (x l t)
:precision binary64
(let* ((t_1 (* 2.0 (pow t 2.0))) (t_2 (/ t (fabs t))))
(if (<= l 5.6e-26)
t_2
(if (<= l 3.8e+47)
(/ t (/ (sqrt (+ t_1 (* 2.0 (/ (+ t_1 (pow l 2.0)) x)))) (sqrt 2.0)))
(if (<= l 6.2e+168)
t_2
(/
t
(*
(sqrt (+ (/ 1.0 (+ x -1.0)) (+ (/ 1.0 x) (/ 1.0 (pow x 2.0)))))
(/ l (sqrt 2.0)))))))))
double code(double x, double l, double t) {
double t_1 = 2.0 * pow(t, 2.0);
double t_2 = t / fabs(t);
double tmp;
if (l <= 5.6e-26) {
tmp = t_2;
} else if (l <= 3.8e+47) {
tmp = t / (sqrt((t_1 + (2.0 * ((t_1 + pow(l, 2.0)) / x)))) / sqrt(2.0));
} else if (l <= 6.2e+168) {
tmp = t_2;
} else {
tmp = t / (sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / pow(x, 2.0))))) * (l / sqrt(2.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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * (t ** 2.0d0)
t_2 = t / abs(t)
if (l <= 5.6d-26) then
tmp = t_2
else if (l <= 3.8d+47) then
tmp = t / (sqrt((t_1 + (2.0d0 * ((t_1 + (l ** 2.0d0)) / x)))) / sqrt(2.0d0))
else if (l <= 6.2d+168) then
tmp = t_2
else
tmp = t / (sqrt(((1.0d0 / (x + (-1.0d0))) + ((1.0d0 / x) + (1.0d0 / (x ** 2.0d0))))) * (l / sqrt(2.0d0)))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double t_1 = 2.0 * Math.pow(t, 2.0);
double t_2 = t / Math.abs(t);
double tmp;
if (l <= 5.6e-26) {
tmp = t_2;
} else if (l <= 3.8e+47) {
tmp = t / (Math.sqrt((t_1 + (2.0 * ((t_1 + Math.pow(l, 2.0)) / x)))) / Math.sqrt(2.0));
} else if (l <= 6.2e+168) {
tmp = t_2;
} else {
tmp = t / (Math.sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / Math.pow(x, 2.0))))) * (l / Math.sqrt(2.0)));
}
return tmp;
}
def code(x, l, t): t_1 = 2.0 * math.pow(t, 2.0) t_2 = t / math.fabs(t) tmp = 0 if l <= 5.6e-26: tmp = t_2 elif l <= 3.8e+47: tmp = t / (math.sqrt((t_1 + (2.0 * ((t_1 + math.pow(l, 2.0)) / x)))) / math.sqrt(2.0)) elif l <= 6.2e+168: tmp = t_2 else: tmp = t / (math.sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / math.pow(x, 2.0))))) * (l / math.sqrt(2.0))) return tmp
function code(x, l, t) t_1 = Float64(2.0 * (t ^ 2.0)) t_2 = Float64(t / abs(t)) tmp = 0.0 if (l <= 5.6e-26) tmp = t_2; elseif (l <= 3.8e+47) tmp = Float64(t / Float64(sqrt(Float64(t_1 + Float64(2.0 * Float64(Float64(t_1 + (l ^ 2.0)) / x)))) / sqrt(2.0))); elseif (l <= 6.2e+168) tmp = t_2; else tmp = Float64(t / Float64(sqrt(Float64(Float64(1.0 / Float64(x + -1.0)) + Float64(Float64(1.0 / x) + Float64(1.0 / (x ^ 2.0))))) * Float64(l / sqrt(2.0)))); end return tmp end
function tmp_2 = code(x, l, t) t_1 = 2.0 * (t ^ 2.0); t_2 = t / abs(t); tmp = 0.0; if (l <= 5.6e-26) tmp = t_2; elseif (l <= 3.8e+47) tmp = t / (sqrt((t_1 + (2.0 * ((t_1 + (l ^ 2.0)) / x)))) / sqrt(2.0)); elseif (l <= 6.2e+168) tmp = t_2; else tmp = t / (sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / (x ^ 2.0))))) * (l / sqrt(2.0))); end tmp_2 = tmp; end
code[x_, l_, t_] := Block[{t$95$1 = N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t / N[Abs[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 5.6e-26], t$95$2, If[LessEqual[l, 3.8e+47], N[(t / N[(N[Sqrt[N[(t$95$1 + N[(2.0 * N[(N[(t$95$1 + N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.2e+168], t$95$2, N[(t / N[(N[Sqrt[N[(N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot {t}^{2}\\
t_2 := \frac{t}{\left|t\right|}\\
\mathbf{if}\;\ell \leq 5.6 \cdot 10^{-26}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 3.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{t}{\frac{\sqrt{t_1 + 2 \cdot \frac{t_1 + {\ell}^{2}}{x}}}{\sqrt{2}}}\\
\mathbf{elif}\;\ell \leq 6.2 \cdot 10^{+168}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\sqrt{\frac{1}{x + -1} + \left(\frac{1}{x} + \frac{1}{{x}^{2}}\right)} \cdot \frac{\ell}{\sqrt{2}}}\\
\end{array}
\end{array}
if l < 5.6000000000000002e-26 or 3.8000000000000003e47 < l < 6.19999999999999993e168Initial program 38.8%
Simplified38.8%
Taylor expanded in x around inf 41.8%
add-sqr-sqrt40.6%
sqrt-unprod45.8%
pow245.8%
associate-/l*45.9%
sqrt-undiv45.9%
metadata-eval45.9%
metadata-eval45.9%
Applied egg-rr45.9%
/-rgt-identity45.9%
unpow245.9%
rem-sqrt-square81.1%
Simplified81.1%
if 5.6000000000000002e-26 < l < 3.8000000000000003e47Initial program 40.6%
Simplified40.5%
Taylor expanded in x around inf 82.8%
if 6.19999999999999993e168 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 8.7%
*-commutative8.7%
associate--l+26.6%
sub-neg26.6%
metadata-eval26.6%
+-commutative26.6%
sub-neg26.6%
metadata-eval26.6%
+-commutative26.6%
Simplified26.6%
Taylor expanded in x around inf 60.4%
Final simplification79.4%
(FPCore (x l t)
:precision binary64
(let* ((t_1 (/ t (fabs t))))
(if (<= l 3.4e-25)
t_1
(if (<= l 5.5e+48)
(/
t
(/
(sqrt (+ (* 2.0 (pow t 2.0)) (* 2.0 (/ (pow l 2.0) x))))
(sqrt 2.0)))
(if (<= l 5.4e+168)
t_1
(/
t
(*
(sqrt (+ (/ 1.0 (+ x -1.0)) (+ (/ 1.0 x) (/ 1.0 (pow x 2.0)))))
(/ l (sqrt 2.0)))))))))
double code(double x, double l, double t) {
double t_1 = t / fabs(t);
double tmp;
if (l <= 3.4e-25) {
tmp = t_1;
} else if (l <= 5.5e+48) {
tmp = t / (sqrt(((2.0 * pow(t, 2.0)) + (2.0 * (pow(l, 2.0) / x)))) / sqrt(2.0));
} else if (l <= 5.4e+168) {
tmp = t_1;
} else {
tmp = t / (sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / pow(x, 2.0))))) * (l / sqrt(2.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) :: t_1
real(8) :: tmp
t_1 = t / abs(t)
if (l <= 3.4d-25) then
tmp = t_1
else if (l <= 5.5d+48) then
tmp = t / (sqrt(((2.0d0 * (t ** 2.0d0)) + (2.0d0 * ((l ** 2.0d0) / x)))) / sqrt(2.0d0))
else if (l <= 5.4d+168) then
tmp = t_1
else
tmp = t / (sqrt(((1.0d0 / (x + (-1.0d0))) + ((1.0d0 / x) + (1.0d0 / (x ** 2.0d0))))) * (l / sqrt(2.0d0)))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double t_1 = t / Math.abs(t);
double tmp;
if (l <= 3.4e-25) {
tmp = t_1;
} else if (l <= 5.5e+48) {
tmp = t / (Math.sqrt(((2.0 * Math.pow(t, 2.0)) + (2.0 * (Math.pow(l, 2.0) / x)))) / Math.sqrt(2.0));
} else if (l <= 5.4e+168) {
tmp = t_1;
} else {
tmp = t / (Math.sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / Math.pow(x, 2.0))))) * (l / Math.sqrt(2.0)));
}
return tmp;
}
def code(x, l, t): t_1 = t / math.fabs(t) tmp = 0 if l <= 3.4e-25: tmp = t_1 elif l <= 5.5e+48: tmp = t / (math.sqrt(((2.0 * math.pow(t, 2.0)) + (2.0 * (math.pow(l, 2.0) / x)))) / math.sqrt(2.0)) elif l <= 5.4e+168: tmp = t_1 else: tmp = t / (math.sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / math.pow(x, 2.0))))) * (l / math.sqrt(2.0))) return tmp
function code(x, l, t) t_1 = Float64(t / abs(t)) tmp = 0.0 if (l <= 3.4e-25) tmp = t_1; elseif (l <= 5.5e+48) tmp = Float64(t / Float64(sqrt(Float64(Float64(2.0 * (t ^ 2.0)) + Float64(2.0 * Float64((l ^ 2.0) / x)))) / sqrt(2.0))); elseif (l <= 5.4e+168) tmp = t_1; else tmp = Float64(t / Float64(sqrt(Float64(Float64(1.0 / Float64(x + -1.0)) + Float64(Float64(1.0 / x) + Float64(1.0 / (x ^ 2.0))))) * Float64(l / sqrt(2.0)))); end return tmp end
function tmp_2 = code(x, l, t) t_1 = t / abs(t); tmp = 0.0; if (l <= 3.4e-25) tmp = t_1; elseif (l <= 5.5e+48) tmp = t / (sqrt(((2.0 * (t ^ 2.0)) + (2.0 * ((l ^ 2.0) / x)))) / sqrt(2.0)); elseif (l <= 5.4e+168) tmp = t_1; else tmp = t / (sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / (x ^ 2.0))))) * (l / sqrt(2.0))); end tmp_2 = tmp; end
code[x_, l_, t_] := Block[{t$95$1 = N[(t / N[Abs[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 3.4e-25], t$95$1, If[LessEqual[l, 5.5e+48], N[(t / N[(N[Sqrt[N[(N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e+168], t$95$1, N[(t / N[(N[Sqrt[N[(N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{\left|t\right|}\\
\mathbf{if}\;\ell \leq 3.4 \cdot 10^{-25}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+48}:\\
\;\;\;\;\frac{t}{\frac{\sqrt{2 \cdot {t}^{2} + 2 \cdot \frac{{\ell}^{2}}{x}}}{\sqrt{2}}}\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+168}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\sqrt{\frac{1}{x + -1} + \left(\frac{1}{x} + \frac{1}{{x}^{2}}\right)} \cdot \frac{\ell}{\sqrt{2}}}\\
\end{array}
\end{array}
if l < 3.40000000000000002e-25 or 5.5000000000000002e48 < l < 5.40000000000000031e168Initial program 38.8%
Simplified38.8%
Taylor expanded in x around inf 41.8%
add-sqr-sqrt40.6%
sqrt-unprod45.8%
pow245.8%
associate-/l*45.9%
sqrt-undiv45.9%
metadata-eval45.9%
metadata-eval45.9%
Applied egg-rr45.9%
/-rgt-identity45.9%
unpow245.9%
rem-sqrt-square81.1%
Simplified81.1%
if 3.40000000000000002e-25 < l < 5.5000000000000002e48Initial program 40.6%
Simplified40.5%
Taylor expanded in x around inf 82.8%
Taylor expanded in t around 0 83.1%
if 5.40000000000000031e168 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 8.7%
*-commutative8.7%
associate--l+26.6%
sub-neg26.6%
metadata-eval26.6%
+-commutative26.6%
sub-neg26.6%
metadata-eval26.6%
+-commutative26.6%
Simplified26.6%
Taylor expanded in x around inf 60.4%
Final simplification79.4%
(FPCore (x l t)
:precision binary64
(if (<= l 5.4e+168)
(/ t (fabs t))
(/
t
(*
(sqrt (+ (/ 1.0 (+ x -1.0)) (+ (/ 1.0 x) (/ 1.0 (pow x 2.0)))))
(/ l (sqrt 2.0))))))
double code(double x, double l, double t) {
double tmp;
if (l <= 5.4e+168) {
tmp = t / fabs(t);
} else {
tmp = t / (sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / pow(x, 2.0))))) * (l / sqrt(2.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 (l <= 5.4d+168) then
tmp = t / abs(t)
else
tmp = t / (sqrt(((1.0d0 / (x + (-1.0d0))) + ((1.0d0 / x) + (1.0d0 / (x ** 2.0d0))))) * (l / sqrt(2.0d0)))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (l <= 5.4e+168) {
tmp = t / Math.abs(t);
} else {
tmp = t / (Math.sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / Math.pow(x, 2.0))))) * (l / Math.sqrt(2.0)));
}
return tmp;
}
def code(x, l, t): tmp = 0 if l <= 5.4e+168: tmp = t / math.fabs(t) else: tmp = t / (math.sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / math.pow(x, 2.0))))) * (l / math.sqrt(2.0))) return tmp
function code(x, l, t) tmp = 0.0 if (l <= 5.4e+168) tmp = Float64(t / abs(t)); else tmp = Float64(t / Float64(sqrt(Float64(Float64(1.0 / Float64(x + -1.0)) + Float64(Float64(1.0 / x) + Float64(1.0 / (x ^ 2.0))))) * Float64(l / sqrt(2.0)))); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (l <= 5.4e+168) tmp = t / abs(t); else tmp = t / (sqrt(((1.0 / (x + -1.0)) + ((1.0 / x) + (1.0 / (x ^ 2.0))))) * (l / sqrt(2.0))); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[l, 5.4e+168], N[(t / N[Abs[t], $MachinePrecision]), $MachinePrecision], N[(t / N[(N[Sqrt[N[(N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.4 \cdot 10^{+168}:\\
\;\;\;\;\frac{t}{\left|t\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\sqrt{\frac{1}{x + -1} + \left(\frac{1}{x} + \frac{1}{{x}^{2}}\right)} \cdot \frac{\ell}{\sqrt{2}}}\\
\end{array}
\end{array}
if l < 5.40000000000000031e168Initial program 38.8%
Simplified38.8%
Taylor expanded in x around inf 40.3%
add-sqr-sqrt39.1%
sqrt-unprod45.8%
pow245.8%
associate-/l*45.9%
sqrt-undiv45.9%
metadata-eval45.9%
metadata-eval45.9%
Applied egg-rr45.9%
/-rgt-identity45.9%
unpow245.9%
rem-sqrt-square79.7%
Simplified79.7%
if 5.40000000000000031e168 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 8.7%
*-commutative8.7%
associate--l+26.6%
sub-neg26.6%
metadata-eval26.6%
+-commutative26.6%
sub-neg26.6%
metadata-eval26.6%
+-commutative26.6%
Simplified26.6%
Taylor expanded in x around inf 60.4%
Final simplification78.1%
(FPCore (x l t) :precision binary64 (if (<= l 5.5e+168) (/ t (fabs t)) (* t (/ (sqrt x) l))))
double code(double x, double l, double t) {
double tmp;
if (l <= 5.5e+168) {
tmp = t / fabs(t);
} else {
tmp = t * (sqrt(x) / l);
}
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 (l <= 5.5d+168) then
tmp = t / abs(t)
else
tmp = t * (sqrt(x) / l)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (l <= 5.5e+168) {
tmp = t / Math.abs(t);
} else {
tmp = t * (Math.sqrt(x) / l);
}
return tmp;
}
def code(x, l, t): tmp = 0 if l <= 5.5e+168: tmp = t / math.fabs(t) else: tmp = t * (math.sqrt(x) / l) return tmp
function code(x, l, t) tmp = 0.0 if (l <= 5.5e+168) tmp = Float64(t / abs(t)); else tmp = Float64(t * Float64(sqrt(x) / l)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (l <= 5.5e+168) tmp = t / abs(t); else tmp = t * (sqrt(x) / l); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[l, 5.5e+168], N[(t / N[Abs[t], $MachinePrecision]), $MachinePrecision], N[(t * N[(N[Sqrt[x], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.5 \cdot 10^{+168}:\\
\;\;\;\;\frac{t}{\left|t\right|}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{\sqrt{x}}{\ell}\\
\end{array}
\end{array}
if l < 5.5000000000000001e168Initial program 38.8%
Simplified38.8%
Taylor expanded in x around inf 40.3%
add-sqr-sqrt39.1%
sqrt-unprod45.8%
pow245.8%
associate-/l*45.9%
sqrt-undiv45.9%
metadata-eval45.9%
metadata-eval45.9%
Applied egg-rr45.9%
/-rgt-identity45.9%
unpow245.9%
rem-sqrt-square79.7%
Simplified79.7%
if 5.5000000000000001e168 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 8.3%
*-commutative8.3%
associate--l+26.0%
sub-neg26.0%
metadata-eval26.0%
+-commutative26.0%
sub-neg26.0%
metadata-eval26.0%
+-commutative26.0%
Simplified26.0%
Taylor expanded in x around inf 51.8%
*-commutative51.8%
Simplified51.8%
expm1-log1p-u50.9%
expm1-udef16.7%
associate-*r*16.7%
*-commutative16.7%
sqrt-unprod16.7%
Applied egg-rr16.7%
expm1-def51.1%
expm1-log1p52.0%
associate-*l/59.2%
*-commutative59.2%
associate-*l/59.5%
*-commutative59.5%
*-commutative59.5%
associate-*l*59.5%
metadata-eval59.5%
Simplified59.5%
Final simplification78.0%
(FPCore (x l t) :precision binary64 (/ t (fabs t)))
double code(double x, double l, double t) {
return t / fabs(t);
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = t / abs(t)
end function
public static double code(double x, double l, double t) {
return t / Math.abs(t);
}
def code(x, l, t): return t / math.fabs(t)
function code(x, l, t) return Float64(t / abs(t)) end
function tmp = code(x, l, t) tmp = t / abs(t); end
code[x_, l_, t_] := N[(t / N[Abs[t], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{\left|t\right|}
\end{array}
Initial program 35.5%
Simplified35.5%
Taylor expanded in x around inf 37.8%
add-sqr-sqrt36.6%
sqrt-unprod42.5%
pow242.5%
associate-/l*42.6%
sqrt-undiv42.6%
metadata-eval42.6%
metadata-eval42.6%
Applied egg-rr42.6%
/-rgt-identity42.6%
unpow242.6%
rem-sqrt-square76.3%
Simplified76.3%
Final simplification76.3%
(FPCore (x l t) :precision binary64 (if (<= t -2e-310) (+ -1.0 (/ 1.0 x)) 1.0))
double code(double x, double l, double t) {
double tmp;
if (t <= -2e-310) {
tmp = -1.0 + (1.0 / x);
} 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 <= (-2d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -2e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -2e-310: tmp = -1.0 + (1.0 / x) else: tmp = 1.0 return tmp
function code(x, l, t) tmp = 0.0 if (t <= -2e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -2e-310) tmp = -1.0 + (1.0 / x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -2e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -1.999999999999994e-310Initial program 30.6%
Simplified30.5%
Applied egg-rr64.2%
Taylor expanded in t around inf 1.7%
Taylor expanded in x around -inf 0.0%
+-commutative0.0%
unpow20.0%
rem-square-sqrt75.9%
Simplified75.9%
if -1.999999999999994e-310 < t Initial program 40.8%
Simplified40.8%
Applied egg-rr73.9%
Taylor expanded in t around inf 78.4%
Taylor expanded in x around inf 77.0%
Final simplification76.4%
(FPCore (x l t) :precision binary64 (if (<= t -2e-310) (+ -1.0 (/ 1.0 x)) (+ 1.0 (/ -1.0 x))))
double code(double x, double l, double t) {
double tmp;
if (t <= -2e-310) {
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 <= (-2d-310)) 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 <= -2e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -2e-310: 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 <= -2e-310) 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 <= -2e-310) 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, -2e-310], 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 -2 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -1.999999999999994e-310Initial program 30.6%
Simplified30.5%
Applied egg-rr64.2%
Taylor expanded in t around inf 1.7%
Taylor expanded in x around -inf 0.0%
+-commutative0.0%
unpow20.0%
rem-square-sqrt75.9%
Simplified75.9%
if -1.999999999999994e-310 < t Initial program 40.8%
Simplified40.8%
Applied egg-rr73.9%
Taylor expanded in t around inf 78.4%
Taylor expanded in x around inf 78.1%
Final simplification77.0%
(FPCore (x l t) :precision binary64 (if (<= t -2e-310) -1.0 1.0))
double code(double x, double l, double t) {
double tmp;
if (t <= -2e-310) {
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 <= (-2d-310)) 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 <= -2e-310) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -2e-310: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, l, t) tmp = 0.0 if (t <= -2e-310) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -2e-310) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -2e-310], -1.0, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -1.999999999999994e-310Initial program 30.6%
Simplified30.5%
Applied egg-rr64.2%
Taylor expanded in t around inf 1.7%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt75.6%
Simplified75.6%
if -1.999999999999994e-310 < t Initial program 40.8%
Simplified40.8%
Applied egg-rr73.9%
Taylor expanded in t around inf 78.4%
Taylor expanded in x around inf 77.0%
Final simplification76.3%
(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 35.5%
Simplified35.4%
Applied egg-rr68.8%
Taylor expanded in t around inf 38.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt40.1%
Simplified40.1%
Final simplification40.1%
herbie shell --seed 2023307
(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)))))