
(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 11 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 (* 2.0 (pow t_m 2.0))))
(*
t_s
(if (<= t_m 1.26e-197)
(* (sqrt 2.0) (/ (* t_m (sqrt (fma x 0.5 -0.5))) l_m))
(if (or (<= t_m 5.5e-159) (not (<= t_m 2e+47)))
(sqrt (/ (+ -1.0 x) (+ x 1.0)))
(*
t_m
(/
(sqrt 2.0)
(sqrt
(+
(+ (* 2.0 (/ (pow t_m 2.0) x)) (+ t_2 (/ (pow l_m 2.0) x)))
(/ (+ t_2 (pow l_m 2.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 t_2 = 2.0 * pow(t_m, 2.0);
double tmp;
if (t_m <= 1.26e-197) {
tmp = sqrt(2.0) * ((t_m * sqrt(fma(x, 0.5, -0.5))) / l_m);
} else if ((t_m <= 5.5e-159) || !(t_m <= 2e+47)) {
tmp = sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = t_m * (sqrt(2.0) / sqrt((((2.0 * (pow(t_m, 2.0) / x)) + (t_2 + (pow(l_m, 2.0) / x))) + ((t_2 + pow(l_m, 2.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) t_2 = Float64(2.0 * (t_m ^ 2.0)) tmp = 0.0 if (t_m <= 1.26e-197) tmp = Float64(sqrt(2.0) * Float64(Float64(t_m * sqrt(fma(x, 0.5, -0.5))) / l_m)); elseif ((t_m <= 5.5e-159) || !(t_m <= 2e+47)) tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))); else 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(t_2 + (l_m ^ 2.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_] := 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, 1.26e-197], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(t$95$m * N[Sqrt[N[(x * 0.5 + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$m, 5.5e-159], N[Not[LessEqual[t$95$m, 2e+47]], $MachinePrecision]], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 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[(t$95$2 + N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := 2 \cdot {t_m}^{2}\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 1.26 \cdot 10^{-197}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m \cdot \sqrt{\mathsf{fma}\left(x, 0.5, -0.5\right)}}{l_m}\\
\mathbf{elif}\;t_m \leq 5.5 \cdot 10^{-159} \lor \neg \left(t_m \leq 2 \cdot 10^{+47}\right):\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;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{t_2 + {l_m}^{2}}{x}}}\\
\end{array}
\end{array}
\end{array}
if t < 1.26000000000000003e-197Initial program 31.4%
Simplified31.4%
Taylor expanded in l around inf 2.4%
*-commutative2.4%
associate--l+8.0%
sub-neg8.0%
metadata-eval8.0%
+-commutative8.0%
sub-neg8.0%
metadata-eval8.0%
+-commutative8.0%
Simplified8.0%
Taylor expanded in x around 0 14.1%
associate-*r/14.7%
*-commutative14.7%
fma-neg14.7%
metadata-eval14.7%
Applied egg-rr14.7%
if 1.26000000000000003e-197 < t < 5.5000000000000003e-159 or 2.0000000000000001e47 < t Initial program 21.4%
Simplified21.4%
Taylor expanded in t around inf 91.9%
Taylor expanded in t around 0 92.2%
if 5.5000000000000003e-159 < t < 2.0000000000000001e47Initial program 53.4%
Simplified53.5%
Taylor expanded in x around inf 86.4%
Final simplification48.5%
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(let* ((t_2 (* 2.0 (pow t_m 2.0))) (t_3 (+ t_2 (pow l_m 2.0))))
(*
t_s
(if (<= t_m 7e-159)
(*
t_m
(/
(sqrt 2.0)
(+
(* 0.5 (/ (+ t_3 t_3) (* t_m (* (sqrt 2.0) x))))
(* t_m (sqrt 2.0)))))
(if (<= t_m 9.2e+42)
(*
t_m
(/
(sqrt 2.0)
(sqrt
(+
(+ (* 2.0 (/ (pow t_m 2.0) x)) (+ t_2 (/ (pow l_m 2.0) x)))
(/ t_3 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 t_3 = t_2 + pow(l_m, 2.0);
double tmp;
if (t_m <= 7e-159) {
tmp = t_m * (sqrt(2.0) / ((0.5 * ((t_3 + t_3) / (t_m * (sqrt(2.0) * x)))) + (t_m * sqrt(2.0))));
} else if (t_m <= 9.2e+42) {
tmp = t_m * (sqrt(2.0) / sqrt((((2.0 * (pow(t_m, 2.0) / x)) + (t_2 + (pow(l_m, 2.0) / x))) + (t_3 / 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) :: t_3
real(8) :: tmp
t_2 = 2.0d0 * (t_m ** 2.0d0)
t_3 = t_2 + (l_m ** 2.0d0)
if (t_m <= 7d-159) then
tmp = t_m * (sqrt(2.0d0) / ((0.5d0 * ((t_3 + t_3) / (t_m * (sqrt(2.0d0) * x)))) + (t_m * sqrt(2.0d0))))
else if (t_m <= 9.2d+42) then
tmp = t_m * (sqrt(2.0d0) / sqrt((((2.0d0 * ((t_m ** 2.0d0) / x)) + (t_2 + ((l_m ** 2.0d0) / x))) + (t_3 / 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 t_3 = t_2 + Math.pow(l_m, 2.0);
double tmp;
if (t_m <= 7e-159) {
tmp = t_m * (Math.sqrt(2.0) / ((0.5 * ((t_3 + t_3) / (t_m * (Math.sqrt(2.0) * x)))) + (t_m * Math.sqrt(2.0))));
} else if (t_m <= 9.2e+42) {
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))) + (t_3 / 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) t_3 = t_2 + math.pow(l_m, 2.0) tmp = 0 if t_m <= 7e-159: tmp = t_m * (math.sqrt(2.0) / ((0.5 * ((t_3 + t_3) / (t_m * (math.sqrt(2.0) * x)))) + (t_m * math.sqrt(2.0)))) elif t_m <= 9.2e+42: 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))) + (t_3 / 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)) t_3 = Float64(t_2 + (l_m ^ 2.0)) tmp = 0.0 if (t_m <= 7e-159) tmp = Float64(t_m * Float64(sqrt(2.0) / Float64(Float64(0.5 * Float64(Float64(t_3 + t_3) / Float64(t_m * Float64(sqrt(2.0) * x)))) + Float64(t_m * sqrt(2.0))))); elseif (t_m <= 9.2e+42) 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(t_3 / 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); t_3 = t_2 + (l_m ^ 2.0); tmp = 0.0; if (t_m <= 7e-159) tmp = t_m * (sqrt(2.0) / ((0.5 * ((t_3 + t_3) / (t_m * (sqrt(2.0) * x)))) + (t_m * sqrt(2.0)))); elseif (t_m <= 9.2e+42) tmp = t_m * (sqrt(2.0) / sqrt((((2.0 * ((t_m ^ 2.0) / x)) + (t_2 + ((l_m ^ 2.0) / x))) + (t_3 / 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]}, Block[{t$95$3 = N[(t$95$2 + N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 7e-159], N[(t$95$m * N[(N[Sqrt[2.0], $MachinePrecision] / N[(N[(0.5 * N[(N[(t$95$3 + t$95$3), $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, 9.2e+42], 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[(t$95$3 / 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_3 := t_2 + {l_m}^{2}\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 7 \cdot 10^{-159}:\\
\;\;\;\;t_m \cdot \frac{\sqrt{2}}{0.5 \cdot \frac{t_3 + t_3}{t_m \cdot \left(\sqrt{2} \cdot x\right)} + t_m \cdot \sqrt{2}}\\
\mathbf{elif}\;t_m \leq 9.2 \cdot 10^{+42}:\\
\;\;\;\;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{t_3}{x}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\end{array}
\end{array}
\end{array}
if t < 7.00000000000000005e-159Initial program 30.1%
Simplified30.0%
Taylor expanded in x around inf 11.3%
if 7.00000000000000005e-159 < t < 9.2e42Initial program 53.4%
Simplified53.5%
Taylor expanded in x around inf 86.4%
if 9.2e42 < t Initial program 23.4%
Simplified23.4%
Taylor expanded in t around inf 94.0%
Taylor expanded in t around 0 94.3%
Final simplification45.0%
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.7e-198)
(* (sqrt 2.0) (/ (* t_m (sqrt (fma x 0.5 -0.5))) l_m))
(if (or (<= t_m 5.5e-159) (not (<= t_m 9.4e+42)))
(sqrt t_2)
(*
(sqrt 2.0)
(/
t_m
(sqrt
(fma 2.0 (/ (pow t_m 2.0) t_2) (/ (* 2.0 (pow l_m 2.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 t_2 = (-1.0 + x) / (x + 1.0);
double tmp;
if (t_m <= 1.7e-198) {
tmp = sqrt(2.0) * ((t_m * sqrt(fma(x, 0.5, -0.5))) / l_m);
} else if ((t_m <= 5.5e-159) || !(t_m <= 9.4e+42)) {
tmp = sqrt(t_2);
} else {
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))));
}
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.7e-198) tmp = Float64(sqrt(2.0) * Float64(Float64(t_m * sqrt(fma(x, 0.5, -0.5))) / l_m)); elseif ((t_m <= 5.5e-159) || !(t_m <= 9.4e+42)) tmp = sqrt(t_2); else tmp = Float64(sqrt(2.0) * Float64(t_m / sqrt(fma(2.0, Float64((t_m ^ 2.0) / t_2), Float64(Float64(2.0 * (l_m ^ 2.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_] := 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.7e-198], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(t$95$m * N[Sqrt[N[(x * 0.5 + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$m, 5.5e-159], N[Not[LessEqual[t$95$m, 9.4e+42]], $MachinePrecision]], N[Sqrt[t$95$2], $MachinePrecision], 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[(2.0 * N[Power[l$95$m, 2.0], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \frac{-1 + x}{x + 1}\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 1.7 \cdot 10^{-198}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m \cdot \sqrt{\mathsf{fma}\left(x, 0.5, -0.5\right)}}{l_m}\\
\mathbf{elif}\;t_m \leq 5.5 \cdot 10^{-159} \lor \neg \left(t_m \leq 9.4 \cdot 10^{+42}\right):\\
\;\;\;\;\sqrt{t_2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m}{\sqrt{\mathsf{fma}\left(2, \frac{{t_m}^{2}}{t_2}, \frac{2 \cdot {l_m}^{2}}{x}\right)}}\\
\end{array}
\end{array}
\end{array}
if t < 1.6999999999999999e-198Initial program 31.4%
Simplified31.4%
Taylor expanded in l around inf 2.4%
*-commutative2.4%
associate--l+8.0%
sub-neg8.0%
metadata-eval8.0%
+-commutative8.0%
sub-neg8.0%
metadata-eval8.0%
+-commutative8.0%
Simplified8.0%
Taylor expanded in x around 0 14.1%
associate-*r/14.7%
*-commutative14.7%
fma-neg14.7%
metadata-eval14.7%
Applied egg-rr14.7%
if 1.6999999999999999e-198 < t < 5.5000000000000003e-159 or 9.39999999999999971e42 < t Initial program 21.4%
Simplified21.4%
Taylor expanded in t around inf 91.9%
Taylor expanded in t around 0 92.2%
if 5.5000000000000003e-159 < t < 9.39999999999999971e42Initial program 53.4%
Simplified53.4%
Taylor expanded in l around 0 71.3%
fma-def71.3%
associate-/l*75.7%
sub-neg75.7%
metadata-eval75.7%
+-commutative75.7%
+-commutative75.7%
associate--l+77.6%
sub-neg77.6%
metadata-eval77.6%
+-commutative77.6%
sub-neg77.6%
metadata-eval77.6%
+-commutative77.6%
Simplified77.6%
Taylor expanded in x around inf 86.2%
associate-*r/86.2%
Simplified86.2%
Final simplification48.5%
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (or (<= t_m 2.5e-200) (and (not (<= t_m 3.7e-113)) (<= t_m 2.4e-97)))
(* (sqrt 2.0) (/ (* t_m (sqrt (fma x 0.5 -0.5))) l_m))
(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 tmp;
if ((t_m <= 2.5e-200) || (!(t_m <= 3.7e-113) && (t_m <= 2.4e-97))) {
tmp = sqrt(2.0) * ((t_m * sqrt(fma(x, 0.5, -0.5))) / l_m);
} 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.0, t) function code(t_s, x, l_m, t_m) tmp = 0.0 if ((t_m <= 2.5e-200) || (!(t_m <= 3.7e-113) && (t_m <= 2.4e-97))) tmp = Float64(sqrt(2.0) * Float64(Float64(t_m * sqrt(fma(x, 0.5, -0.5))) / l_m)); else tmp = sqrt(Float64(Float64(-1.0 + x) / 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[Or[LessEqual[t$95$m, 2.5e-200], And[N[Not[LessEqual[t$95$m, 3.7e-113]], $MachinePrecision], LessEqual[t$95$m, 2.4e-97]]], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(t$95$m * N[Sqrt[N[(x * 0.5 + -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l$95$m), $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)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 2.5 \cdot 10^{-200} \lor \neg \left(t_m \leq 3.7 \cdot 10^{-113}\right) \land t_m \leq 2.4 \cdot 10^{-97}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m \cdot \sqrt{\mathsf{fma}\left(x, 0.5, -0.5\right)}}{l_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\end{array}
\end{array}
if t < 2.49999999999999996e-200 or 3.6999999999999998e-113 < t < 2.4e-97Initial program 30.6%
Simplified30.5%
Taylor expanded in l around inf 2.3%
*-commutative2.3%
associate--l+7.9%
sub-neg7.9%
metadata-eval7.9%
+-commutative7.9%
sub-neg7.9%
metadata-eval7.9%
+-commutative7.9%
Simplified7.9%
Taylor expanded in x around 0 14.3%
associate-*r/15.5%
*-commutative15.5%
fma-neg15.5%
metadata-eval15.5%
Applied egg-rr15.5%
if 2.49999999999999996e-200 < t < 3.6999999999999998e-113 or 2.4e-97 < t Initial program 35.0%
Simplified35.0%
Taylor expanded in t around inf 90.4%
Taylor expanded in t around 0 90.7%
Final simplification47.2%
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 (or (<= t_m 1.82e-203) (and (not (<= t_m 2.25e-113)) (<= t_m 2.4e-97)))
(* (sqrt 2.0) (/ t_m (* l_m (sqrt (+ (/ 1.0 (+ -1.0 x)) (/ 1.0 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 tmp;
if ((t_m <= 1.82e-203) || (!(t_m <= 2.25e-113) && (t_m <= 2.4e-97))) {
tmp = sqrt(2.0) * (t_m / (l_m * sqrt(((1.0 / (-1.0 + x)) + (1.0 / 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) :: tmp
if ((t_m <= 1.82d-203) .or. (.not. (t_m <= 2.25d-113)) .and. (t_m <= 2.4d-97)) then
tmp = sqrt(2.0d0) * (t_m / (l_m * sqrt(((1.0d0 / ((-1.0d0) + x)) + (1.0d0 / 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 tmp;
if ((t_m <= 1.82e-203) || (!(t_m <= 2.25e-113) && (t_m <= 2.4e-97))) {
tmp = Math.sqrt(2.0) * (t_m / (l_m * Math.sqrt(((1.0 / (-1.0 + x)) + (1.0 / 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): tmp = 0 if (t_m <= 1.82e-203) or (not (t_m <= 2.25e-113) and (t_m <= 2.4e-97)): tmp = math.sqrt(2.0) * (t_m / (l_m * math.sqrt(((1.0 / (-1.0 + x)) + (1.0 / 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) tmp = 0.0 if ((t_m <= 1.82e-203) || (!(t_m <= 2.25e-113) && (t_m <= 2.4e-97))) tmp = Float64(sqrt(2.0) * Float64(t_m / Float64(l_m * sqrt(Float64(Float64(1.0 / Float64(-1.0 + x)) + Float64(1.0 / 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) tmp = 0.0; if ((t_m <= 1.82e-203) || (~((t_m <= 2.25e-113)) && (t_m <= 2.4e-97))) tmp = sqrt(2.0) * (t_m / (l_m * sqrt(((1.0 / (-1.0 + x)) + (1.0 / 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_] := N[(t$95$s * If[Or[LessEqual[t$95$m, 1.82e-203], And[N[Not[LessEqual[t$95$m, 2.25e-113]], $MachinePrecision], LessEqual[t$95$m, 2.4e-97]]], N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$m / N[(l$95$m * N[Sqrt[N[(N[(1.0 / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $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)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 1.82 \cdot 10^{-203} \lor \neg \left(t_m \leq 2.25 \cdot 10^{-113}\right) \land t_m \leq 2.4 \cdot 10^{-97}:\\
\;\;\;\;\sqrt{2} \cdot \frac{t_m}{l_m \cdot \sqrt{\frac{1}{-1 + x} + \frac{1}{x}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\end{array}
\end{array}
if t < 1.82000000000000006e-203 or 2.2500000000000001e-113 < t < 2.4e-97Initial program 30.6%
Simplified30.5%
Taylor expanded in l around inf 2.5%
associate--l+8.0%
sub-neg8.0%
metadata-eval8.0%
+-commutative8.0%
sub-neg8.0%
metadata-eval8.0%
+-commutative8.0%
Simplified8.0%
Taylor expanded in x around inf 15.5%
if 1.82000000000000006e-203 < t < 2.2500000000000001e-113 or 2.4e-97 < t Initial program 35.0%
Simplified35.0%
Taylor expanded in t around inf 90.4%
Taylor expanded in t around 0 90.7%
Final simplification47.2%
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+269)
(sqrt (/ (+ -1.0 x) (+ x 1.0)))
(* (sqrt 2.0) (* (sqrt (- (* 0.5 x) 0.5)) (/ 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.2e+269) {
tmp = sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = sqrt(2.0) * (sqrt(((0.5 * x) - 0.5)) * (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.2d+269) then
tmp = sqrt((((-1.0d0) + x) / (x + 1.0d0)))
else
tmp = sqrt(2.0d0) * (sqrt(((0.5d0 * x) - 0.5d0)) * (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.2e+269) {
tmp = Math.sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = Math.sqrt(2.0) * (Math.sqrt(((0.5 * x) - 0.5)) * (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.2e+269: tmp = math.sqrt(((-1.0 + x) / (x + 1.0))) else: tmp = math.sqrt(2.0) * (math.sqrt(((0.5 * x) - 0.5)) * (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.2e+269) tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(Float64(Float64(0.5 * x) - 0.5)) * 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.2e+269) tmp = sqrt(((-1.0 + x) / (x + 1.0))); else tmp = sqrt(2.0) * (sqrt(((0.5 * x) - 0.5)) * (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.2e+269], 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[(N[(0.5 * x), $MachinePrecision] - 0.5), $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.2 \cdot 10^{+269}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\sqrt{0.5 \cdot x - 0.5} \cdot \frac{t_m}{l_m}\right)\\
\end{array}
\end{array}
if l < 1.19999999999999997e269Initial program 32.7%
Simplified32.6%
Taylor expanded in t around inf 41.1%
Taylor expanded in t around 0 41.2%
if 1.19999999999999997e269 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 2.6%
*-commutative2.6%
associate--l+20.4%
sub-neg20.4%
metadata-eval20.4%
+-commutative20.4%
sub-neg20.4%
metadata-eval20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in x around 0 99.2%
Final simplification41.7%
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= l_m 1.05e+269)
(sqrt (/ (+ -1.0 x) (+ x 1.0)))
(* (sqrt 2.0) (* (/ t_m l_m) (sqrt (* 0.5 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 (l_m <= 1.05e+269) {
tmp = sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = sqrt(2.0) * ((t_m / l_m) * sqrt((0.5 * 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 (l_m <= 1.05d+269) then
tmp = sqrt((((-1.0d0) + x) / (x + 1.0d0)))
else
tmp = sqrt(2.0d0) * ((t_m / l_m) * sqrt((0.5d0 * 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 (l_m <= 1.05e+269) {
tmp = Math.sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = Math.sqrt(2.0) * ((t_m / l_m) * Math.sqrt((0.5 * 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 l_m <= 1.05e+269: tmp = math.sqrt(((-1.0 + x) / (x + 1.0))) else: tmp = math.sqrt(2.0) * ((t_m / l_m) * math.sqrt((0.5 * 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 (l_m <= 1.05e+269) tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))); else tmp = Float64(sqrt(2.0) * Float64(Float64(t_m / l_m) * sqrt(Float64(0.5 * 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 (l_m <= 1.05e+269) tmp = sqrt(((-1.0 + x) / (x + 1.0))); else tmp = sqrt(2.0) * ((t_m / l_m) * sqrt((0.5 * 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[l$95$m, 1.05e+269], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Sqrt[N[(0.5 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 1.05 \cdot 10^{+269}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\frac{t_m}{l_m} \cdot \sqrt{0.5 \cdot x}\right)\\
\end{array}
\end{array}
if l < 1.05e269Initial program 32.7%
Simplified32.6%
Taylor expanded in t around inf 41.1%
Taylor expanded in t around 0 41.2%
if 1.05e269 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 2.6%
*-commutative2.6%
associate--l+20.4%
sub-neg20.4%
metadata-eval20.4%
+-commutative20.4%
sub-neg20.4%
metadata-eval20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in x around inf 99.2%
*-commutative99.2%
Simplified99.2%
Final simplification41.7%
l_m = (fabs.f64 l)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x l_m t_m)
:precision binary64
(*
t_s
(if (<= l_m 7e+268)
(sqrt (/ (+ -1.0 x) (+ x 1.0)))
(* (/ t_m l_m) (sqrt (* 2.0 (fma x 0.5 -0.5)))))))l_m = fabs(l);
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double l_m, double t_m) {
double tmp;
if (l_m <= 7e+268) {
tmp = sqrt(((-1.0 + x) / (x + 1.0)));
} else {
tmp = (t_m / l_m) * sqrt((2.0 * fma(x, 0.5, -0.5)));
}
return t_s * tmp;
}
l_m = abs(l) t_m = abs(t) t_s = copysign(1.0, t) function code(t_s, x, l_m, t_m) tmp = 0.0 if (l_m <= 7e+268) tmp = sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0))); else tmp = Float64(Float64(t_m / l_m) * sqrt(Float64(2.0 * fma(x, 0.5, -0.5)))); end return Float64(t_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, l$95$m_, t$95$m_] := N[(t$95$s * If[LessEqual[l$95$m, 7e+268], N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$m / l$95$m), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(x * 0.5 + -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;l_m \leq 7 \cdot 10^{+268}:\\
\;\;\;\;\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_m}{l_m} \cdot \sqrt{2 \cdot \mathsf{fma}\left(x, 0.5, -0.5\right)}\\
\end{array}
\end{array}
if l < 6.99999999999999945e268Initial program 32.7%
Simplified32.6%
Taylor expanded in t around inf 41.1%
Taylor expanded in t around 0 41.2%
if 6.99999999999999945e268 < l Initial program 0.0%
Simplified0.0%
Taylor expanded in l around inf 2.6%
*-commutative2.6%
associate--l+20.4%
sub-neg20.4%
metadata-eval20.4%
+-commutative20.4%
sub-neg20.4%
metadata-eval20.4%
+-commutative20.4%
Simplified20.4%
Taylor expanded in x around 0 99.2%
expm1-log1p-u99.2%
expm1-udef3.8%
associate-*r*3.8%
sqrt-unprod3.8%
*-commutative3.8%
fma-neg3.8%
metadata-eval3.8%
Applied egg-rr3.8%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
Simplified100.0%
Final simplification41.7%
l_m = (fabs.f64 l) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) (FPCore (t_s x l_m t_m) :precision binary64 (* t_s (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 32.4%
Simplified32.4%
Taylor expanded in t around inf 40.8%
Taylor expanded in t around 0 40.9%
Final simplification40.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 (/ 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.4%
Simplified32.4%
Taylor expanded in t around inf 40.8%
Taylor expanded in x around inf 40.5%
Final simplification40.5%
l_m = (fabs.f64 l) t_m = (fabs.f64 t) t_s = (copysign.f64 1 t) (FPCore (t_s x l_m t_m) :precision binary64 (* t_s 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.4%
Simplified32.4%
Taylor expanded in t around inf 40.8%
Taylor expanded in x around inf 40.1%
Final simplification40.1%
herbie shell --seed 2024024
(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)))))