
(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}
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(let* ((t_1 (/ (* t (sqrt 2.0)) (sqrt (* 2.0 (+ (* l (/ l x)) (* t t))))))
(t_2 (sqrt (/ (+ x -1.0) (+ x 1.0)))))
(if (<= t -1.7e+150)
(- t_2)
(if (<= t -8.3e-203)
t_1
(if (<= t 6.9e-164)
(/ (* t (sqrt x)) l)
(if (<= t 96000000.0) t_1 t_2))))))l = abs(l);
double code(double x, double l, double t) {
double t_1 = (t * sqrt(2.0)) / sqrt((2.0 * ((l * (l / x)) + (t * t))));
double t_2 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.7e+150) {
tmp = -t_2;
} else if (t <= -8.3e-203) {
tmp = t_1;
} else if (t <= 6.9e-164) {
tmp = (t * sqrt(x)) / l;
} else if (t <= 96000000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (t * sqrt(2.0d0)) / sqrt((2.0d0 * ((l * (l / x)) + (t * t))))
t_2 = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
if (t <= (-1.7d+150)) then
tmp = -t_2
else if (t <= (-8.3d-203)) then
tmp = t_1
else if (t <= 6.9d-164) then
tmp = (t * sqrt(x)) / l
else if (t <= 96000000.0d0) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double t_1 = (t * Math.sqrt(2.0)) / Math.sqrt((2.0 * ((l * (l / x)) + (t * t))));
double t_2 = Math.sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -1.7e+150) {
tmp = -t_2;
} else if (t <= -8.3e-203) {
tmp = t_1;
} else if (t <= 6.9e-164) {
tmp = (t * Math.sqrt(x)) / l;
} else if (t <= 96000000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
l = abs(l) def code(x, l, t): t_1 = (t * math.sqrt(2.0)) / math.sqrt((2.0 * ((l * (l / x)) + (t * t)))) t_2 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -1.7e+150: tmp = -t_2 elif t <= -8.3e-203: tmp = t_1 elif t <= 6.9e-164: tmp = (t * math.sqrt(x)) / l elif t <= 96000000.0: tmp = t_1 else: tmp = t_2 return tmp
l = abs(l) function code(x, l, t) t_1 = Float64(Float64(t * sqrt(2.0)) / sqrt(Float64(2.0 * Float64(Float64(l * Float64(l / x)) + Float64(t * t))))) t_2 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -1.7e+150) tmp = Float64(-t_2); elseif (t <= -8.3e-203) tmp = t_1; elseif (t <= 6.9e-164) tmp = Float64(Float64(t * sqrt(x)) / l); elseif (t <= 96000000.0) tmp = t_1; else tmp = t_2; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) t_1 = (t * sqrt(2.0)) / sqrt((2.0 * ((l * (l / x)) + (t * t)))); t_2 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -1.7e+150) tmp = -t_2; elseif (t <= -8.3e-203) tmp = t_1; elseif (t <= 6.9e-164) tmp = (t * sqrt(x)) / l; elseif (t <= 96000000.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := Block[{t$95$1 = N[(N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(2.0 * N[(N[(l * N[(l / x), $MachinePrecision]), $MachinePrecision] + N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.7e+150], (-t$95$2), If[LessEqual[t, -8.3e-203], t$95$1, If[LessEqual[t, 6.9e-164], N[(N[(t * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[t, 96000000.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := \frac{t \cdot \sqrt{2}}{\sqrt{2 \cdot \left(\ell \cdot \frac{\ell}{x} + t \cdot t\right)}}\\
t_2 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -1.7 \cdot 10^{+150}:\\
\;\;\;\;-t_2\\
\mathbf{elif}\;t \leq -8.3 \cdot 10^{-203}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 6.9 \cdot 10^{-164}:\\
\;\;\;\;\frac{t \cdot \sqrt{x}}{\ell}\\
\mathbf{elif}\;t \leq 96000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.69999999999999991e150Initial program 2.3%
associate-*l/2.3%
*-commutative2.3%
fma-neg2.3%
sqr-neg2.3%
fma-neg2.3%
Simplified2.3%
Applied egg-rr88.0%
Taylor expanded in t around -inf 97.6%
mul-1-neg97.6%
sub-neg97.6%
metadata-eval97.6%
+-commutative97.6%
+-commutative97.6%
Simplified97.6%
if -1.69999999999999991e150 < t < -8.29999999999999985e-203 or 6.89999999999999995e-164 < t < 9.6e7Initial program 50.3%
fma-neg50.3%
sqr-neg50.3%
fma-neg50.3%
sqr-neg50.3%
sqr-neg50.3%
sqr-neg50.3%
Simplified50.3%
Taylor expanded in x around inf 77.4%
distribute-lft-out77.4%
fma-def77.4%
unpow277.4%
unpow277.4%
unpow277.4%
Simplified77.4%
Taylor expanded in t around 0 76.8%
unpow276.8%
Simplified76.8%
*-un-lft-identity76.8%
associate-/l*88.3%
Applied egg-rr88.3%
*-lft-identity88.3%
associate-/r/88.4%
Simplified88.4%
if -8.29999999999999985e-203 < t < 6.89999999999999995e-164Initial program 7.2%
fma-neg7.3%
sqr-neg7.3%
fma-neg7.2%
sqr-neg7.2%
sqr-neg7.2%
sqr-neg7.2%
Simplified7.3%
Taylor expanded in x around inf 52.8%
distribute-lft-out52.8%
fma-def52.8%
unpow252.8%
unpow252.8%
unpow252.8%
Simplified52.8%
Taylor expanded in t around 0 37.7%
associate-*l/41.8%
Applied egg-rr41.8%
if 9.6e7 < t Initial program 40.6%
associate-*l/40.6%
*-commutative40.6%
fma-neg40.6%
sqr-neg40.6%
fma-neg40.6%
Simplified40.6%
Applied egg-rr84.4%
Taylor expanded in l around 0 97.5%
Final simplification84.7%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -1.8e-139) (+ -1.0 (/ 1.0 x)) (if (<= t 8.5e-64) (/ (* t (sqrt x)) l) (sqrt (/ (+ x -1.0) (+ x 1.0))))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -1.8e-139) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 8.5e-64) {
tmp = (t * sqrt(x)) / l;
} else {
tmp = sqrt(((x + -1.0) / (x + 1.0)));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.8d-139)) then
tmp = (-1.0d0) + (1.0d0 / x)
else if (t <= 8.5d-64) then
tmp = (t * sqrt(x)) / l
else
tmp = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -1.8e-139) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 8.5e-64) {
tmp = (t * Math.sqrt(x)) / l;
} else {
tmp = Math.sqrt(((x + -1.0) / (x + 1.0)));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -1.8e-139: tmp = -1.0 + (1.0 / x) elif t <= 8.5e-64: tmp = (t * math.sqrt(x)) / l else: tmp = math.sqrt(((x + -1.0) / (x + 1.0))) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -1.8e-139) tmp = Float64(-1.0 + Float64(1.0 / x)); elseif (t <= 8.5e-64) tmp = Float64(Float64(t * sqrt(x)) / l); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -1.8e-139) tmp = -1.0 + (1.0 / x); elseif (t <= 8.5e-64) tmp = (t * sqrt(x)) / l; else tmp = sqrt(((x + -1.0) / (x + 1.0))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -1.8e-139], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e-64], N[(N[(t * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-139}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-64}:\\
\;\;\;\;\frac{t \cdot \sqrt{x}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{x + 1}}\\
\end{array}
\end{array}
if t < -1.80000000000000002e-139Initial program 37.4%
associate-*l/37.4%
*-commutative37.4%
fma-neg37.4%
sqr-neg37.4%
fma-neg37.4%
Simplified37.4%
Applied egg-rr71.5%
Taylor expanded in l around 0 1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt86.2%
Simplified86.2%
if -1.80000000000000002e-139 < t < 8.49999999999999996e-64Initial program 11.7%
fma-neg11.8%
sqr-neg11.8%
fma-neg11.7%
sqr-neg11.7%
sqr-neg11.7%
sqr-neg11.7%
Simplified11.8%
Taylor expanded in x around inf 54.8%
distribute-lft-out54.8%
fma-def54.8%
unpow254.8%
unpow254.8%
unpow254.8%
Simplified54.8%
Taylor expanded in t around 0 32.4%
associate-*l/39.1%
Applied egg-rr39.1%
if 8.49999999999999996e-64 < t Initial program 44.2%
associate-*l/44.1%
*-commutative44.1%
fma-neg44.1%
sqr-neg44.1%
fma-neg44.1%
Simplified44.1%
Applied egg-rr82.3%
Taylor expanded in l around 0 94.7%
Final simplification76.8%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (let* ((t_1 (sqrt (/ (+ x -1.0) (+ x 1.0))))) (if (<= t -2.1e-139) (- t_1) (if (<= t 8.5e-64) (/ (* t (sqrt x)) l) t_1))))
l = abs(l);
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -2.1e-139) {
tmp = -t_1;
} else if (t <= 8.5e-64) {
tmp = (t * sqrt(x)) / l;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(((x + (-1.0d0)) / (x + 1.0d0)))
if (t <= (-2.1d-139)) then
tmp = -t_1
else if (t <= 8.5d-64) then
tmp = (t * sqrt(x)) / l
else
tmp = t_1
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((x + -1.0) / (x + 1.0)));
double tmp;
if (t <= -2.1e-139) {
tmp = -t_1;
} else if (t <= 8.5e-64) {
tmp = (t * Math.sqrt(x)) / l;
} else {
tmp = t_1;
}
return tmp;
}
l = abs(l) def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (x + 1.0))) tmp = 0 if t <= -2.1e-139: tmp = -t_1 elif t <= 8.5e-64: tmp = (t * math.sqrt(x)) / l else: tmp = t_1 return tmp
l = abs(l) function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(x + 1.0))) tmp = 0.0 if (t <= -2.1e-139) tmp = Float64(-t_1); elseif (t <= 8.5e-64) tmp = Float64(Float64(t * sqrt(x)) / l); else tmp = t_1; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (x + 1.0))); tmp = 0.0; if (t <= -2.1e-139) tmp = -t_1; elseif (t <= 8.5e-64) tmp = (t * sqrt(x)) / l; else tmp = t_1; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -2.1e-139], (-t$95$1), If[LessEqual[t, 8.5e-64], N[(N[(t * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], t$95$1]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{x + 1}}\\
\mathbf{if}\;t \leq -2.1 \cdot 10^{-139}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-64}:\\
\;\;\;\;\frac{t \cdot \sqrt{x}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -2.10000000000000008e-139Initial program 37.4%
associate-*l/37.4%
*-commutative37.4%
fma-neg37.4%
sqr-neg37.4%
fma-neg37.4%
Simplified37.4%
Applied egg-rr71.5%
Taylor expanded in t around -inf 87.0%
mul-1-neg87.0%
sub-neg87.0%
metadata-eval87.0%
+-commutative87.0%
+-commutative87.0%
Simplified87.0%
if -2.10000000000000008e-139 < t < 8.49999999999999996e-64Initial program 11.7%
fma-neg11.8%
sqr-neg11.8%
fma-neg11.7%
sqr-neg11.7%
sqr-neg11.7%
sqr-neg11.7%
Simplified11.8%
Taylor expanded in x around inf 54.8%
distribute-lft-out54.8%
fma-def54.8%
unpow254.8%
unpow254.8%
unpow254.8%
Simplified54.8%
Taylor expanded in t around 0 32.4%
associate-*l/39.1%
Applied egg-rr39.1%
if 8.49999999999999996e-64 < t Initial program 44.2%
associate-*l/44.1%
*-commutative44.1%
fma-neg44.1%
sqr-neg44.1%
fma-neg44.1%
Simplified44.1%
Applied egg-rr82.3%
Taylor expanded in l around 0 94.7%
Final simplification77.2%
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(if (<= t -9.8e-139)
(+ -1.0 (/ 1.0 x))
(if (<= t 4.3e-63)
(* t (/ (sqrt x) l))
(+ 1.0 (+ (/ 0.5 (* x x)) (/ -1.0 x))))))l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -9.8e-139) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 4.3e-63) {
tmp = t * (sqrt(x) / l);
} else {
tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-9.8d-139)) then
tmp = (-1.0d0) + (1.0d0 / x)
else if (t <= 4.3d-63) then
tmp = t * (sqrt(x) / l)
else
tmp = 1.0d0 + ((0.5d0 / (x * x)) + ((-1.0d0) / x))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -9.8e-139) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 4.3e-63) {
tmp = t * (Math.sqrt(x) / l);
} else {
tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -9.8e-139: tmp = -1.0 + (1.0 / x) elif t <= 4.3e-63: tmp = t * (math.sqrt(x) / l) else: tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x)) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -9.8e-139) tmp = Float64(-1.0 + Float64(1.0 / x)); elseif (t <= 4.3e-63) tmp = Float64(t * Float64(sqrt(x) / l)); else tmp = Float64(1.0 + Float64(Float64(0.5 / Float64(x * x)) + Float64(-1.0 / x))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -9.8e-139) tmp = -1.0 + (1.0 / x); elseif (t <= 4.3e-63) tmp = t * (sqrt(x) / l); else tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x)); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -9.8e-139], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.3e-63], N[(t * N[(N[Sqrt[x], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.8 \cdot 10^{-139}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{-63}:\\
\;\;\;\;t \cdot \frac{\sqrt{x}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{0.5}{x \cdot x} + \frac{-1}{x}\right)\\
\end{array}
\end{array}
if t < -9.80000000000000063e-139Initial program 37.4%
associate-*l/37.4%
*-commutative37.4%
fma-neg37.4%
sqr-neg37.4%
fma-neg37.4%
Simplified37.4%
Applied egg-rr71.5%
Taylor expanded in l around 0 1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt86.2%
Simplified86.2%
if -9.80000000000000063e-139 < t < 4.2999999999999999e-63Initial program 11.7%
associate-*l/11.7%
*-commutative11.7%
fma-neg11.8%
sqr-neg11.8%
fma-neg11.7%
Simplified11.8%
Taylor expanded in l around inf 8.3%
unpow28.3%
*-commutative8.3%
associate--l+23.1%
sub-neg23.1%
metadata-eval23.1%
+-commutative23.1%
sub-neg23.1%
metadata-eval23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in x around inf 45.0%
unpow245.0%
Simplified45.0%
Taylor expanded in l around 0 39.0%
associate-*l/39.1%
*-lft-identity39.1%
Simplified39.1%
if 4.2999999999999999e-63 < t Initial program 44.2%
associate-*l/44.1%
*-commutative44.1%
fma-neg44.1%
sqr-neg44.1%
fma-neg44.1%
Simplified44.1%
Applied egg-rr82.3%
Taylor expanded in l around 0 94.7%
Taylor expanded in x around inf 93.1%
associate--l+93.1%
associate-*r/93.1%
metadata-eval93.1%
unpow293.1%
Simplified93.1%
Final simplification76.2%
NOTE: l should be positive before calling this function
(FPCore (x l t)
:precision binary64
(if (<= t -1.45e-139)
(+ -1.0 (/ 1.0 x))
(if (<= t 1.22e-63)
(/ (* t (sqrt x)) l)
(+ 1.0 (+ (/ 0.5 (* x x)) (/ -1.0 x))))))l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -1.45e-139) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 1.22e-63) {
tmp = (t * sqrt(x)) / l;
} else {
tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.45d-139)) then
tmp = (-1.0d0) + (1.0d0 / x)
else if (t <= 1.22d-63) then
tmp = (t * sqrt(x)) / l
else
tmp = 1.0d0 + ((0.5d0 / (x * x)) + ((-1.0d0) / x))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -1.45e-139) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 1.22e-63) {
tmp = (t * Math.sqrt(x)) / l;
} else {
tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -1.45e-139: tmp = -1.0 + (1.0 / x) elif t <= 1.22e-63: tmp = (t * math.sqrt(x)) / l else: tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x)) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -1.45e-139) tmp = Float64(-1.0 + Float64(1.0 / x)); elseif (t <= 1.22e-63) tmp = Float64(Float64(t * sqrt(x)) / l); else tmp = Float64(1.0 + Float64(Float64(0.5 / Float64(x * x)) + Float64(-1.0 / x))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -1.45e-139) tmp = -1.0 + (1.0 / x); elseif (t <= 1.22e-63) tmp = (t * sqrt(x)) / l; else tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x)); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -1.45e-139], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.22e-63], N[(N[(t * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], N[(1.0 + N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-139}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{elif}\;t \leq 1.22 \cdot 10^{-63}:\\
\;\;\;\;\frac{t \cdot \sqrt{x}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{0.5}{x \cdot x} + \frac{-1}{x}\right)\\
\end{array}
\end{array}
if t < -1.4499999999999999e-139Initial program 37.4%
associate-*l/37.4%
*-commutative37.4%
fma-neg37.4%
sqr-neg37.4%
fma-neg37.4%
Simplified37.4%
Applied egg-rr71.5%
Taylor expanded in l around 0 1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt86.2%
Simplified86.2%
if -1.4499999999999999e-139 < t < 1.2199999999999999e-63Initial program 11.7%
fma-neg11.8%
sqr-neg11.8%
fma-neg11.7%
sqr-neg11.7%
sqr-neg11.7%
sqr-neg11.7%
Simplified11.8%
Taylor expanded in x around inf 54.8%
distribute-lft-out54.8%
fma-def54.8%
unpow254.8%
unpow254.8%
unpow254.8%
Simplified54.8%
Taylor expanded in t around 0 32.4%
associate-*l/39.1%
Applied egg-rr39.1%
if 1.2199999999999999e-63 < t Initial program 44.2%
associate-*l/44.1%
*-commutative44.1%
fma-neg44.1%
sqr-neg44.1%
fma-neg44.1%
Simplified44.1%
Applied egg-rr82.3%
Taylor expanded in l around 0 94.7%
Taylor expanded in x around inf 93.1%
associate--l+93.1%
associate-*r/93.1%
metadata-eval93.1%
unpow293.1%
Simplified93.1%
Final simplification76.2%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) (+ 1.0 (+ (/ 0.5 (* x x)) (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x));
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = 1.0d0 + ((0.5d0 / (x * x)) + ((-1.0d0) / x))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x));
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + (1.0 / x) else: tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x)) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = Float64(1.0 + Float64(Float64(0.5 / Float64(x * x)) + Float64(-1.0 / x))); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + (1.0 / x); else tmp = 1.0 + ((0.5 / (x * x)) + (-1.0 / x)); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{0.5}{x \cdot x} + \frac{-1}{x}\right)\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 30.8%
associate-*l/30.8%
*-commutative30.8%
fma-neg30.8%
sqr-neg30.8%
fma-neg30.8%
Simplified30.8%
Applied egg-rr62.0%
Taylor expanded in l around 0 1.7%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt75.1%
Simplified75.1%
if -4.999999999999985e-310 < t Initial program 35.1%
associate-*l/35.1%
*-commutative35.1%
fma-neg35.1%
sqr-neg35.1%
fma-neg35.1%
Simplified35.1%
Applied egg-rr68.7%
Taylor expanded in l around 0 76.5%
Taylor expanded in x around inf 75.4%
associate--l+75.4%
associate-*r/75.4%
metadata-eval75.4%
unpow275.4%
Simplified75.4%
Final simplification75.2%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) 1.0))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = 1.0d0
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0;
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + (1.0 / x) else: tmp = 1.0 return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = 1.0; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + (1.0 / x); else tmp = 1.0; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 30.8%
associate-*l/30.8%
*-commutative30.8%
fma-neg30.8%
sqr-neg30.8%
fma-neg30.8%
Simplified30.8%
Applied egg-rr62.0%
Taylor expanded in l around 0 1.7%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt75.1%
Simplified75.1%
if -4.999999999999985e-310 < t Initial program 35.1%
associate-*l/35.1%
Simplified35.1%
Taylor expanded in x around inf 73.2%
*-commutative73.2%
Simplified73.2%
sqrt-unprod74.3%
metadata-eval74.3%
metadata-eval74.3%
Applied egg-rr74.3%
Final simplification74.7%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (/ 1.0 x)) (- 1.0 (/ 1.0 x))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 - (1.0 / x);
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = (-1.0d0) + (1.0d0 / x)
else
tmp = 1.0d0 - (1.0d0 / x)
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + (1.0 / x);
} else {
tmp = 1.0 - (1.0 / x);
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + (1.0 / x) else: tmp = 1.0 - (1.0 / x) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(1.0 / x)); else tmp = Float64(1.0 - Float64(1.0 / x)); end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + (1.0 / x); else tmp = 1.0 - (1.0 / x); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{1}{x}\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 30.8%
associate-*l/30.8%
*-commutative30.8%
fma-neg30.8%
sqr-neg30.8%
fma-neg30.8%
Simplified30.8%
Applied egg-rr62.0%
Taylor expanded in l around 0 1.7%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt75.1%
Simplified75.1%
if -4.999999999999985e-310 < t Initial program 35.1%
associate-*l/35.1%
*-commutative35.1%
fma-neg35.1%
sqr-neg35.1%
fma-neg35.1%
Simplified35.1%
Applied egg-rr68.7%
Taylor expanded in l around 0 76.5%
Taylor expanded in x around inf 75.0%
Final simplification75.0%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) -1.0 1.0))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-310)) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 else: tmp = 1.0 return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = -1.0; else tmp = 1.0; end return tmp end
l = abs(l) function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := If[LessEqual[t, -5e-310], -1.0, 1.0]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 30.8%
associate-*l/30.8%
*-commutative30.8%
fma-neg30.8%
sqr-neg30.8%
fma-neg30.8%
Simplified30.8%
Applied egg-rr62.0%
Taylor expanded in l around 0 1.7%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt74.1%
Simplified74.1%
if -4.999999999999985e-310 < t Initial program 35.1%
associate-*l/35.1%
Simplified35.1%
Taylor expanded in x around inf 73.2%
*-commutative73.2%
Simplified73.2%
sqrt-unprod74.3%
metadata-eval74.3%
metadata-eval74.3%
Applied egg-rr74.3%
Final simplification74.2%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 -1.0)
l = abs(l);
double code(double x, double l, double t) {
return -1.0;
}
NOTE: l should be positive before calling this function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = -1.0d0
end function
l = Math.abs(l);
public static double code(double x, double l, double t) {
return -1.0;
}
l = abs(l) def code(x, l, t): return -1.0
l = abs(l) function code(x, l, t) return -1.0 end
l = abs(l) function tmp = code(x, l, t) tmp = -1.0; end
NOTE: l should be positive before calling this function code[x_, l_, t_] := -1.0
\begin{array}{l}
l = |l|\\
\\
-1
\end{array}
Initial program 33.0%
associate-*l/33.0%
*-commutative33.0%
fma-neg33.0%
sqr-neg33.0%
fma-neg33.0%
Simplified33.0%
Applied egg-rr65.5%
Taylor expanded in l around 0 40.3%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt36.8%
Simplified36.8%
Final simplification36.8%
herbie shell --seed 2023285
(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)))))