
(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}
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= l_m 6.2e+177)
(sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
(/ (* (* t_m (sqrt 2.0)) (sqrt (fma x 0.5 -0.5))) l_m))))l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 6.2e+177) {
tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
} else {
tmp = ((t_m * sqrt(2.0)) * sqrt(fma(x, 0.5, -0.5))) / l_m;
}
return t_s * tmp;
}
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) tmp = 0.0 if (l_m <= 6.2e+177) tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0)))); else tmp = Float64(Float64(Float64(t_m * sqrt(2.0)) * sqrt(fma(x, 0.5, -0.5))) / l_m); end return Float64(t_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 6.2e+177], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(x * 0.5 + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 6.2 \cdot 10^{+177}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(t_m \cdot \sqrt{2}\right) \cdot \sqrt{\mathsf{fma}\left(x, 0.5, -0.5\right)}}{l_m}\\
\end{array}
\end{array}
if l < 6.1999999999999998e177Initial program 36.2%
Simplified36.1%
Taylor expanded in t around inf 40.5%
add-log-exp39.7%
associate-*l*39.7%
pow1/239.7%
pow1/239.7%
+-commutative39.7%
pow-prod-down39.7%
+-commutative39.7%
sub-neg39.7%
metadata-eval39.7%
Applied egg-rr39.7%
Applied egg-rr40.6%
expm1-def40.6%
expm1-log1p40.6%
associate-*r/40.6%
metadata-eval40.6%
*-commutative40.6%
+-commutative40.6%
Simplified40.6%
if 6.1999999999999998e177 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 1.8%
*-commutative1.8%
associate--l+13.1%
sub-neg13.1%
metadata-eval13.1%
+-commutative13.1%
sub-neg13.1%
metadata-eval13.1%
+-commutative13.1%
Simplified13.1%
Taylor expanded in x around 0 26.3%
Taylor expanded in t around 0 26.3%
associate-*l/56.7%
*-commutative56.7%
fma-neg56.7%
metadata-eval56.7%
Applied egg-rr56.7%
Final simplification41.7%
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= l_m 2.8e+180)
(sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
(* (sqrt 2.0) (/ 1.0 (/ l_m (* t_m (sqrt (- (* x 0.5) 0.5)))))))))l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 2.8e+180) {
tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
} else {
tmp = sqrt(2.0) * (1.0 / (l_m / (t_m * sqrt(((x * 0.5) - 0.5)))));
}
return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: l_m
real(8), intent (in) :: t_m
real(8) :: tmp
if (l_m <= 2.8d+180) then
tmp = sqrt((2.0d0 / ((2.0d0 + (2.0d0 * x)) / (x + (-1.0d0)))))
else
tmp = sqrt(2.0d0) * (1.0d0 / (l_m / (t_m * sqrt(((x * 0.5d0) - 0.5d0)))))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 2.8e+180) {
tmp = Math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
} else {
tmp = Math.sqrt(2.0) * (1.0 / (l_m / (t_m * Math.sqrt(((x * 0.5) - 0.5)))));
}
return t_s * tmp;
}
l_m = math.fabs(l) t_m = math.fabs(t) t_s = math.copysign(1.0, t) def code(t_s, x, l_m, t_m): tmp = 0 if l_m <= 2.8e+180: tmp = math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0)))) else: tmp = math.sqrt(2.0) * (1.0 / (l_m / (t_m * math.sqrt(((x * 0.5) - 0.5))))) return t_s * tmp
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) tmp = 0.0 if (l_m <= 2.8e+180) tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0)))); else tmp = Float64(sqrt(2.0) * Float64(1.0 / Float64(l_m / Float64(t_m * sqrt(Float64(Float64(x * 0.5) - 0.5)))))); end return Float64(t_s * tmp) end
l_m = abs(l); t_m = abs(t); t_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, x, l_m, t_m) tmp = 0.0; if (l_m <= 2.8e+180) tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0)))); else tmp = sqrt(2.0) * (1.0 / (l_m / (t_m * sqrt(((x * 0.5) - 0.5))))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 2.8e+180], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(1.0 / N[(l$95$m / N[(t$95$m * N[Sqrt[N[(N[(x * 0.5), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 2.8 \cdot 10^{+180}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{1}{\frac{l_m}{t_m \cdot \sqrt{x \cdot 0.5 - 0.5}}}\\
\end{array}
\end{array}
if l < 2.80000000000000012e180Initial program 36.2%
Simplified36.1%
Taylor expanded in t around inf 40.5%
add-log-exp39.7%
associate-*l*39.7%
pow1/239.7%
pow1/239.7%
+-commutative39.7%
pow-prod-down39.7%
+-commutative39.7%
sub-neg39.7%
metadata-eval39.7%
Applied egg-rr39.7%
Applied egg-rr40.6%
expm1-def40.6%
expm1-log1p40.6%
associate-*r/40.6%
metadata-eval40.6%
*-commutative40.6%
+-commutative40.6%
Simplified40.6%
if 2.80000000000000012e180 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 1.8%
*-commutative1.8%
associate--l+13.1%
sub-neg13.1%
metadata-eval13.1%
+-commutative13.1%
sub-neg13.1%
metadata-eval13.1%
+-commutative13.1%
Simplified13.1%
Taylor expanded in x around 0 26.3%
associate-*r/56.6%
clear-num56.5%
*-commutative56.5%
fma-neg56.5%
metadata-eval56.5%
Applied egg-rr56.5%
Taylor expanded in t around 0 56.5%
Final simplification41.7%
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= l_m 3.35e+196)
(sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
(* (sqrt (- (* x 0.5) 0.5)) (/ (* t_m (sqrt 2.0)) l_m)))))l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 3.35e+196) {
tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
} else {
tmp = sqrt(((x * 0.5) - 0.5)) * ((t_m * sqrt(2.0)) / l_m);
}
return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: l_m
real(8), intent (in) :: t_m
real(8) :: tmp
if (l_m <= 3.35d+196) then
tmp = sqrt((2.0d0 / ((2.0d0 + (2.0d0 * x)) / (x + (-1.0d0)))))
else
tmp = sqrt(((x * 0.5d0) - 0.5d0)) * ((t_m * sqrt(2.0d0)) / l_m)
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 3.35e+196) {
tmp = Math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
} else {
tmp = Math.sqrt(((x * 0.5) - 0.5)) * ((t_m * Math.sqrt(2.0)) / l_m);
}
return t_s * tmp;
}
l_m = math.fabs(l) t_m = math.fabs(t) t_s = math.copysign(1.0, t) def code(t_s, x, l_m, t_m): tmp = 0 if l_m <= 3.35e+196: tmp = math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0)))) else: tmp = math.sqrt(((x * 0.5) - 0.5)) * ((t_m * math.sqrt(2.0)) / l_m) return t_s * tmp
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) tmp = 0.0 if (l_m <= 3.35e+196) tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0)))); else tmp = Float64(sqrt(Float64(Float64(x * 0.5) - 0.5)) * Float64(Float64(t_m * sqrt(2.0)) / l_m)); end return Float64(t_s * tmp) end
l_m = abs(l); t_m = abs(t); t_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, x, l_m, t_m) tmp = 0.0; if (l_m <= 3.35e+196) tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0)))); else tmp = sqrt(((x * 0.5) - 0.5)) * ((t_m * sqrt(2.0)) / l_m); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 3.35e+196], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[(x * 0.5), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 3.35 \cdot 10^{+196}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{x \cdot 0.5 - 0.5} \cdot \frac{t_m \cdot \sqrt{2}}{l_m}\\
\end{array}
\end{array}
if l < 3.3500000000000001e196Initial program 35.6%
Simplified35.5%
Taylor expanded in t around inf 40.3%
add-log-exp39.5%
associate-*l*39.5%
pow1/239.5%
pow1/239.5%
+-commutative39.5%
pow-prod-down39.5%
+-commutative39.5%
sub-neg39.5%
metadata-eval39.5%
Applied egg-rr39.5%
Applied egg-rr40.4%
expm1-def40.4%
expm1-log1p40.4%
associate-*r/40.4%
metadata-eval40.4%
*-commutative40.4%
+-commutative40.4%
Simplified40.4%
if 3.3500000000000001e196 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 2.0%
*-commutative2.0%
associate--l+13.9%
sub-neg13.9%
metadata-eval13.9%
+-commutative13.9%
sub-neg13.9%
metadata-eval13.9%
+-commutative13.9%
Simplified13.9%
Taylor expanded in x around 0 25.3%
Taylor expanded in t around 0 25.2%
Final simplification39.5%
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= l_m 2.7e+205)
(sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
(* (sqrt 2.0) (* (/ t_m l_m) (sqrt (* x 0.5)))))))l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 2.7e+205) {
tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
} else {
tmp = sqrt(2.0) * ((t_m / l_m) * sqrt((x * 0.5)));
}
return t_s * tmp;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: l_m
real(8), intent (in) :: t_m
real(8) :: tmp
if (l_m <= 2.7d+205) then
tmp = sqrt((2.0d0 / ((2.0d0 + (2.0d0 * x)) / (x + (-1.0d0)))))
else
tmp = sqrt(2.0d0) * ((t_m / l_m) * sqrt((x * 0.5d0)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 2.7e+205) {
tmp = Math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
} else {
tmp = Math.sqrt(2.0) * ((t_m / l_m) * Math.sqrt((x * 0.5)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t_m = math.fabs(t) t_s = math.copysign(1.0, t) def code(t_s, x, l_m, t_m): tmp = 0 if l_m <= 2.7e+205: tmp = math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0)))) else: tmp = math.sqrt(2.0) * ((t_m / l_m) * math.sqrt((x * 0.5))) return t_s * tmp
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) tmp = 0.0 if (l_m <= 2.7e+205) tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0)))); else tmp = Float64(sqrt(2.0) * Float64(Float64(t_m / l_m) * sqrt(Float64(x * 0.5)))); end return Float64(t_s * tmp) end
l_m = abs(l); t_m = abs(t); t_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, x, l_m, t_m) tmp = 0.0; if (l_m <= 2.7e+205) tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0)))); else tmp = sqrt(2.0) * ((t_m / l_m) * sqrt((x * 0.5))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 2.7e+205], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Sqrt[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 2.7 \cdot 10^{+205}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\frac{t_m}{l_m} \cdot \sqrt{x \cdot 0.5}\right)\\
\end{array}
\end{array}
if l < 2.70000000000000012e205Initial program 35.4%
Simplified35.4%
Taylor expanded in t around inf 40.5%
add-log-exp39.7%
associate-*l*39.7%
pow1/239.7%
pow1/239.7%
+-commutative39.7%
pow-prod-down39.7%
+-commutative39.7%
sub-neg39.7%
metadata-eval39.7%
Applied egg-rr39.7%
Applied egg-rr40.6%
expm1-def40.6%
expm1-log1p40.6%
associate-*r/40.6%
metadata-eval40.6%
*-commutative40.6%
+-commutative40.6%
Simplified40.6%
if 2.70000000000000012e205 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 1.9%
*-commutative1.9%
associate--l+14.5%
sub-neg14.5%
metadata-eval14.5%
+-commutative14.5%
sub-neg14.5%
metadata-eval14.5%
+-commutative14.5%
Simplified14.5%
Taylor expanded in x around inf 26.8%
*-commutative26.8%
Simplified26.8%
Final simplification39.9%
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= l_m 1.82e+196)
(sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))
(* (/ t_m l_m) (sqrt (* 2.0 (fma x 0.5 -0.5)))))))l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 1.82e+196) {
tmp = sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
} else {
tmp = (t_m / l_m) * sqrt((2.0 * fma(x, 0.5, -0.5)));
}
return t_s * tmp;
}
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) tmp = 0.0 if (l_m <= 1.82e+196) tmp = sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0)))); else tmp = Float64(Float64(t_m / l_m) * sqrt(Float64(2.0 * fma(x, 0.5, -0.5)))); end return Float64(t_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 1.82e+196], N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(x * 0.5 + -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 1.82 \cdot 10^{+196}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_m}{l_m} \cdot \sqrt{2 \cdot \mathsf{fma}\left(x, 0.5, -0.5\right)}\\
\end{array}
\end{array}
if l < 1.82e196Initial program 35.6%
Simplified35.5%
Taylor expanded in t around inf 40.3%
add-log-exp39.5%
associate-*l*39.5%
pow1/239.5%
pow1/239.5%
+-commutative39.5%
pow-prod-down39.5%
+-commutative39.5%
sub-neg39.5%
metadata-eval39.5%
Applied egg-rr39.5%
Applied egg-rr40.4%
expm1-def40.4%
expm1-log1p40.4%
associate-*r/40.4%
metadata-eval40.4%
*-commutative40.4%
+-commutative40.4%
Simplified40.4%
if 1.82e196 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 2.0%
*-commutative2.0%
associate--l+13.9%
sub-neg13.9%
metadata-eval13.9%
+-commutative13.9%
sub-neg13.9%
metadata-eval13.9%
+-commutative13.9%
Simplified13.9%
Taylor expanded in x around 0 25.3%
expm1-log1p-u24.8%
expm1-udef15.3%
associate-*r*15.3%
sqrt-unprod15.3%
*-commutative15.3%
fma-neg15.3%
metadata-eval15.3%
Applied egg-rr15.3%
expm1-def24.7%
expm1-log1p25.2%
*-commutative25.2%
Simplified25.2%
Final simplification39.5%
l_m = (fabs.f64 l) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) (FPCore (t_s x l_m t_m) :precision binary64 (* t_s (sqrt (/ 2.0 (/ (+ 2.0 (* 2.0 x)) (+ x -1.0))))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
return t_s * sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: l_m
real(8), intent (in) :: t_m
code = t_s * sqrt((2.0d0 / ((2.0d0 + (2.0d0 * x)) / (x + (-1.0d0)))))
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
return t_s * Math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))));
}
l_m = math.fabs(l) t_m = math.fabs(t) t_s = math.copysign(1.0, t) def code(t_s, x, l_m, t_m): return t_s * math.sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0))))
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) return Float64(t_s * sqrt(Float64(2.0 / Float64(Float64(2.0 + Float64(2.0 * x)) / Float64(x + -1.0))))) end
l_m = abs(l); t_m = abs(t); t_s = sign(t) * abs(1.0); function tmp = code(t_s, x, l_m, t_m) tmp = t_s * sqrt((2.0 / ((2.0 + (2.0 * x)) / (x + -1.0)))); end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * N[Sqrt[N[(2.0 / N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \sqrt{\frac{2}{\frac{2 + 2 \cdot x}{x + -1}}}
\end{array}
Initial program 33.6%
Simplified33.6%
Taylor expanded in t around inf 39.7%
add-log-exp38.9%
associate-*l*38.9%
pow1/238.9%
pow1/238.9%
+-commutative38.9%
pow-prod-down38.9%
+-commutative38.9%
sub-neg38.9%
metadata-eval38.9%
Applied egg-rr38.9%
Applied egg-rr39.8%
expm1-def39.8%
expm1-log1p39.8%
associate-*r/39.8%
metadata-eval39.8%
*-commutative39.8%
+-commutative39.8%
Simplified39.8%
Final simplification39.8%
l_m = (fabs.f64 l) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) (FPCore (t_s x l_m t_m) :precision binary64 (* t_s (sqrt (/ (+ x -1.0) (+ x 1.0)))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
return t_s * sqrt(((x + -1.0) / (x + 1.0)));
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: l_m
real(8), intent (in) :: t_m
code = t_s * sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
return t_s * Math.sqrt(((x + -1.0) / (x + 1.0)));
}
l_m = math.fabs(l) t_m = math.fabs(t) t_s = math.copysign(1.0, t) def code(t_s, x, l_m, t_m): return t_s * math.sqrt(((x + -1.0) / (x + 1.0)))
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) return Float64(t_s * sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0)))) end
l_m = abs(l); t_m = abs(t); t_s = sign(t) * abs(1.0); function tmp = code(t_s, x, l_m, t_m) tmp = t_s * sqrt(((x + -1.0) / (x + 1.0))); end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \sqrt{\frac{x + -1}{x + 1}}
\end{array}
Initial program 33.6%
Simplified33.6%
Taylor expanded in t around inf 39.7%
Taylor expanded in t around 0 39.8%
Final simplification39.8%
l_m = (fabs.f64 l) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) (FPCore (t_s x l_m t_m) :precision binary64 (* t_s (+ (/ (/ 0.5 x) x) (+ 1.0 (/ -1.0 x)))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
return t_s * (((0.5 / x) / x) + (1.0 + (-1.0 / x)));
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: l_m
real(8), intent (in) :: t_m
code = t_s * (((0.5d0 / x) / x) + (1.0d0 + ((-1.0d0) / x)))
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
return t_s * (((0.5 / x) / x) + (1.0 + (-1.0 / x)));
}
l_m = math.fabs(l) t_m = math.fabs(t) t_s = math.copysign(1.0, t) def code(t_s, x, l_m, t_m): return t_s * (((0.5 / x) / x) + (1.0 + (-1.0 / x)))
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) return Float64(t_s * Float64(Float64(Float64(0.5 / x) / x) + Float64(1.0 + Float64(-1.0 / x)))) end
l_m = abs(l); t_m = abs(t); t_s = sign(t) * abs(1.0); function tmp = code(t_s, x, l_m, t_m) tmp = t_s * (((0.5 / x) / x) + (1.0 + (-1.0 / x))); end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * N[(N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision] + N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \left(\frac{\frac{0.5}{x}}{x} + \left(1 + \frac{-1}{x}\right)\right)
\end{array}
Initial program 33.6%
Simplified33.6%
Taylor expanded in t around inf 39.7%
Taylor expanded in t around 0 39.8%
Taylor expanded in x around inf 39.6%
sub-neg39.6%
+-commutative39.6%
associate-+l+39.6%
associate-*r/39.6%
metadata-eval39.6%
distribute-neg-frac39.6%
metadata-eval39.6%
Simplified39.6%
add-sqr-sqrt39.6%
sqrt-div39.6%
unpow239.6%
sqrt-prod24.6%
add-sqr-sqrt39.6%
sqrt-div39.6%
unpow239.6%
sqrt-prod24.6%
add-sqr-sqrt39.6%
Applied egg-rr39.6%
associate-*r/39.6%
associate-*l/39.6%
rem-square-sqrt39.6%
Simplified39.6%
Final simplification39.6%
l_m = (fabs.f64 l) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) (FPCore (t_s x l_m t_m) :precision binary64 (* t_s (+ 1.0 (/ -1.0 x))))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
return t_s * (1.0 + (-1.0 / x));
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: l_m
real(8), intent (in) :: t_m
code = t_s * (1.0d0 + ((-1.0d0) / x))
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
return t_s * (1.0 + (-1.0 / x));
}
l_m = math.fabs(l) t_m = math.fabs(t) t_s = math.copysign(1.0, t) def code(t_s, x, l_m, t_m): return t_s * (1.0 + (-1.0 / x))
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) return Float64(t_s * Float64(1.0 + Float64(-1.0 / x))) end
l_m = abs(l); t_m = abs(t); t_s = sign(t) * abs(1.0); function tmp = code(t_s, x, l_m, t_m) tmp = t_s * (1.0 + (-1.0 / x)); end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \left(1 + \frac{-1}{x}\right)
\end{array}
Initial program 33.6%
Simplified33.6%
Taylor expanded in t around inf 39.7%
Taylor expanded in x around inf 39.6%
Final simplification39.6%
l_m = (fabs.f64 l) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) (FPCore (t_s x l_m t_m) :precision binary64 (* t_s 1.0))
l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
return t_s * 1.0;
}
l_m = abs(l)
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, l_m, t_m)
real(8), intent (in) :: t_s
real(8), intent (in) :: x
real(8), intent (in) :: l_m
real(8), intent (in) :: t_m
code = t_s * 1.0d0
end function
l_m = Math.abs(l);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double l_m, double t_m) {
return t_s * 1.0;
}
l_m = math.fabs(l) t_m = math.fabs(t) t_s = math.copysign(1.0, t) def code(t_s, x, l_m, t_m): return t_s * 1.0
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) return Float64(t_s * 1.0) end
l_m = abs(l); t_m = abs(t); t_s = sign(t) * abs(1.0); function tmp = code(t_s, x, l_m, t_m) tmp = t_s * 1.0; end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * 1.0), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot 1
\end{array}
Initial program 33.6%
Simplified33.6%
Taylor expanded in t around inf 39.7%
Taylor expanded in x around inf 39.2%
Final simplification39.2%
herbie shell --seed 2024020
(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)))))