
(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 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= t_m 5e-159)
(*
(sqrt 2.0)
(/
t_m
(+
(* (sqrt (/ 1.0 x)) (* (sqrt 2.0) l_m))
(* (/ l_m (sqrt 2.0)) (sqrt (/ 1.0 (pow x 3.0)))))))
(if (<= t_m 2.9e+95)
(*
(sqrt 2.0)
(/
t_m
(sqrt
(fma
2.0
(* (pow t_m 2.0) (/ (+ 1.0 x) (+ x -1.0)))
(* (pow l_m 2.0) (+ (/ 1.0 x) (/ 1.0 (+ x -1.0))))))))
(sqrt (/ (+ 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) {
double tmp;
if (t_m <= 5e-159) {
tmp = sqrt(2.0) * (t_m / ((sqrt((1.0 / x)) * (sqrt(2.0) * l_m)) + ((l_m / sqrt(2.0)) * sqrt((1.0 / pow(x, 3.0))))));
} else if (t_m <= 2.9e+95) {
tmp = sqrt(2.0) * (t_m / sqrt(fma(2.0, (pow(t_m, 2.0) * ((1.0 + x) / (x + -1.0))), (pow(l_m, 2.0) * ((1.0 / x) + (1.0 / (x + -1.0)))))));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
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 (t_m <= 5e-159) tmp = Float64(sqrt(2.0) * Float64(t_m / Float64(Float64(sqrt(Float64(1.0 / x)) * Float64(sqrt(2.0) * l_m)) + Float64(Float64(l_m / sqrt(2.0)) * sqrt(Float64(1.0 / (x ^ 3.0))))))); elseif (t_m <= 2.9e+95) tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) * Float64(Float64(1.0 + x) / Float64(x + -1.0))), Float64((l_m ^ 2.0) * Float64(Float64(1.0 / x) + Float64(1.0 / Float64(x + -1.0)))))))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); 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[t$95$m, 5e-159], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] + N[(N[(l$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 2.9e+95], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[Sqrt[N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] * N[(N[(1.0 + x), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 5 \cdot 10^{-159}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t\_m}{\sqrt{\frac{1}{x}} \cdot \left(\sqrt{2} \cdot l\_m\right) + \frac{l\_m}{\sqrt{2}} \cdot \sqrt{\frac{1}{{x}^{3}}}}\\
\mathbf{elif}\;t\_m \leq 2.9 \cdot 10^{+95}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t\_m}{\sqrt{\mathsf{fma}\left(2, {t\_m}^{2} \cdot \frac{1 + x}{x + -1}, {l\_m}^{2} \cdot \left(\frac{1}{x} + \frac{1}{x + -1}\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < 5.00000000000000032e-159Initial program 29.0%
Simplified28.9%
Taylor expanded in l around inf 4.7%
associate--l+11.7%
sub-neg11.7%
metadata-eval11.7%
+-commutative11.7%
sub-neg11.7%
metadata-eval11.7%
+-commutative11.7%
Simplified11.7%
Taylor expanded in x around inf 20.7%
if 5.00000000000000032e-159 < t < 2.90000000000000013e95Initial program 61.5%
Simplified61.3%
Taylor expanded in l around 0 62.2%
fma-define62.2%
+-commutative62.2%
associate-*r/74.1%
sub-neg74.1%
metadata-eval74.1%
+-commutative74.1%
associate--l+77.9%
sub-neg77.9%
metadata-eval77.9%
+-commutative77.9%
sub-neg77.9%
metadata-eval77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in x around inf 88.7%
if 2.90000000000000013e95 < t Initial program 14.9%
Simplified14.9%
Taylor expanded in l around 0 95.4%
associate-*l*95.4%
+-commutative95.4%
sub-neg95.4%
metadata-eval95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in t around 0 95.7%
Final simplification49.2%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= t_m 6e-159)
(/ (sqrt 2.0) (/ (/ (* (sqrt 2.0) l_m) (sqrt x)) t_m))
(if (<= t_m 5.1e+95)
(*
(sqrt 2.0)
(/
t_m
(sqrt
(fma
2.0
(* (pow t_m 2.0) (/ (+ 1.0 x) (+ x -1.0)))
(* (pow l_m 2.0) (+ (/ 1.0 x) (/ 1.0 (+ x -1.0))))))))
(sqrt (/ (+ 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) {
double tmp;
if (t_m <= 6e-159) {
tmp = sqrt(2.0) / (((sqrt(2.0) * l_m) / sqrt(x)) / t_m);
} else if (t_m <= 5.1e+95) {
tmp = sqrt(2.0) * (t_m / sqrt(fma(2.0, (pow(t_m, 2.0) * ((1.0 + x) / (x + -1.0))), (pow(l_m, 2.0) * ((1.0 / x) + (1.0 / (x + -1.0)))))));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
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 (t_m <= 6e-159) tmp = Float64(sqrt(2.0) / Float64(Float64(Float64(sqrt(2.0) * l_m) / sqrt(x)) / t_m)); elseif (t_m <= 5.1e+95) tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) * Float64(Float64(1.0 + x) / Float64(x + -1.0))), Float64((l_m ^ 2.0) * Float64(Float64(1.0 / x) + Float64(1.0 / Float64(x + -1.0)))))))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); 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[t$95$m, 6e-159], N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * l$95$m), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 5.1e+95], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[Sqrt[N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] * N[(N[(1.0 + x), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 6 \cdot 10^{-159}:\\
\;\;\;\;\frac{\sqrt{2}}{\frac{\frac{\sqrt{2} \cdot l\_m}{\sqrt{x}}}{t\_m}}\\
\mathbf{elif}\;t\_m \leq 5.1 \cdot 10^{+95}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t\_m}{\sqrt{\mathsf{fma}\left(2, {t\_m}^{2} \cdot \frac{1 + x}{x + -1}, {l\_m}^{2} \cdot \left(\frac{1}{x} + \frac{1}{x + -1}\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < 6.00000000000000018e-159Initial program 29.0%
Simplified28.9%
Taylor expanded in l around inf 4.7%
associate--l+11.7%
sub-neg11.7%
metadata-eval11.7%
+-commutative11.7%
sub-neg11.7%
metadata-eval11.7%
+-commutative11.7%
Simplified11.7%
Taylor expanded in x around inf 20.7%
*-commutative20.7%
associate-*l*20.6%
Simplified20.6%
clear-num20.6%
un-div-inv20.6%
sqrt-div20.6%
metadata-eval20.6%
un-div-inv20.6%
Applied egg-rr20.6%
associate-*r/20.6%
Simplified20.6%
if 6.00000000000000018e-159 < t < 5.10000000000000003e95Initial program 61.5%
Simplified61.3%
Taylor expanded in l around 0 62.2%
fma-define62.2%
+-commutative62.2%
associate-*r/74.1%
sub-neg74.1%
metadata-eval74.1%
+-commutative74.1%
associate--l+77.9%
sub-neg77.9%
metadata-eval77.9%
+-commutative77.9%
sub-neg77.9%
metadata-eval77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in x around inf 88.7%
if 5.10000000000000003e95 < t Initial program 14.9%
Simplified14.9%
Taylor expanded in l around 0 95.4%
associate-*l*95.4%
+-commutative95.4%
sub-neg95.4%
metadata-eval95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in t around 0 95.7%
Final simplification49.2%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= t_m 1.6e-159)
(/ (sqrt 2.0) (/ (/ (* (sqrt 2.0) l_m) (sqrt x)) t_m))
(if (<= t_m 3.5e+95)
(*
(sqrt 2.0)
(/
t_m
(sqrt
(fma
2.0
(* (pow t_m 2.0) (/ (+ 1.0 x) (+ x -1.0)))
(* 2.0 (/ (pow l_m 2.0) x))))))
(sqrt (/ (+ 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) {
double tmp;
if (t_m <= 1.6e-159) {
tmp = sqrt(2.0) / (((sqrt(2.0) * l_m) / sqrt(x)) / t_m);
} else if (t_m <= 3.5e+95) {
tmp = sqrt(2.0) * (t_m / sqrt(fma(2.0, (pow(t_m, 2.0) * ((1.0 + x) / (x + -1.0))), (2.0 * (pow(l_m, 2.0) / x)))));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
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 (t_m <= 1.6e-159) tmp = Float64(sqrt(2.0) / Float64(Float64(Float64(sqrt(2.0) * l_m) / sqrt(x)) / t_m)); elseif (t_m <= 3.5e+95) tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) * Float64(Float64(1.0 + x) / Float64(x + -1.0))), Float64(2.0 * Float64((l_m ^ 2.0) / x)))))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); 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[t$95$m, 1.6e-159], N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * l$95$m), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 3.5e+95], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[Sqrt[N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] * N[(N[(1.0 + x), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 1.6 \cdot 10^{-159}:\\
\;\;\;\;\frac{\sqrt{2}}{\frac{\frac{\sqrt{2} \cdot l\_m}{\sqrt{x}}}{t\_m}}\\
\mathbf{elif}\;t\_m \leq 3.5 \cdot 10^{+95}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t\_m}{\sqrt{\mathsf{fma}\left(2, {t\_m}^{2} \cdot \frac{1 + x}{x + -1}, 2 \cdot \frac{{l\_m}^{2}}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < 1.6e-159Initial program 29.0%
Simplified28.9%
Taylor expanded in l around inf 4.7%
associate--l+11.7%
sub-neg11.7%
metadata-eval11.7%
+-commutative11.7%
sub-neg11.7%
metadata-eval11.7%
+-commutative11.7%
Simplified11.7%
Taylor expanded in x around inf 20.7%
*-commutative20.7%
associate-*l*20.6%
Simplified20.6%
clear-num20.6%
un-div-inv20.6%
sqrt-div20.6%
metadata-eval20.6%
un-div-inv20.6%
Applied egg-rr20.6%
associate-*r/20.6%
Simplified20.6%
if 1.6e-159 < t < 3.5e95Initial program 61.5%
Simplified61.3%
Taylor expanded in l around 0 62.2%
fma-define62.2%
+-commutative62.2%
associate-*r/74.1%
sub-neg74.1%
metadata-eval74.1%
+-commutative74.1%
associate--l+77.9%
sub-neg77.9%
metadata-eval77.9%
+-commutative77.9%
sub-neg77.9%
metadata-eval77.9%
+-commutative77.9%
Simplified77.9%
Taylor expanded in x around inf 88.7%
if 3.5e95 < t Initial program 14.9%
Simplified14.9%
Taylor expanded in l around 0 95.4%
associate-*l*95.4%
+-commutative95.4%
sub-neg95.4%
metadata-eval95.4%
+-commutative95.4%
Simplified95.4%
Taylor expanded in t around 0 95.7%
Final simplification49.2%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= t_m 9.5e-111)
(*
t_m
(* (/ (sqrt 2.0) l_m) (sqrt (/ 1.0 (+ (/ 1.0 x) (/ 1.0 (+ x -1.0)))))))
(sqrt (/ (+ 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) {
double tmp;
if (t_m <= 9.5e-111) {
tmp = t_m * ((sqrt(2.0) / l_m) * sqrt((1.0 / ((1.0 / x) + (1.0 / (x + -1.0))))));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
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 (t_m <= 9.5d-111) then
tmp = t_m * ((sqrt(2.0d0) / l_m) * sqrt((1.0d0 / ((1.0d0 / x) + (1.0d0 / (x + (-1.0d0)))))))
else
tmp = sqrt(((x + (-1.0d0)) / (1.0d0 + x)))
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 (t_m <= 9.5e-111) {
tmp = t_m * ((Math.sqrt(2.0) / l_m) * Math.sqrt((1.0 / ((1.0 / x) + (1.0 / (x + -1.0))))));
} else {
tmp = Math.sqrt(((x + -1.0) / (1.0 + x)));
}
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 t_m <= 9.5e-111: tmp = t_m * ((math.sqrt(2.0) / l_m) * math.sqrt((1.0 / ((1.0 / x) + (1.0 / (x + -1.0)))))) else: tmp = math.sqrt(((x + -1.0) / (1.0 + x))) 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 (t_m <= 9.5e-111) tmp = Float64(t_m * Float64(Float64(sqrt(2.0) / l_m) * sqrt(Float64(1.0 / Float64(Float64(1.0 / x) + Float64(1.0 / Float64(x + -1.0))))))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); 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 (t_m <= 9.5e-111) tmp = t_m * ((sqrt(2.0) / l_m) * sqrt((1.0 / ((1.0 / x) + (1.0 / (x + -1.0)))))); else tmp = sqrt(((x + -1.0) / (1.0 + x))); 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[t$95$m, 9.5e-111], N[(t$95$m * N[(N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 9.5 \cdot 10^{-111}:\\
\;\;\;\;t\_m \cdot \left(\frac{\sqrt{2}}{l\_m} \cdot \sqrt{\frac{1}{\frac{1}{x} + \frac{1}{x + -1}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < 9.4999999999999995e-111Initial program 28.8%
Simplified28.8%
Taylor expanded in l around inf 3.3%
*-commutative3.3%
associate--l+11.2%
sub-neg11.2%
metadata-eval11.2%
+-commutative11.2%
sub-neg11.2%
metadata-eval11.2%
+-commutative11.2%
associate-/l*11.2%
Simplified11.2%
Taylor expanded in x around inf 19.8%
Taylor expanded in t around 0 19.8%
associate-*r/19.8%
associate-*l*22.1%
sub-neg22.1%
metadata-eval22.1%
+-commutative22.1%
Simplified22.1%
if 9.4999999999999995e-111 < t Initial program 38.5%
Simplified38.4%
Taylor expanded in l around 0 91.9%
associate-*l*91.9%
+-commutative91.9%
sub-neg91.9%
metadata-eval91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in t around 0 92.2%
Final simplification47.2%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= t_m 7e-111)
(* t_m (* (/ (sqrt 2.0) l_m) (sqrt (* x 0.5))))
(sqrt (/ (+ 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) {
double tmp;
if (t_m <= 7e-111) {
tmp = t_m * ((sqrt(2.0) / l_m) * sqrt((x * 0.5)));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
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 (t_m <= 7d-111) then
tmp = t_m * ((sqrt(2.0d0) / l_m) * sqrt((x * 0.5d0)))
else
tmp = sqrt(((x + (-1.0d0)) / (1.0d0 + x)))
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 (t_m <= 7e-111) {
tmp = t_m * ((Math.sqrt(2.0) / l_m) * Math.sqrt((x * 0.5)));
} else {
tmp = Math.sqrt(((x + -1.0) / (1.0 + x)));
}
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 t_m <= 7e-111: tmp = t_m * ((math.sqrt(2.0) / l_m) * math.sqrt((x * 0.5))) else: tmp = math.sqrt(((x + -1.0) / (1.0 + x))) 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 (t_m <= 7e-111) tmp = Float64(t_m * Float64(Float64(sqrt(2.0) / l_m) * sqrt(Float64(x * 0.5)))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); 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 (t_m <= 7e-111) tmp = t_m * ((sqrt(2.0) / l_m) * sqrt((x * 0.5))); else tmp = sqrt(((x + -1.0) / (1.0 + x))); 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[t$95$m, 7e-111], N[(t$95$m * N[(N[(N[Sqrt[2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * N[Sqrt[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 7 \cdot 10^{-111}:\\
\;\;\;\;t\_m \cdot \left(\frac{\sqrt{2}}{l\_m} \cdot \sqrt{x \cdot 0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < 7.0000000000000001e-111Initial program 28.8%
Simplified28.8%
Taylor expanded in l around inf 3.3%
*-commutative3.3%
associate--l+11.2%
sub-neg11.2%
metadata-eval11.2%
+-commutative11.2%
sub-neg11.2%
metadata-eval11.2%
+-commutative11.2%
associate-/l*11.2%
Simplified11.2%
Taylor expanded in x around inf 19.8%
Taylor expanded in t around 0 19.8%
associate-*r/19.8%
associate-*l*22.1%
sub-neg22.1%
metadata-eval22.1%
+-commutative22.1%
Simplified22.1%
Taylor expanded in x around inf 22.1%
*-commutative22.1%
Simplified22.1%
if 7.0000000000000001e-111 < t Initial program 38.5%
Simplified38.4%
Taylor expanded in l around 0 91.9%
associate-*l*91.9%
+-commutative91.9%
sub-neg91.9%
metadata-eval91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in t around 0 92.2%
Final simplification47.2%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (or (<= t_m 3.3e-239) (and (not (<= t_m 4.8e-136)) (<= t_m 1.9e-120)))
(* (sqrt x) (/ t_m l_m))
(sqrt (/ (+ 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) {
double tmp;
if ((t_m <= 3.3e-239) || (!(t_m <= 4.8e-136) && (t_m <= 1.9e-120))) {
tmp = sqrt(x) * (t_m / l_m);
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
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 ((t_m <= 3.3d-239) .or. (.not. (t_m <= 4.8d-136)) .and. (t_m <= 1.9d-120)) then
tmp = sqrt(x) * (t_m / l_m)
else
tmp = sqrt(((x + (-1.0d0)) / (1.0d0 + x)))
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 ((t_m <= 3.3e-239) || (!(t_m <= 4.8e-136) && (t_m <= 1.9e-120))) {
tmp = Math.sqrt(x) * (t_m / l_m);
} else {
tmp = Math.sqrt(((x + -1.0) / (1.0 + x)));
}
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 (t_m <= 3.3e-239) or (not (t_m <= 4.8e-136) and (t_m <= 1.9e-120)): tmp = math.sqrt(x) * (t_m / l_m) else: tmp = math.sqrt(((x + -1.0) / (1.0 + x))) 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 ((t_m <= 3.3e-239) || (!(t_m <= 4.8e-136) && (t_m <= 1.9e-120))) tmp = Float64(sqrt(x) * Float64(t_m / l_m)); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); 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 ((t_m <= 3.3e-239) || (~((t_m <= 4.8e-136)) && (t_m <= 1.9e-120))) tmp = sqrt(x) * (t_m / l_m); else tmp = sqrt(((x + -1.0) / (1.0 + x))); 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[Or[LessEqual[t$95$m, 3.3e-239], And[N[Not[LessEqual[t$95$m, 4.8e-136]], $MachinePrecision], LessEqual[t$95$m, 1.9e-120]]], N[(N[Sqrt[x], $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 3.3 \cdot 10^{-239} \lor \neg \left(t\_m \leq 4.8 \cdot 10^{-136}\right) \land t\_m \leq 1.9 \cdot 10^{-120}:\\
\;\;\;\;\sqrt{x} \cdot \frac{t\_m}{l\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < 3.29999999999999995e-239 or 4.7999999999999997e-136 < t < 1.8999999999999999e-120Initial program 29.9%
Simplified29.8%
Taylor expanded in l around inf 4.4%
associate--l+12.3%
sub-neg12.3%
metadata-eval12.3%
+-commutative12.3%
sub-neg12.3%
metadata-eval12.3%
+-commutative12.3%
Simplified12.3%
Taylor expanded in x around inf 21.7%
*-commutative21.7%
associate-*l*21.7%
Simplified21.7%
Taylor expanded in t around 0 20.5%
if 3.29999999999999995e-239 < t < 4.7999999999999997e-136 or 1.8999999999999999e-120 < t Initial program 35.8%
Simplified35.7%
Taylor expanded in l around 0 86.4%
associate-*l*86.4%
+-commutative86.4%
sub-neg86.4%
metadata-eval86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in t around 0 86.7%
Final simplification47.7%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (or (<= t_m 6e-240) (and (not (<= t_m 2.6e-133)) (<= t_m 4.2e-120)))
(* (sqrt x) (/ t_m l_m))
(+ 1.0 (/ (+ -1.0 (/ 0.5 x)) 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) {
double tmp;
if ((t_m <= 6e-240) || (!(t_m <= 2.6e-133) && (t_m <= 4.2e-120))) {
tmp = sqrt(x) * (t_m / l_m);
} else {
tmp = 1.0 + ((-1.0 + (0.5 / x)) / x);
}
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 ((t_m <= 6d-240) .or. (.not. (t_m <= 2.6d-133)) .and. (t_m <= 4.2d-120)) then
tmp = sqrt(x) * (t_m / l_m)
else
tmp = 1.0d0 + (((-1.0d0) + (0.5d0 / x)) / x)
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 ((t_m <= 6e-240) || (!(t_m <= 2.6e-133) && (t_m <= 4.2e-120))) {
tmp = Math.sqrt(x) * (t_m / l_m);
} else {
tmp = 1.0 + ((-1.0 + (0.5 / x)) / x);
}
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 (t_m <= 6e-240) or (not (t_m <= 2.6e-133) and (t_m <= 4.2e-120)): tmp = math.sqrt(x) * (t_m / l_m) else: tmp = 1.0 + ((-1.0 + (0.5 / x)) / x) 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 ((t_m <= 6e-240) || (!(t_m <= 2.6e-133) && (t_m <= 4.2e-120))) tmp = Float64(sqrt(x) * Float64(t_m / l_m)); else tmp = Float64(1.0 + Float64(Float64(-1.0 + Float64(0.5 / x)) / x)); 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 ((t_m <= 6e-240) || (~((t_m <= 2.6e-133)) && (t_m <= 4.2e-120))) tmp = sqrt(x) * (t_m / l_m); else tmp = 1.0 + ((-1.0 + (0.5 / x)) / x); 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[Or[LessEqual[t$95$m, 6e-240], And[N[Not[LessEqual[t$95$m, 2.6e-133]], $MachinePrecision], LessEqual[t$95$m, 4.2e-120]]], N[(N[Sqrt[x], $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(-1.0 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 6 \cdot 10^{-240} \lor \neg \left(t\_m \leq 2.6 \cdot 10^{-133}\right) \land t\_m \leq 4.2 \cdot 10^{-120}:\\
\;\;\;\;\sqrt{x} \cdot \frac{t\_m}{l\_m}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1 + \frac{0.5}{x}}{x}\\
\end{array}
\end{array}
if t < 5.99999999999999982e-240 or 2.5999999999999999e-133 < t < 4.2000000000000001e-120Initial program 29.9%
Simplified29.8%
Taylor expanded in l around inf 4.4%
associate--l+12.3%
sub-neg12.3%
metadata-eval12.3%
+-commutative12.3%
sub-neg12.3%
metadata-eval12.3%
+-commutative12.3%
Simplified12.3%
Taylor expanded in x around inf 21.7%
*-commutative21.7%
associate-*l*21.7%
Simplified21.7%
Taylor expanded in t around 0 20.5%
if 5.99999999999999982e-240 < t < 2.5999999999999999e-133 or 4.2000000000000001e-120 < t Initial program 35.8%
Simplified35.7%
Taylor expanded in l around 0 86.4%
associate-*l*86.4%
+-commutative86.4%
sub-neg86.4%
metadata-eval86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in x around -inf 0.0%
mul-1-neg0.0%
unsub-neg0.0%
Simplified85.9%
Final simplification47.3%
l_m = (fabs.f64 l) t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s x l_m t_m) :precision binary64 (* t_s (+ 1.0 (/ (+ -1.0 (/ 0.5 x)) 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 + (0.5 / x)) / 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) + (0.5d0 / x)) / 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 + (0.5 / x)) / 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 + (0.5 / x)) / 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(Float64(-1.0 + Float64(0.5 / x)) / 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 + (0.5 / x)) / 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[(N[(-1.0 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / 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 + \frac{0.5}{x}}{x}\right)
\end{array}
Initial program 32.3%
Simplified32.2%
Taylor expanded in l around 0 37.5%
associate-*l*37.5%
+-commutative37.5%
sub-neg37.5%
metadata-eval37.5%
+-commutative37.5%
Simplified37.5%
Taylor expanded in x around -inf 0.0%
mul-1-neg0.0%
unsub-neg0.0%
Simplified37.3%
Final simplification37.3%
l_m = (fabs.f64 l) t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) 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 32.3%
Simplified32.2%
Taylor expanded in l around 0 37.5%
associate-*l*37.5%
+-commutative37.5%
sub-neg37.5%
metadata-eval37.5%
+-commutative37.5%
Simplified37.5%
Taylor expanded in x around inf 36.9%
Final simplification36.9%
l_m = (fabs.f64 l) t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) 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 32.3%
Simplified32.2%
Taylor expanded in l around 0 37.5%
associate-*l*37.5%
+-commutative37.5%
sub-neg37.5%
metadata-eval37.5%
+-commutative37.5%
Simplified37.5%
Taylor expanded in x around inf 36.1%
herbie shell --seed 2024090
(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)))))