
(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 8 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 4.2e-198)
(/ (* t_m (sqrt x)) l_m)
(if (<= t_m 5.8e-182)
1.0
(if (<= t_m 0.0017)
(*
(sqrt 2.0)
(/
t_m
(sqrt
(fma
2.0
(* (pow t_m 2.0) (/ (+ x 1.0) (+ x -1.0)))
(* (pow l_m 2.0) (+ (/ 1.0 (+ x -1.0)) (/ 1.0 x)))))))
(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) {
double tmp;
if (t_m <= 4.2e-198) {
tmp = (t_m * sqrt(x)) / l_m;
} else if (t_m <= 5.8e-182) {
tmp = 1.0;
} else if (t_m <= 0.0017) {
tmp = sqrt(2.0) * (t_m / sqrt(fma(2.0, (pow(t_m, 2.0) * ((x + 1.0) / (x + -1.0))), (pow(l_m, 2.0) * ((1.0 / (x + -1.0)) + (1.0 / x))))));
} else {
tmp = sqrt(((x + -1.0) / (x + 1.0)));
}
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 <= 4.2e-198) tmp = Float64(Float64(t_m * sqrt(x)) / l_m); elseif (t_m <= 5.8e-182) tmp = 1.0; elseif (t_m <= 0.0017) tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) * Float64(Float64(x + 1.0) / Float64(x + -1.0))), Float64((l_m ^ 2.0) * Float64(Float64(1.0 / Float64(x + -1.0)) + Float64(1.0 / x))))))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))); 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, 4.2e-198], N[(N[(t$95$m * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision], If[LessEqual[t$95$m, 5.8e-182], 1.0, If[LessEqual[t$95$m, 0.0017], 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[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 4.2 \cdot 10^{-198}:\\
\;\;\;\;\frac{t\_m \cdot \sqrt{x}}{l\_m}\\
\mathbf{elif}\;t\_m \leq 5.8 \cdot 10^{-182}:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_m \leq 0.0017:\\
\;\;\;\;\sqrt{2} \cdot \frac{t\_m}{\sqrt{\mathsf{fma}\left(2, {t\_m}^{2} \cdot \frac{x + 1}{x + -1}, {l\_m}^{2} \cdot \left(\frac{1}{x + -1} + \frac{1}{x}\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\
\end{array}
\end{array}
if t < 4.19999999999999986e-198Initial program 28.8%
Simplified28.8%
Taylor expanded in t around 0 3.6%
associate-/l*2.9%
+-commutative2.9%
sub-neg2.9%
metadata-eval2.9%
fma-neg2.9%
+-commutative2.9%
Simplified2.9%
Taylor expanded in x around inf 18.7%
cancel-sign-sub-inv18.7%
metadata-eval18.7%
distribute-rgt1-in18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in t around 0 15.9%
associate-*l/17.8%
Simplified17.8%
if 4.19999999999999986e-198 < t < 5.79999999999999974e-182Initial program 3.1%
Simplified3.1%
Taylor expanded in l around 0 100.0%
associate-*l*100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 5.79999999999999974e-182 < t < 0.00169999999999999991Initial program 59.4%
Simplified59.3%
Taylor expanded in l around 0 63.8%
fma-define63.8%
+-commutative63.8%
associate-*r/63.7%
sub-neg63.7%
metadata-eval63.7%
+-commutative63.7%
associate--l+68.5%
sub-neg68.5%
metadata-eval68.5%
+-commutative68.5%
sub-neg68.5%
metadata-eval68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in x around inf 81.0%
if 0.00169999999999999991 < t Initial program 36.5%
Simplified36.5%
Taylor expanded in l around 0 93.5%
associate-*l*93.5%
+-commutative93.5%
sub-neg93.5%
metadata-eval93.5%
+-commutative93.5%
Simplified93.5%
Taylor expanded in t around 0 93.7%
Final simplification50.1%
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 2.5e-198)
(/ (* t_m (sqrt x)) l_m)
(if (<= t_m 2.45e-181)
1.0
(if (<= t_m 0.00195)
(*
(sqrt 2.0)
(/
t_m
(sqrt
(fma
2.0
(* (pow t_m 2.0) (/ (+ x 1.0) (+ x -1.0)))
(/ (* 2.0 (pow l_m 2.0)) x)))))
(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) {
double tmp;
if (t_m <= 2.5e-198) {
tmp = (t_m * sqrt(x)) / l_m;
} else if (t_m <= 2.45e-181) {
tmp = 1.0;
} else if (t_m <= 0.00195) {
tmp = sqrt(2.0) * (t_m / sqrt(fma(2.0, (pow(t_m, 2.0) * ((x + 1.0) / (x + -1.0))), ((2.0 * pow(l_m, 2.0)) / x))));
} else {
tmp = sqrt(((x + -1.0) / (x + 1.0)));
}
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 <= 2.5e-198) tmp = Float64(Float64(t_m * sqrt(x)) / l_m); elseif (t_m <= 2.45e-181) tmp = 1.0; elseif (t_m <= 0.00195) tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) * Float64(Float64(x + 1.0) / Float64(x + -1.0))), Float64(Float64(2.0 * (l_m ^ 2.0)) / x))))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))); 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, 2.5e-198], N[(N[(t$95$m * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision], If[LessEqual[t$95$m, 2.45e-181], 1.0, If[LessEqual[t$95$m, 0.00195], 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[(x + 1.0), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;t\_m \leq 2.5 \cdot 10^{-198}:\\
\;\;\;\;\frac{t\_m \cdot \sqrt{x}}{l\_m}\\
\mathbf{elif}\;t\_m \leq 2.45 \cdot 10^{-181}:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_m \leq 0.00195:\\
\;\;\;\;\sqrt{2} \cdot \frac{t\_m}{\sqrt{\mathsf{fma}\left(2, {t\_m}^{2} \cdot \frac{x + 1}{x + -1}, \frac{2 \cdot {l\_m}^{2}}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\
\end{array}
\end{array}
if t < 2.5e-198Initial program 28.8%
Simplified28.8%
Taylor expanded in t around 0 3.6%
associate-/l*2.9%
+-commutative2.9%
sub-neg2.9%
metadata-eval2.9%
fma-neg2.9%
+-commutative2.9%
Simplified2.9%
Taylor expanded in x around inf 18.7%
cancel-sign-sub-inv18.7%
metadata-eval18.7%
distribute-rgt1-in18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in t around 0 15.9%
associate-*l/17.8%
Simplified17.8%
if 2.5e-198 < t < 2.44999999999999981e-181Initial program 3.1%
Simplified3.1%
Taylor expanded in l around 0 100.0%
associate-*l*100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 2.44999999999999981e-181 < t < 0.0019499999999999999Initial program 59.4%
Simplified59.3%
Taylor expanded in l around 0 63.8%
fma-define63.8%
+-commutative63.8%
associate-*r/63.7%
sub-neg63.7%
metadata-eval63.7%
+-commutative63.7%
associate--l+68.5%
sub-neg68.5%
metadata-eval68.5%
+-commutative68.5%
sub-neg68.5%
metadata-eval68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in x around inf 80.9%
associate-*r/80.9%
Simplified80.9%
if 0.0019499999999999999 < t Initial program 36.5%
Simplified36.5%
Taylor expanded in l around 0 93.5%
associate-*l*93.5%
+-commutative93.5%
sub-neg93.5%
metadata-eval93.5%
+-commutative93.5%
Simplified93.5%
Taylor expanded in t around 0 93.7%
Final simplification50.1%
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 1e-198)
(/ (* t_m (sqrt x)) l_m)
(if (<= t_m 1.15e-181)
1.0
(if (<= t_m 4.5e-175)
(* t_m (/ (sqrt x) 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 <= 1e-198) {
tmp = (t_m * sqrt(x)) / l_m;
} else if (t_m <= 1.15e-181) {
tmp = 1.0;
} else if (t_m <= 4.5e-175) {
tmp = t_m * (sqrt(x) / 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 <= 1d-198) then
tmp = (t_m * sqrt(x)) / l_m
else if (t_m <= 1.15d-181) then
tmp = 1.0d0
else if (t_m <= 4.5d-175) then
tmp = t_m * (sqrt(x) / 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 <= 1e-198) {
tmp = (t_m * Math.sqrt(x)) / l_m;
} else if (t_m <= 1.15e-181) {
tmp = 1.0;
} else if (t_m <= 4.5e-175) {
tmp = t_m * (Math.sqrt(x) / 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 <= 1e-198: tmp = (t_m * math.sqrt(x)) / l_m elif t_m <= 1.15e-181: tmp = 1.0 elif t_m <= 4.5e-175: tmp = t_m * (math.sqrt(x) / 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 <= 1e-198) tmp = Float64(Float64(t_m * sqrt(x)) / l_m); elseif (t_m <= 1.15e-181) tmp = 1.0; elseif (t_m <= 4.5e-175) tmp = Float64(t_m * Float64(sqrt(x) / 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 <= 1e-198) tmp = (t_m * sqrt(x)) / l_m; elseif (t_m <= 1.15e-181) tmp = 1.0; elseif (t_m <= 4.5e-175) tmp = t_m * (sqrt(x) / 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[LessEqual[t$95$m, 1e-198], N[(N[(t$95$m * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision], If[LessEqual[t$95$m, 1.15e-181], 1.0, If[LessEqual[t$95$m, 4.5e-175], N[(t$95$m * N[(N[Sqrt[x], $MachinePrecision] / 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 10^{-198}:\\
\;\;\;\;\frac{t\_m \cdot \sqrt{x}}{l\_m}\\
\mathbf{elif}\;t\_m \leq 1.15 \cdot 10^{-181}:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_m \leq 4.5 \cdot 10^{-175}:\\
\;\;\;\;t\_m \cdot \frac{\sqrt{x}}{l\_m}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1 + \frac{0.5}{x}}{x}\\
\end{array}
\end{array}
if t < 9.9999999999999991e-199Initial program 28.8%
Simplified28.8%
Taylor expanded in t around 0 3.6%
associate-/l*2.9%
+-commutative2.9%
sub-neg2.9%
metadata-eval2.9%
fma-neg2.9%
+-commutative2.9%
Simplified2.9%
Taylor expanded in x around inf 18.7%
cancel-sign-sub-inv18.7%
metadata-eval18.7%
distribute-rgt1-in18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in t around 0 15.9%
associate-*l/17.8%
Simplified17.8%
if 9.9999999999999991e-199 < t < 1.14999999999999995e-181Initial program 3.1%
Simplified3.1%
Taylor expanded in l around 0 100.0%
associate-*l*100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 1.14999999999999995e-181 < t < 4.49999999999999998e-175Initial program 0.0%
Simplified0.0%
Taylor expanded in t around 0 0.0%
associate-/l*0.0%
+-commutative0.0%
sub-neg0.0%
metadata-eval0.0%
fma-neg0.0%
+-commutative0.0%
Simplified0.0%
Taylor expanded in x around inf 31.7%
cancel-sign-sub-inv31.7%
metadata-eval31.7%
distribute-rgt1-in31.7%
metadata-eval31.7%
Simplified31.7%
Taylor expanded in t around 0 31.7%
Taylor expanded in x around -inf 0.0%
mul-1-neg0.0%
associate-*l/0.0%
associate-/l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt92.6%
neg-mul-192.6%
distribute-lft-neg-in92.6%
remove-double-neg92.6%
Simplified92.6%
if 4.49999999999999998e-175 < t Initial program 45.5%
Simplified45.4%
Taylor expanded in l around 0 87.3%
associate-*l*87.3%
+-commutative87.3%
sub-neg87.3%
metadata-eval87.3%
+-commutative87.3%
Simplified87.3%
clear-num87.4%
inv-pow87.4%
sqrt-unprod87.4%
+-commutative87.4%
Applied egg-rr87.4%
unpow-187.4%
associate-/l*87.4%
Simplified87.4%
un-div-inv87.4%
*-commutative87.4%
associate-/r*87.3%
Applied egg-rr87.3%
associate-/l/87.4%
*-un-lft-identity87.4%
times-frac87.2%
associate-/r/87.3%
sqrt-undiv87.3%
Applied egg-rr87.3%
Taylor expanded in x around inf 86.4%
associate--l+86.4%
unpow286.4%
metadata-eval86.4%
metadata-eval86.4%
metadata-eval86.4%
rem-square-sqrt0.0%
unpow20.0%
associate-/l/0.0%
associate-*r/0.0%
div-sub0.0%
Simplified86.4%
Final simplification48.8%
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
(let* ((t_2 (* t_m (/ (sqrt x) l_m))))
(*
t_s
(if (<= t_m 3.9e-198)
t_2
(if (<= t_m 3.3e-182)
1.0
(if (<= t_m 4.4e-175) t_2 (+ 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 t_2 = t_m * (sqrt(x) / l_m);
double tmp;
if (t_m <= 3.9e-198) {
tmp = t_2;
} else if (t_m <= 3.3e-182) {
tmp = 1.0;
} else if (t_m <= 4.4e-175) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_2 = t_m * (sqrt(x) / l_m)
if (t_m <= 3.9d-198) then
tmp = t_2
else if (t_m <= 3.3d-182) then
tmp = 1.0d0
else if (t_m <= 4.4d-175) then
tmp = t_2
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 t_2 = t_m * (Math.sqrt(x) / l_m);
double tmp;
if (t_m <= 3.9e-198) {
tmp = t_2;
} else if (t_m <= 3.3e-182) {
tmp = 1.0;
} else if (t_m <= 4.4e-175) {
tmp = t_2;
} 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): t_2 = t_m * (math.sqrt(x) / l_m) tmp = 0 if t_m <= 3.9e-198: tmp = t_2 elif t_m <= 3.3e-182: tmp = 1.0 elif t_m <= 4.4e-175: tmp = t_2 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) t_2 = Float64(t_m * Float64(sqrt(x) / l_m)) tmp = 0.0 if (t_m <= 3.9e-198) tmp = t_2; elseif (t_m <= 3.3e-182) tmp = 1.0; elseif (t_m <= 4.4e-175) tmp = t_2; 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) t_2 = t_m * (sqrt(x) / l_m); tmp = 0.0; if (t_m <= 3.9e-198) tmp = t_2; elseif (t_m <= 3.3e-182) tmp = 1.0; elseif (t_m <= 4.4e-175) tmp = t_2; 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_] := Block[{t$95$2 = N[(t$95$m * N[(N[Sqrt[x], $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 3.9e-198], t$95$2, If[LessEqual[t$95$m, 3.3e-182], 1.0, If[LessEqual[t$95$m, 4.4e-175], t$95$2, 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)
\\
\begin{array}{l}
t_2 := t\_m \cdot \frac{\sqrt{x}}{l\_m}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 3.9 \cdot 10^{-198}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_m \leq 3.3 \cdot 10^{-182}:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_m \leq 4.4 \cdot 10^{-175}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1 + \frac{0.5}{x}}{x}\\
\end{array}
\end{array}
\end{array}
if t < 3.8999999999999999e-198 or 3.29999999999999996e-182 < t < 4.4e-175Initial program 28.2%
Simplified28.2%
Taylor expanded in t around 0 3.6%
associate-/l*2.8%
+-commutative2.8%
sub-neg2.8%
metadata-eval2.8%
fma-neg2.8%
+-commutative2.8%
Simplified2.8%
Taylor expanded in x around inf 19.0%
cancel-sign-sub-inv19.0%
metadata-eval19.0%
distribute-rgt1-in19.0%
metadata-eval19.0%
Simplified19.0%
Taylor expanded in t around 0 16.2%
Taylor expanded in x around -inf 0.0%
mul-1-neg0.0%
associate-*l/0.0%
associate-/l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt19.3%
neg-mul-119.3%
distribute-lft-neg-in19.3%
remove-double-neg19.3%
Simplified19.3%
if 3.8999999999999999e-198 < t < 3.29999999999999996e-182Initial program 3.1%
Simplified3.1%
Taylor expanded in l around 0 100.0%
associate-*l*100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 4.4e-175 < t Initial program 45.5%
Simplified45.4%
Taylor expanded in l around 0 87.3%
associate-*l*87.3%
+-commutative87.3%
sub-neg87.3%
metadata-eval87.3%
+-commutative87.3%
Simplified87.3%
clear-num87.4%
inv-pow87.4%
sqrt-unprod87.4%
+-commutative87.4%
Applied egg-rr87.4%
unpow-187.4%
associate-/l*87.4%
Simplified87.4%
un-div-inv87.4%
*-commutative87.4%
associate-/r*87.3%
Applied egg-rr87.3%
associate-/l/87.4%
*-un-lft-identity87.4%
times-frac87.2%
associate-/r/87.3%
sqrt-undiv87.3%
Applied egg-rr87.3%
Taylor expanded in x around inf 86.4%
associate--l+86.4%
unpow286.4%
metadata-eval86.4%
metadata-eval86.4%
metadata-eval86.4%
rem-square-sqrt0.0%
unpow20.0%
associate-/l/0.0%
associate-*r/0.0%
div-sub0.0%
Simplified86.4%
Final simplification48.8%
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 (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 35.3%
Simplified35.2%
Taylor expanded in l around 0 40.6%
associate-*l*40.6%
+-commutative40.6%
sub-neg40.6%
metadata-eval40.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in t around 0 40.7%
Final simplification40.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 (+ 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 35.3%
Simplified35.2%
Taylor expanded in l around 0 40.6%
associate-*l*40.6%
+-commutative40.6%
sub-neg40.6%
metadata-eval40.6%
+-commutative40.6%
Simplified40.6%
clear-num40.7%
inv-pow40.7%
sqrt-unprod40.7%
+-commutative40.7%
Applied egg-rr40.7%
unpow-140.7%
associate-/l*40.6%
Simplified40.6%
un-div-inv40.7%
*-commutative40.7%
associate-/r*40.6%
Applied egg-rr40.6%
associate-/l/40.7%
*-un-lft-identity40.7%
times-frac40.5%
associate-/r/40.6%
sqrt-undiv40.6%
Applied egg-rr40.6%
Taylor expanded in x around inf 40.2%
associate--l+40.2%
unpow240.2%
metadata-eval40.2%
metadata-eval40.2%
metadata-eval40.2%
rem-square-sqrt0.0%
unpow20.0%
associate-/l/0.0%
associate-*r/0.0%
div-sub0.0%
Simplified40.2%
Final simplification40.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 (+ 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 35.3%
Simplified35.2%
Taylor expanded in l around 0 40.6%
associate-*l*40.6%
+-commutative40.6%
sub-neg40.6%
metadata-eval40.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in x around inf 39.9%
Final simplification39.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 35.3%
Simplified35.2%
Taylor expanded in l around 0 40.6%
associate-*l*40.6%
+-commutative40.6%
sub-neg40.6%
metadata-eval40.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in x around inf 39.2%
herbie shell --seed 2024107
(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)))))