
(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
(let* ((t_2 (/ (+ -1.0 x) (+ x 1.0))))
(*
t_s
(if (<= l_m 31500.0)
(+ 1.0 (/ -1.0 x))
(if (<= l_m 1.7e+124)
(*
(sqrt 2.0)
(/
t_m
(sqrt (fma 2.0 (/ (pow t_m 2.0) t_2) (* 2.0 (/ (pow l_m 2.0) x))))))
(if (<= l_m 8.5e+209)
(sqrt t_2)
(* t_m (/ (sqrt (* 2.0 (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 t_2 = (-1.0 + x) / (x + 1.0);
double tmp;
if (l_m <= 31500.0) {
tmp = 1.0 + (-1.0 / x);
} else if (l_m <= 1.7e+124) {
tmp = sqrt(2.0) * (t_m / sqrt(fma(2.0, (pow(t_m, 2.0) / t_2), (2.0 * (pow(l_m, 2.0) / x)))));
} else if (l_m <= 8.5e+209) {
tmp = sqrt(t_2);
} else {
tmp = t_m * (sqrt((2.0 * 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) t_2 = Float64(Float64(-1.0 + x) / Float64(x + 1.0)) tmp = 0.0 if (l_m <= 31500.0) tmp = Float64(1.0 + Float64(-1.0 / x)); elseif (l_m <= 1.7e+124) tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) / t_2), Float64(2.0 * Float64((l_m ^ 2.0) / x)))))); elseif (l_m <= 8.5e+209) tmp = sqrt(t_2); else tmp = Float64(t_m * Float64(sqrt(Float64(2.0 * 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_] := Block[{t$95$2 = N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[l$95$m, 31500.0], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[l$95$m, 1.7e+124], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[Sqrt[N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] / t$95$2), $MachinePrecision] + N[(2.0 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l$95$m, 8.5e+209], N[Sqrt[t$95$2], $MachinePrecision], N[(t$95$m * N[(N[Sqrt[N[(2.0 * N[(x * 0.5 + -0.5), $MachinePrecision]), $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)
\\
\begin{array}{l}
t_2 := \frac{-1 + x}{x + 1}\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 31500:\\
\;\;\;\;1 + \frac{-1}{x}\\
\mathbf{elif}\;l_m \leq 1.7 \cdot 10^{+124}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m}{\sqrt{\mathsf{fma}\left(2, \frac{{t_m}^{2}}{t_2}, 2 \cdot \frac{{l_m}^{2}}{x}\right)}}\\
\mathbf{elif}\;l_m \leq 8.5 \cdot 10^{+209}:\\
\;\;\;\;\sqrt{t_2}\\
\mathbf{else}:\\
\;\;\;\;t_m \cdot \frac{\sqrt{2 \cdot \mathsf{fma}\left(x, 0.5, -0.5\right)}}{l_m}\\
\end{array}
\end{array}
\end{array}
if l < 31500Initial program 36.6%
Simplified36.5%
Taylor expanded in t around inf 48.5%
Taylor expanded in x around inf 48.7%
if 31500 < l < 1.7e124Initial program 21.5%
Simplified21.8%
Taylor expanded in l around 0 23.8%
fma-def23.8%
associate-/l*44.6%
sub-neg44.6%
metadata-eval44.6%
+-commutative44.6%
+-commutative44.6%
associate--l+53.9%
sub-neg53.9%
metadata-eval53.9%
+-commutative53.9%
sub-neg53.9%
metadata-eval53.9%
+-commutative53.9%
Simplified53.9%
Taylor expanded in x around inf 82.5%
if 1.7e124 < l < 8.50000000000000062e209Initial program 14.5%
Simplified14.5%
Taylor expanded in t around inf 47.7%
Taylor expanded in t around 0 48.1%
if 8.50000000000000062e209 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 1.5%
*-commutative1.5%
associate--l+52.4%
sub-neg52.4%
metadata-eval52.4%
+-commutative52.4%
sub-neg52.4%
metadata-eval52.4%
+-commutative52.4%
Simplified52.4%
Taylor expanded in x around 0 81.9%
clear-num81.9%
un-div-inv81.9%
fma-neg81.9%
metadata-eval81.9%
Applied egg-rr81.9%
associate-*r/81.9%
frac-2neg81.9%
metadata-eval81.9%
fma-neg81.9%
sqrt-unprod81.9%
fma-neg81.9%
metadata-eval81.9%
distribute-neg-frac81.9%
Applied egg-rr81.9%
associate-/r/81.9%
neg-mul-181.9%
neg-mul-181.9%
times-frac81.9%
metadata-eval81.9%
fma-udef81.9%
*-commutative81.9%
fma-def81.9%
Simplified81.9%
Final simplification53.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
(let* ((t_2 (* 2.0 (pow t_m 2.0))))
(*
t_s
(if (<= t_m 8.8e-165)
(*
(sqrt 2.0)
(/
t_m
(+
(*
0.5
(/
(+ (* 2.0 (+ (pow t_m 2.0) (pow t_m 2.0))) (* 2.0 (pow l_m 2.0)))
(* t_m (* (sqrt 2.0) x))))
(* t_m (sqrt 2.0)))))
(if (<= t_m 2.3e+92)
(*
t_m
(/
(sqrt 2.0)
(sqrt
(+
(+ (* 2.0 (/ (pow t_m 2.0) x)) (+ t_2 (/ (pow l_m 2.0) x)))
(/ (+ (pow l_m 2.0) t_2) x)))))
(sqrt (/ (+ -1.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) {
double t_2 = 2.0 * pow(t_m, 2.0);
double tmp;
if (t_m <= 8.8e-165) {
tmp = sqrt(2.0) * (t_m / ((0.5 * (((2.0 * (pow(t_m, 2.0) + pow(t_m, 2.0))) + (2.0 * pow(l_m, 2.0))) / (t_m * (sqrt(2.0) * x)))) + (t_m * sqrt(2.0))));
} else if (t_m <= 2.3e+92) {
tmp = t_m * (sqrt(2.0) / sqrt((((2.0 * (pow(t_m, 2.0) / x)) + (t_2 + (pow(l_m, 2.0) / x))) + ((pow(l_m, 2.0) + t_2) / x))));
} else {
tmp = sqrt(((-1.0 + x) / (x + 1.0)));
}
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 = 2.0d0 * (t_m ** 2.0d0)
if (t_m <= 8.8d-165) then
tmp = sqrt(2.0d0) * (t_m / ((0.5d0 * (((2.0d0 * ((t_m ** 2.0d0) + (t_m ** 2.0d0))) + (2.0d0 * (l_m ** 2.0d0))) / (t_m * (sqrt(2.0d0) * x)))) + (t_m * sqrt(2.0d0))))
else if (t_m <= 2.3d+92) then
tmp = t_m * (sqrt(2.0d0) / sqrt((((2.0d0 * ((t_m ** 2.0d0) / x)) + (t_2 + ((l_m ** 2.0d0) / x))) + (((l_m ** 2.0d0) + t_2) / x))))
else
tmp = sqrt((((-1.0d0) + x) / (x + 1.0d0)))
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 = 2.0 * Math.pow(t_m, 2.0);
double tmp;
if (t_m <= 8.8e-165) {
tmp = Math.sqrt(2.0) * (t_m / ((0.5 * (((2.0 * (Math.pow(t_m, 2.0) + Math.pow(t_m, 2.0))) + (2.0 * Math.pow(l_m, 2.0))) / (t_m * (Math.sqrt(2.0) * x)))) + (t_m * Math.sqrt(2.0))));
} else if (t_m <= 2.3e+92) {
tmp = t_m * (Math.sqrt(2.0) / Math.sqrt((((2.0 * (Math.pow(t_m, 2.0) / x)) + (t_2 + (Math.pow(l_m, 2.0) / x))) + ((Math.pow(l_m, 2.0) + t_2) / x))));
} else {
tmp = Math.sqrt(((-1.0 + x) / (x + 1.0)));
}
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 = 2.0 * math.pow(t_m, 2.0) tmp = 0 if t_m <= 8.8e-165: tmp = math.sqrt(2.0) * (t_m / ((0.5 * (((2.0 * (math.pow(t_m, 2.0) + math.pow(t_m, 2.0))) + (2.0 * math.pow(l_m, 2.0))) / (t_m * (math.sqrt(2.0) * x)))) + (t_m * math.sqrt(2.0)))) elif t_m <= 2.3e+92: tmp = t_m * (math.sqrt(2.0) / math.sqrt((((2.0 * (math.pow(t_m, 2.0) / x)) + (t_2 + (math.pow(l_m, 2.0) / x))) + ((math.pow(l_m, 2.0) + t_2) / x)))) else: tmp = math.sqrt(((-1.0 + x) / (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) t_2 = Float64(2.0 * (t_m ^ 2.0)) tmp = 0.0 if (t_m <= 8.8e-165) tmp = Float64(sqrt(2.0) * Float64(t_m / Float64(Float64(0.5 * Float64(Float64(Float64(2.0 * Float64((t_m ^ 2.0) + (t_m ^ 2.0))) + Float64(2.0 * (l_m ^ 2.0))) / Float64(t_m * Float64(sqrt(2.0) * x)))) + Float64(t_m * sqrt(2.0))))); elseif (t_m <= 2.3e+92) tmp = Float64(t_m * Float64(sqrt(2.0) / sqrt(Float64(Float64(Float64(2.0 * Float64((t_m ^ 2.0) / x)) + Float64(t_2 + Float64((l_m ^ 2.0) / x))) + Float64(Float64((l_m ^ 2.0) + t_2) / x))))); else tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))); 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 = 2.0 * (t_m ^ 2.0); tmp = 0.0; if (t_m <= 8.8e-165) tmp = sqrt(2.0) * (t_m / ((0.5 * (((2.0 * ((t_m ^ 2.0) + (t_m ^ 2.0))) + (2.0 * (l_m ^ 2.0))) / (t_m * (sqrt(2.0) * x)))) + (t_m * sqrt(2.0)))); elseif (t_m <= 2.3e+92) tmp = t_m * (sqrt(2.0) / sqrt((((2.0 * ((t_m ^ 2.0) / x)) + (t_2 + ((l_m ^ 2.0) / x))) + (((l_m ^ 2.0) + t_2) / x)))); else tmp = sqrt(((-1.0 + x) / (x + 1.0))); 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[(2.0 * N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 8.8e-165], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[(N[(0.5 * N[(N[(N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] + N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 2.3e+92], N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[N[(N[(N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(N[Power[l$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[l$95$m, 2.0], $MachinePrecision] + t$95$2), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(-1.0 + x), $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)
\\
\begin{array}{l}
t_2 := 2 \cdot {t_m}^{2}\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 8.8 \cdot 10^{-165}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m}{0.5 \cdot \frac{2 \cdot \left({t_m}^{2} + {t_m}^{2}\right) + 2 \cdot {l_m}^{2}}{t_m \cdot \left(\sqrt{2} \cdot x\right)} + t_m \cdot \sqrt{2}}\\
\mathbf{elif}\;t_m \leq 2.3 \cdot 10^{+92}:\\
\;\;\;\;t_m \cdot \frac{\sqrt{2}}{\sqrt{\left(2 \cdot \frac{{t_m}^{2}}{x} + \left(t_2 + \frac{{l_m}^{2}}{x}\right)\right) + \frac{{l_m}^{2} + t_2}{x}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\end{array}
\end{array}
\end{array}
if t < 8.7999999999999995e-165Initial program 26.6%
Simplified26.6%
Taylor expanded in l around 0 23.3%
fma-def23.3%
associate-/l*33.1%
sub-neg33.1%
metadata-eval33.1%
+-commutative33.1%
+-commutative33.1%
associate--l+44.3%
sub-neg44.3%
metadata-eval44.3%
+-commutative44.3%
sub-neg44.3%
metadata-eval44.3%
+-commutative44.3%
Simplified44.3%
Taylor expanded in x around inf 20.4%
if 8.7999999999999995e-165 < t < 2.29999999999999998e92Initial program 49.7%
Simplified49.8%
Taylor expanded in x around inf 83.5%
if 2.29999999999999998e92 < t Initial program 25.5%
Simplified25.3%
Taylor expanded in t around inf 98.1%
Taylor expanded in t around 0 98.4%
Final simplification52.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
(let* ((t_2 (/ (+ -1.0 x) (+ x 1.0))))
(*
t_s
(if (<= t_m 1.16e-164)
(*
(sqrt 2.0)
(/
t_m
(+
(*
0.5
(/
(+ (* 2.0 (+ (pow t_m 2.0) (pow t_m 2.0))) (* 2.0 (pow l_m 2.0)))
(* t_m (* (sqrt 2.0) x))))
(* t_m (sqrt 2.0)))))
(if (<= t_m 2.75e+93)
(*
(sqrt 2.0)
(/
t_m
(sqrt
(fma
2.0
(/ (pow t_m 2.0) t_2)
(*
(pow l_m 2.0)
(+ (/ 1.0 (+ -1.0 x)) (+ (/ 1.0 x) (/ 1.0 (pow x 2.0)))))))))
(sqrt t_2))))))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 = (-1.0 + x) / (x + 1.0);
double tmp;
if (t_m <= 1.16e-164) {
tmp = sqrt(2.0) * (t_m / ((0.5 * (((2.0 * (pow(t_m, 2.0) + pow(t_m, 2.0))) + (2.0 * pow(l_m, 2.0))) / (t_m * (sqrt(2.0) * x)))) + (t_m * sqrt(2.0))));
} else if (t_m <= 2.75e+93) {
tmp = sqrt(2.0) * (t_m / sqrt(fma(2.0, (pow(t_m, 2.0) / t_2), (pow(l_m, 2.0) * ((1.0 / (-1.0 + x)) + ((1.0 / x) + (1.0 / pow(x, 2.0))))))));
} else {
tmp = sqrt(t_2);
}
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(Float64(-1.0 + x) / Float64(x + 1.0)) tmp = 0.0 if (t_m <= 1.16e-164) tmp = Float64(sqrt(2.0) * Float64(t_m / Float64(Float64(0.5 * Float64(Float64(Float64(2.0 * Float64((t_m ^ 2.0) + (t_m ^ 2.0))) + Float64(2.0 * (l_m ^ 2.0))) / Float64(t_m * Float64(sqrt(2.0) * x)))) + Float64(t_m * sqrt(2.0))))); elseif (t_m <= 2.75e+93) tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) / t_2), Float64((l_m ^ 2.0) * Float64(Float64(1.0 / Float64(-1.0 + x)) + Float64(Float64(1.0 / x) + Float64(1.0 / (x ^ 2.0))))))))); else tmp = sqrt(t_2); 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_] := Block[{t$95$2 = N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 1.16e-164], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[(N[(0.5 * N[(N[(N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] + N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 2.75e+93], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[Sqrt[N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] / t$95$2), $MachinePrecision] + N[(N[Power[l$95$m, 2.0], $MachinePrecision] * N[(N[(1.0 / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[t$95$2], $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 := \frac{-1 + x}{x + 1}\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 1.16 \cdot 10^{-164}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m}{0.5 \cdot \frac{2 \cdot \left({t_m}^{2} + {t_m}^{2}\right) + 2 \cdot {l_m}^{2}}{t_m \cdot \left(\sqrt{2} \cdot x\right)} + t_m \cdot \sqrt{2}}\\
\mathbf{elif}\;t_m \leq 2.75 \cdot 10^{+93}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m}{\sqrt{\mathsf{fma}\left(2, \frac{{t_m}^{2}}{t_2}, {l_m}^{2} \cdot \left(\frac{1}{-1 + x} + \left(\frac{1}{x} + \frac{1}{{x}^{2}}\right)\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{t_2}\\
\end{array}
\end{array}
\end{array}
if t < 1.16e-164Initial program 26.6%
Simplified26.6%
Taylor expanded in l around 0 23.3%
fma-def23.3%
associate-/l*33.1%
sub-neg33.1%
metadata-eval33.1%
+-commutative33.1%
+-commutative33.1%
associate--l+44.3%
sub-neg44.3%
metadata-eval44.3%
+-commutative44.3%
sub-neg44.3%
metadata-eval44.3%
+-commutative44.3%
Simplified44.3%
Taylor expanded in x around inf 20.4%
if 1.16e-164 < t < 2.75000000000000015e93Initial program 49.7%
Simplified49.6%
Taylor expanded in l around 0 61.3%
fma-def61.3%
associate-/l*69.5%
sub-neg69.5%
metadata-eval69.5%
+-commutative69.5%
+-commutative69.5%
associate--l+75.6%
sub-neg75.6%
metadata-eval75.6%
+-commutative75.6%
sub-neg75.6%
metadata-eval75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in x around inf 83.4%
if 2.75000000000000015e93 < t Initial program 25.5%
Simplified25.3%
Taylor expanded in t around inf 98.1%
Taylor expanded in t around 0 98.4%
Final simplification52.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
(let* ((t_2 (/ (+ -1.0 x) (+ x 1.0))))
(*
t_s
(if (<= t_m 7.2e-165)
(*
(sqrt 2.0)
(/
t_m
(+
(*
0.5
(/
(+ (* 2.0 (+ (pow t_m 2.0) (pow t_m 2.0))) (* 2.0 (pow l_m 2.0)))
(* t_m (* (sqrt 2.0) x))))
(* t_m (sqrt 2.0)))))
(if (<= t_m 1.9e+92)
(*
(sqrt 2.0)
(/
t_m
(sqrt (fma 2.0 (/ (pow t_m 2.0) t_2) (* 2.0 (/ (pow l_m 2.0) x))))))
(sqrt t_2))))))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 = (-1.0 + x) / (x + 1.0);
double tmp;
if (t_m <= 7.2e-165) {
tmp = sqrt(2.0) * (t_m / ((0.5 * (((2.0 * (pow(t_m, 2.0) + pow(t_m, 2.0))) + (2.0 * pow(l_m, 2.0))) / (t_m * (sqrt(2.0) * x)))) + (t_m * sqrt(2.0))));
} else if (t_m <= 1.9e+92) {
tmp = sqrt(2.0) * (t_m / sqrt(fma(2.0, (pow(t_m, 2.0) / t_2), (2.0 * (pow(l_m, 2.0) / x)))));
} else {
tmp = sqrt(t_2);
}
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(Float64(-1.0 + x) / Float64(x + 1.0)) tmp = 0.0 if (t_m <= 7.2e-165) tmp = Float64(sqrt(2.0) * Float64(t_m / Float64(Float64(0.5 * Float64(Float64(Float64(2.0 * Float64((t_m ^ 2.0) + (t_m ^ 2.0))) + Float64(2.0 * (l_m ^ 2.0))) / Float64(t_m * Float64(sqrt(2.0) * x)))) + Float64(t_m * sqrt(2.0))))); elseif (t_m <= 1.9e+92) tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) / t_2), Float64(2.0 * Float64((l_m ^ 2.0) / x)))))); else tmp = sqrt(t_2); 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_] := Block[{t$95$2 = N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 7.2e-165], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[(N[(0.5 * N[(N[(N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] + N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 1.9e+92], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[Sqrt[N[(2.0 * N[(N[Power[t$95$m, 2.0], $MachinePrecision] / t$95$2), $MachinePrecision] + N[(2.0 * N[(N[Power[l$95$m, 2.0], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[t$95$2], $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 := \frac{-1 + x}{x + 1}\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 7.2 \cdot 10^{-165}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m}{0.5 \cdot \frac{2 \cdot \left({t_m}^{2} + {t_m}^{2}\right) + 2 \cdot {l_m}^{2}}{t_m \cdot \left(\sqrt{2} \cdot x\right)} + t_m \cdot \sqrt{2}}\\
\mathbf{elif}\;t_m \leq 1.9 \cdot 10^{+92}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m}{\sqrt{\mathsf{fma}\left(2, \frac{{t_m}^{2}}{t_2}, 2 \cdot \frac{{l_m}^{2}}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{t_2}\\
\end{array}
\end{array}
\end{array}
if t < 7.19999999999999969e-165Initial program 26.6%
Simplified26.6%
Taylor expanded in l around 0 23.3%
fma-def23.3%
associate-/l*33.1%
sub-neg33.1%
metadata-eval33.1%
+-commutative33.1%
+-commutative33.1%
associate--l+44.3%
sub-neg44.3%
metadata-eval44.3%
+-commutative44.3%
sub-neg44.3%
metadata-eval44.3%
+-commutative44.3%
Simplified44.3%
Taylor expanded in x around inf 20.4%
if 7.19999999999999969e-165 < t < 1.9e92Initial program 49.7%
Simplified49.6%
Taylor expanded in l around 0 61.3%
fma-def61.3%
associate-/l*69.5%
sub-neg69.5%
metadata-eval69.5%
+-commutative69.5%
+-commutative69.5%
associate--l+75.6%
sub-neg75.6%
metadata-eval75.6%
+-commutative75.6%
sub-neg75.6%
metadata-eval75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in x around inf 83.2%
if 1.9e92 < t Initial program 25.5%
Simplified25.3%
Taylor expanded in t around inf 98.1%
Taylor expanded in t around 0 98.4%
Final simplification52.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
(if (<= l_m 1.05e+210)
(sqrt (/ (+ -1.0 x) (+ x 1.0)))
(* (sqrt 2.0) (* (sqrt (* 0.5 x)) (/ t_m 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 <= 1.05e+210) {
tmp = sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = sqrt(2.0) * (sqrt((0.5 * x)) * (t_m / 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 <= 1.05d+210) then
tmp = sqrt((((-1.0d0) + x) / (x + 1.0d0)))
else
tmp = sqrt(2.0d0) * (sqrt((0.5d0 * x)) * (t_m / 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 <= 1.05e+210) {
tmp = Math.sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = Math.sqrt(2.0) * (Math.sqrt((0.5 * x)) * (t_m / 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 <= 1.05e+210: tmp = math.sqrt(((-1.0 + x) / (x + 1.0))) else: tmp = math.sqrt(2.0) * (math.sqrt((0.5 * x)) * (t_m / 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 <= 1.05e+210) tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(Float64(0.5 * x)) * Float64(t_m / 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 <= 1.05e+210) tmp = sqrt(((-1.0 + x) / (x + 1.0))); else tmp = sqrt(2.0) * (sqrt((0.5 * x)) * (t_m / 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, 1.05e+210], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(0.5 * x), $MachinePrecision]], $MachinePrecision] * N[(t$95$m / l$95$m), $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.05 \cdot 10^{+210}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\sqrt{0.5 \cdot x} \cdot \frac{t_m}{l_m}\right)\\
\end{array}
\end{array}
if l < 1.0499999999999999e210Initial program 33.8%
Simplified33.7%
Taylor expanded in t around inf 47.3%
Taylor expanded in t around 0 47.5%
if 1.0499999999999999e210 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 1.5%
*-commutative1.5%
associate--l+52.4%
sub-neg52.4%
metadata-eval52.4%
+-commutative52.4%
sub-neg52.4%
metadata-eval52.4%
+-commutative52.4%
Simplified52.4%
Taylor expanded in x around inf 81.9%
*-commutative81.9%
Simplified81.9%
Final simplification49.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
(if (<= l_m 2.4e+209)
(sqrt (/ (+ -1.0 x) (+ x 1.0)))
(/ (sqrt (* 2.0 (fma 0.5 x -0.5))) (/ l_m t_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 <= 2.4e+209) {
tmp = sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = sqrt((2.0 * fma(0.5, x, -0.5))) / (l_m / t_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 <= 2.4e+209) tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))); else tmp = Float64(sqrt(Float64(2.0 * fma(0.5, x, -0.5))) / Float64(l_m / t_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, 2.4e+209], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(0.5 * x + -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(l$95$m / t$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 2.4 \cdot 10^{+209}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \mathsf{fma}\left(0.5, x, -0.5\right)}}{\frac{l_m}{t_m}}\\
\end{array}
\end{array}
if l < 2.39999999999999996e209Initial program 33.8%
Simplified33.7%
Taylor expanded in t around inf 47.3%
Taylor expanded in t around 0 47.5%
if 2.39999999999999996e209 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 1.5%
*-commutative1.5%
associate--l+52.4%
sub-neg52.4%
metadata-eval52.4%
+-commutative52.4%
sub-neg52.4%
metadata-eval52.4%
+-commutative52.4%
Simplified52.4%
Taylor expanded in x around 0 81.9%
associate-*r*81.8%
clear-num81.8%
un-div-inv81.9%
sqrt-unprod81.9%
fma-neg81.9%
metadata-eval81.9%
Applied egg-rr81.9%
Final simplification49.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
(if (<= l_m 1.2e+209)
(sqrt (/ (+ -1.0 x) (+ x 1.0)))
(* t_m (/ (sqrt (* 2.0 (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 <= 1.2e+209) {
tmp = sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = t_m * (sqrt((2.0 * 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 <= 1.2e+209) tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))); else tmp = Float64(t_m * Float64(sqrt(Float64(2.0 * 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, 1.2e+209], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$m * N[(N[Sqrt[N[(2.0 * N[(x * 0.5 + -0.5), $MachinePrecision]), $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 1.2 \cdot 10^{+209}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;t_m \cdot \frac{\sqrt{2 \cdot \mathsf{fma}\left(x, 0.5, -0.5\right)}}{l_m}\\
\end{array}
\end{array}
if l < 1.19999999999999998e209Initial program 33.8%
Simplified33.7%
Taylor expanded in t around inf 47.3%
Taylor expanded in t around 0 47.5%
if 1.19999999999999998e209 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 1.5%
*-commutative1.5%
associate--l+52.4%
sub-neg52.4%
metadata-eval52.4%
+-commutative52.4%
sub-neg52.4%
metadata-eval52.4%
+-commutative52.4%
Simplified52.4%
Taylor expanded in x around 0 81.9%
clear-num81.9%
un-div-inv81.9%
fma-neg81.9%
metadata-eval81.9%
Applied egg-rr81.9%
associate-*r/81.9%
frac-2neg81.9%
metadata-eval81.9%
fma-neg81.9%
sqrt-unprod81.9%
fma-neg81.9%
metadata-eval81.9%
distribute-neg-frac81.9%
Applied egg-rr81.9%
associate-/r/81.9%
neg-mul-181.9%
neg-mul-181.9%
times-frac81.9%
metadata-eval81.9%
fma-udef81.9%
*-commutative81.9%
fma-def81.9%
Simplified81.9%
Final simplification49.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 (sqrt (/ (+ -1.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(((-1.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((((-1.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(((-1.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(((-1.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(Float64(-1.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(((-1.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[(N[(-1.0 + x), $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{-1 + x}{x + 1}}
\end{array}
Initial program 31.7%
Simplified31.6%
Taylor expanded in t around inf 45.0%
Taylor expanded in t around 0 45.1%
Final simplification45.1%
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 31.7%
Simplified31.6%
Taylor expanded in t around inf 45.0%
Taylor expanded in x around inf 44.9%
Final simplification44.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 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 31.7%
Simplified31.6%
Taylor expanded in t around inf 45.0%
Taylor expanded in x around inf 44.6%
Final simplification44.6%
herbie shell --seed 2024011
(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)))))