
(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}
(FPCore (x l t)
:precision binary64
(let* ((t_1 (/ l (/ x l))))
(if (<= t -9.5e+150)
(+ (/ 1.0 x) -1.0)
(if (<= t 1.7e+38)
(log1p
(expm1
(*
t
(sqrt
(/ 2.0 (+ t_1 (fma 2.0 (* t (/ t x)) (fma 2.0 (* t t) t_1))))))))
(sqrt (/ (+ x -1.0) (+ 1.0 x)))))))
double code(double x, double l, double t) {
double t_1 = l / (x / l);
double tmp;
if (t <= -9.5e+150) {
tmp = (1.0 / x) + -1.0;
} else if (t <= 1.7e+38) {
tmp = log1p(expm1((t * sqrt((2.0 / (t_1 + fma(2.0, (t * (t / x)), fma(2.0, (t * t), t_1))))))));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
return tmp;
}
function code(x, l, t) t_1 = Float64(l / Float64(x / l)) tmp = 0.0 if (t <= -9.5e+150) tmp = Float64(Float64(1.0 / x) + -1.0); elseif (t <= 1.7e+38) tmp = log1p(expm1(Float64(t * sqrt(Float64(2.0 / Float64(t_1 + fma(2.0, Float64(t * Float64(t / x)), fma(2.0, Float64(t * t), t_1)))))))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); end return tmp end
code[x_, l_, t_] := Block[{t$95$1 = N[(l / N[(x / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9.5e+150], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[t, 1.7e+38], N[Log[1 + N[(Exp[N[(t * N[Sqrt[N[(2.0 / N[(t$95$1 + N[(2.0 * N[(t * N[(t / x), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\ell}{\frac{x}{\ell}}\\
\mathbf{if}\;t \leq -9.5 \cdot 10^{+150}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(t \cdot \sqrt{\frac{2}{t_1 + \mathsf{fma}\left(2, t \cdot \frac{t}{x}, \mathsf{fma}\left(2, t \cdot t, t_1\right)\right)}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < -9.5000000000000001e150Initial program 8.6%
associate-*l/8.6%
Simplified8.6%
Taylor expanded in t around inf 3.1%
+-commutative3.1%
associate-*r/9.4%
sub-neg9.4%
metadata-eval9.4%
unpow29.4%
+-commutative9.4%
Simplified9.4%
Taylor expanded in t around 0 1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt96.0%
Simplified96.0%
if -9.5000000000000001e150 < t < 1.69999999999999998e38Initial program 46.0%
associate-*l/46.1%
Simplified46.1%
Taylor expanded in x around inf 80.0%
sub-neg80.0%
fma-def80.0%
unpow280.0%
fma-def80.0%
unpow280.0%
unpow280.0%
mul-1-neg80.0%
remove-double-neg80.0%
fma-def80.0%
unpow280.0%
unpow280.0%
Simplified80.0%
Taylor expanded in t around 0 79.2%
unpow279.2%
Simplified79.2%
sqrt-undiv79.3%
+-commutative79.3%
associate-/l*79.3%
Applied egg-rr79.3%
log1p-expm1-u79.4%
*-commutative79.4%
associate-/l*79.4%
associate-/r/79.4%
associate-/l*86.3%
Applied egg-rr86.3%
if 1.69999999999999998e38 < t Initial program 27.4%
associate-*l/27.4%
Simplified27.4%
Taylor expanded in t around inf 15.1%
+-commutative15.1%
associate-*r/31.7%
sub-neg31.7%
metadata-eval31.7%
unpow231.7%
+-commutative31.7%
Simplified31.7%
Taylor expanded in t around 0 95.6%
Final simplification90.4%
(FPCore (x l t)
:precision binary64
(if (<= t -3.4e+100)
(+ (/ 1.0 x) -1.0)
(if (<= t 1.7e+38)
(*
t
(sqrt
(/ 2.0 (fma (/ l x) l (+ (* 2.0 (* t (+ t (/ t x)))) (* l (/ l x)))))))
(sqrt (/ (+ x -1.0) (+ 1.0 x))))))
double code(double x, double l, double t) {
double tmp;
if (t <= -3.4e+100) {
tmp = (1.0 / x) + -1.0;
} else if (t <= 1.7e+38) {
tmp = t * sqrt((2.0 / fma((l / x), l, ((2.0 * (t * (t + (t / x)))) + (l * (l / x))))));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
return tmp;
}
function code(x, l, t) tmp = 0.0 if (t <= -3.4e+100) tmp = Float64(Float64(1.0 / x) + -1.0); elseif (t <= 1.7e+38) tmp = Float64(t * sqrt(Float64(2.0 / fma(Float64(l / x), l, Float64(Float64(2.0 * Float64(t * Float64(t + Float64(t / x)))) + Float64(l * Float64(l / x))))))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); end return tmp end
code[x_, l_, t_] := If[LessEqual[t, -3.4e+100], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[t, 1.7e+38], N[(t * N[Sqrt[N[(2.0 / N[(N[(l / x), $MachinePrecision] * l + N[(N[(2.0 * N[(t * N[(t + N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(l * N[(l / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+100}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{+38}:\\
\;\;\;\;t \cdot \sqrt{\frac{2}{\mathsf{fma}\left(\frac{\ell}{x}, \ell, 2 \cdot \left(t \cdot \left(t + \frac{t}{x}\right)\right) + \ell \cdot \frac{\ell}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < -3.39999999999999994e100Initial program 27.0%
associate-*l/27.0%
Simplified27.0%
Taylor expanded in t around inf 3.1%
+-commutative3.1%
associate-*r/27.7%
sub-neg27.7%
metadata-eval27.7%
unpow227.7%
+-commutative27.7%
Simplified27.7%
Taylor expanded in t around 0 1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt96.8%
Simplified96.8%
if -3.39999999999999994e100 < t < 1.69999999999999998e38Initial program 41.2%
associate-*l/41.3%
Simplified41.3%
Taylor expanded in x around inf 78.3%
sub-neg78.3%
fma-def78.3%
unpow278.3%
fma-def78.3%
unpow278.3%
unpow278.3%
mul-1-neg78.3%
remove-double-neg78.3%
fma-def78.3%
unpow278.3%
unpow278.3%
Simplified78.3%
Taylor expanded in t around 0 77.4%
unpow277.4%
Simplified77.4%
sqrt-undiv77.4%
+-commutative77.4%
associate-/l*77.4%
Applied egg-rr77.4%
expm1-log1p-u74.4%
expm1-udef57.3%
associate-/l*57.3%
associate-/r/57.3%
associate-/l*57.4%
Applied egg-rr57.4%
expm1-def81.9%
expm1-log1p85.0%
associate-/r/85.0%
fma-def84.9%
fma-udef84.9%
associate-*l/84.9%
unpow284.9%
fma-udef84.9%
unpow284.9%
associate-+r+84.9%
Simplified84.9%
if 1.69999999999999998e38 < t Initial program 27.4%
associate-*l/27.4%
Simplified27.4%
Taylor expanded in t around inf 15.1%
+-commutative15.1%
associate-*r/31.7%
sub-neg31.7%
metadata-eval31.7%
unpow231.7%
+-commutative31.7%
Simplified31.7%
Taylor expanded in t around 0 95.6%
Final simplification90.3%
(FPCore (x l t)
:precision binary64
(if (<= t -5e-189)
(+ (/ 1.0 x) -1.0)
(if (<= t 2.3e-175)
(* t (* (sqrt (/ 1.0 (+ (/ 1.0 x) (/ 1.0 (+ x -1.0))))) (/ (sqrt 2.0) l)))
(sqrt (/ (+ x -1.0) (+ 1.0 x))))))
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-189) {
tmp = (1.0 / x) + -1.0;
} else if (t <= 2.3e-175) {
tmp = t * (sqrt((1.0 / ((1.0 / x) + (1.0 / (x + -1.0))))) * (sqrt(2.0) / l));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
return tmp;
}
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-189)) then
tmp = (1.0d0 / x) + (-1.0d0)
else if (t <= 2.3d-175) then
tmp = t * (sqrt((1.0d0 / ((1.0d0 / x) + (1.0d0 / (x + (-1.0d0)))))) * (sqrt(2.0d0) / l))
else
tmp = sqrt(((x + (-1.0d0)) / (1.0d0 + x)))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-189) {
tmp = (1.0 / x) + -1.0;
} else if (t <= 2.3e-175) {
tmp = t * (Math.sqrt((1.0 / ((1.0 / x) + (1.0 / (x + -1.0))))) * (Math.sqrt(2.0) / l));
} else {
tmp = Math.sqrt(((x + -1.0) / (1.0 + x)));
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5e-189: tmp = (1.0 / x) + -1.0 elif t <= 2.3e-175: tmp = t * (math.sqrt((1.0 / ((1.0 / x) + (1.0 / (x + -1.0))))) * (math.sqrt(2.0) / l)) else: tmp = math.sqrt(((x + -1.0) / (1.0 + x))) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5e-189) tmp = Float64(Float64(1.0 / x) + -1.0); elseif (t <= 2.3e-175) tmp = Float64(t * Float64(sqrt(Float64(1.0 / Float64(Float64(1.0 / x) + Float64(1.0 / Float64(x + -1.0))))) * Float64(sqrt(2.0) / l))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-189) tmp = (1.0 / x) + -1.0; elseif (t <= 2.3e-175) tmp = t * (sqrt((1.0 / ((1.0 / x) + (1.0 / (x + -1.0))))) * (sqrt(2.0) / l)); else tmp = sqrt(((x + -1.0) / (1.0 + x))); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5e-189], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[t, 2.3e-175], N[(t * N[(N[Sqrt[N[(1.0 / N[(N[(1.0 / x), $MachinePrecision] + N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-189}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-175}:\\
\;\;\;\;t \cdot \left(\sqrt{\frac{1}{\frac{1}{x} + \frac{1}{x + -1}}} \cdot \frac{\sqrt{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < -4.9999999999999997e-189Initial program 41.0%
associate-*l/41.0%
Simplified41.0%
Taylor expanded in t around inf 31.3%
+-commutative31.3%
associate-*r/45.1%
sub-neg45.1%
metadata-eval45.1%
unpow245.1%
+-commutative45.1%
Simplified45.1%
Taylor expanded in t around 0 1.6%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt84.4%
Simplified84.4%
if -4.9999999999999997e-189 < t < 2.3e-175Initial program 2.0%
associate-*l/2.0%
Simplified2.0%
Taylor expanded in l around inf 1.8%
*-commutative1.8%
associate--l+25.5%
sub-neg25.5%
metadata-eval25.5%
+-commutative25.5%
sub-neg25.5%
metadata-eval25.5%
+-commutative25.5%
Simplified25.5%
Taylor expanded in x around inf 55.6%
if 2.3e-175 < t Initial program 37.6%
associate-*l/37.7%
Simplified37.7%
Taylor expanded in t around inf 34.5%
+-commutative34.5%
associate-*r/44.1%
sub-neg44.1%
metadata-eval44.1%
unpow244.1%
+-commutative44.1%
Simplified44.1%
Taylor expanded in t around 0 82.8%
Final simplification80.0%
(FPCore (x l t) :precision binary64 (let* ((t_1 (sqrt (/ (+ x -1.0) (+ 1.0 x))))) (if (<= t -5e-310) (- t_1) t_1)))
double code(double x, double l, double t) {
double t_1 = sqrt(((x + -1.0) / (1.0 + x)));
double tmp;
if (t <= -5e-310) {
tmp = -t_1;
} else {
tmp = t_1;
}
return tmp;
}
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)) / (1.0d0 + x)))
if (t <= (-5d-310)) then
tmp = -t_1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(((x + -1.0) / (1.0 + x)));
double tmp;
if (t <= -5e-310) {
tmp = -t_1;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, l, t): t_1 = math.sqrt(((x + -1.0) / (1.0 + x))) tmp = 0 if t <= -5e-310: tmp = -t_1 else: tmp = t_1 return tmp
function code(x, l, t) t_1 = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-t_1); else tmp = t_1; end return tmp end
function tmp_2 = code(x, l, t) t_1 = sqrt(((x + -1.0) / (1.0 + x))); tmp = 0.0; if (t <= -5e-310) tmp = -t_1; else tmp = t_1; end tmp_2 = tmp; end
code[x_, l_, t_] := Block[{t$95$1 = N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -5e-310], (-t$95$1), t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{\frac{x + -1}{1 + x}}\\
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-t_1\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 36.9%
associate-*l/37.0%
Simplified37.0%
Taylor expanded in t around inf 28.3%
+-commutative28.3%
associate-*r/40.6%
sub-neg40.6%
metadata-eval40.6%
unpow240.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in t around -inf 78.3%
mul-1-neg78.3%
sub-neg78.3%
metadata-eval78.3%
Simplified78.3%
if -4.999999999999985e-310 < t Initial program 32.2%
associate-*l/32.2%
Simplified32.2%
Taylor expanded in t around inf 29.6%
+-commutative29.6%
associate-*r/37.7%
sub-neg37.7%
metadata-eval37.7%
unpow237.7%
+-commutative37.7%
Simplified37.7%
Taylor expanded in t around 0 74.5%
Final simplification76.4%
(FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (- (/ 1.0 x) (/ 0.5 (* x x)))) (sqrt (/ (+ x -1.0) (+ 1.0 x)))))
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + ((1.0 / x) - (0.5 / (x * x)));
} else {
tmp = sqrt(((x + -1.0) / (1.0 + x)));
}
return tmp;
}
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) - (0.5d0 / (x * x)))
else
tmp = sqrt(((x + (-1.0d0)) / (1.0d0 + x)))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + ((1.0 / x) - (0.5 / (x * x)));
} else {
tmp = Math.sqrt(((x + -1.0) / (1.0 + x)));
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + ((1.0 / x) - (0.5 / (x * x))) else: tmp = math.sqrt(((x + -1.0) / (1.0 + x))) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x)))); else tmp = sqrt(Float64(Float64(x + -1.0) / Float64(1.0 + x))); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + ((1.0 / x) - (0.5 / (x * x))); else tmp = sqrt(((x + -1.0) / (1.0 + x))); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x + -1.0), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \left(\frac{1}{x} - \frac{0.5}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x + -1}{1 + x}}\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 36.9%
associate-*l/37.0%
Simplified37.0%
Taylor expanded in t around inf 28.3%
+-commutative28.3%
associate-*r/40.6%
sub-neg40.6%
metadata-eval40.6%
unpow240.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in t around -inf 78.3%
mul-1-neg78.3%
sub-neg78.3%
metadata-eval78.3%
Simplified78.3%
Taylor expanded in x around inf 77.9%
associate--l+77.9%
associate-*r/77.9%
metadata-eval77.9%
unpow277.9%
Simplified77.9%
if -4.999999999999985e-310 < t Initial program 32.2%
associate-*l/32.2%
Simplified32.2%
Taylor expanded in t around inf 29.6%
+-commutative29.6%
associate-*r/37.7%
sub-neg37.7%
metadata-eval37.7%
unpow237.7%
+-commutative37.7%
Simplified37.7%
Taylor expanded in t around 0 74.5%
Final simplification76.1%
(FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ (/ 1.0 x) -1.0) (+ (/ (/ 0.5 x) x) (+ 1.0 (/ -1.0 x)))))
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + -1.0;
} else {
tmp = ((0.5 / x) / x) + (1.0 + (-1.0 / x));
}
return tmp;
}
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 / x) + (-1.0d0)
else
tmp = ((0.5d0 / x) / x) + (1.0d0 + ((-1.0d0) / x))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + -1.0;
} else {
tmp = ((0.5 / x) / x) + (1.0 + (-1.0 / x));
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = (1.0 / x) + -1.0 else: tmp = ((0.5 / x) / x) + (1.0 + (-1.0 / x)) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(Float64(1.0 / x) + -1.0); else tmp = Float64(Float64(Float64(0.5 / x) / x) + Float64(1.0 + Float64(-1.0 / x))); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = (1.0 / x) + -1.0; else tmp = ((0.5 / x) / x) + (1.0 + (-1.0 / x)); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision] + N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{x} + \left(1 + \frac{-1}{x}\right)\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 36.9%
associate-*l/37.0%
Simplified37.0%
Taylor expanded in t around inf 28.3%
+-commutative28.3%
associate-*r/40.6%
sub-neg40.6%
metadata-eval40.6%
unpow240.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in t around 0 1.7%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt77.8%
Simplified77.8%
if -4.999999999999985e-310 < t Initial program 32.2%
associate-*l/32.2%
Simplified32.2%
Taylor expanded in t around inf 29.6%
+-commutative29.6%
associate-*r/37.7%
sub-neg37.7%
metadata-eval37.7%
unpow237.7%
+-commutative37.7%
Simplified37.7%
Taylor expanded in x around inf 74.1%
sub-neg74.1%
+-commutative74.1%
associate-+l+74.1%
associate-*r/74.1%
metadata-eval74.1%
unpow274.1%
associate-/r*74.1%
distribute-neg-frac74.1%
metadata-eval74.1%
Simplified74.1%
Final simplification75.9%
(FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ -1.0 (- (/ 1.0 x) (/ 0.5 (* x x)))) (+ (/ (/ 0.5 x) x) (+ 1.0 (/ -1.0 x)))))
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + ((1.0 / x) - (0.5 / (x * x)));
} else {
tmp = ((0.5 / x) / x) + (1.0 + (-1.0 / x));
}
return tmp;
}
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) - (0.5d0 / (x * x)))
else
tmp = ((0.5d0 / x) / x) + (1.0d0 + ((-1.0d0) / x))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = -1.0 + ((1.0 / x) - (0.5 / (x * x)));
} else {
tmp = ((0.5 / x) / x) + (1.0 + (-1.0 / x));
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = -1.0 + ((1.0 / x) - (0.5 / (x * x))) else: tmp = ((0.5 / x) / x) + (1.0 + (-1.0 / x)) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(-1.0 + Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x)))); else tmp = Float64(Float64(Float64(0.5 / x) / x) + Float64(1.0 + Float64(-1.0 / x))); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = -1.0 + ((1.0 / x) - (0.5 / (x * x))); else tmp = ((0.5 / x) / x) + (1.0 + (-1.0 / x)); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(-1.0 + N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision] + N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-1 + \left(\frac{1}{x} - \frac{0.5}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{x} + \left(1 + \frac{-1}{x}\right)\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 36.9%
associate-*l/37.0%
Simplified37.0%
Taylor expanded in t around inf 28.3%
+-commutative28.3%
associate-*r/40.6%
sub-neg40.6%
metadata-eval40.6%
unpow240.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in t around -inf 78.3%
mul-1-neg78.3%
sub-neg78.3%
metadata-eval78.3%
Simplified78.3%
Taylor expanded in x around inf 77.9%
associate--l+77.9%
associate-*r/77.9%
metadata-eval77.9%
unpow277.9%
Simplified77.9%
if -4.999999999999985e-310 < t Initial program 32.2%
associate-*l/32.2%
Simplified32.2%
Taylor expanded in t around inf 29.6%
+-commutative29.6%
associate-*r/37.7%
sub-neg37.7%
metadata-eval37.7%
unpow237.7%
+-commutative37.7%
Simplified37.7%
Taylor expanded in x around inf 74.1%
sub-neg74.1%
+-commutative74.1%
associate-+l+74.1%
associate-*r/74.1%
metadata-eval74.1%
unpow274.1%
associate-/r*74.1%
distribute-neg-frac74.1%
metadata-eval74.1%
Simplified74.1%
Final simplification75.9%
(FPCore (x l t) :precision binary64 (if (<= t -5.5e-309) (* t (/ -1.0 t)) 1.0))
double code(double x, double l, double t) {
double tmp;
if (t <= -5.5e-309) {
tmp = t * (-1.0 / t);
} else {
tmp = 1.0;
}
return tmp;
}
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 <= (-5.5d-309)) then
tmp = t * ((-1.0d0) / t)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5.5e-309) {
tmp = t * (-1.0 / t);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5.5e-309: tmp = t * (-1.0 / t) else: tmp = 1.0 return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5.5e-309) tmp = Float64(t * Float64(-1.0 / t)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5.5e-309) tmp = t * (-1.0 / t); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5.5e-309], N[(t * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-309}:\\
\;\;\;\;t \cdot \frac{-1}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -5.5e-309Initial program 36.9%
associate-*l/37.0%
Simplified37.0%
Taylor expanded in x around inf 40.2%
unpow240.2%
Simplified40.2%
Taylor expanded in t around -inf 77.0%
if -5.5e-309 < t Initial program 32.2%
associate-*l/32.2%
Simplified32.2%
Taylor expanded in t around inf 29.6%
+-commutative29.6%
associate-*r/37.7%
sub-neg37.7%
metadata-eval37.7%
unpow237.7%
+-commutative37.7%
Simplified37.7%
Taylor expanded in x around inf 72.8%
Final simplification74.8%
(FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ (/ 1.0 x) -1.0) 1.0))
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
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 / x) + (-1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = (1.0 / x) + -1.0 else: tmp = 1.0 return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(Float64(1.0 / x) + -1.0); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = (1.0 / x) + -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 36.9%
associate-*l/37.0%
Simplified37.0%
Taylor expanded in t around inf 28.3%
+-commutative28.3%
associate-*r/40.6%
sub-neg40.6%
metadata-eval40.6%
unpow240.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in t around 0 1.7%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt77.8%
Simplified77.8%
if -4.999999999999985e-310 < t Initial program 32.2%
associate-*l/32.2%
Simplified32.2%
Taylor expanded in t around inf 29.6%
+-commutative29.6%
associate-*r/37.7%
sub-neg37.7%
metadata-eval37.7%
unpow237.7%
+-commutative37.7%
Simplified37.7%
Taylor expanded in x around inf 72.8%
Final simplification75.2%
(FPCore (x l t) :precision binary64 (if (<= t -5e-310) (+ (/ 1.0 x) -1.0) (+ 1.0 (/ -1.0 x))))
double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + -1.0;
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
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 / x) + (-1.0d0)
else
tmp = 1.0d0 + ((-1.0d0) / x)
end if
code = tmp
end function
public static double code(double x, double l, double t) {
double tmp;
if (t <= -5e-310) {
tmp = (1.0 / x) + -1.0;
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
def code(x, l, t): tmp = 0 if t <= -5e-310: tmp = (1.0 / x) + -1.0 else: tmp = 1.0 + (-1.0 / x) return tmp
function code(x, l, t) tmp = 0.0 if (t <= -5e-310) tmp = Float64(Float64(1.0 / x) + -1.0); else tmp = Float64(1.0 + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, l, t) tmp = 0.0; if (t <= -5e-310) tmp = (1.0 / x) + -1.0; else tmp = 1.0 + (-1.0 / x); end tmp_2 = tmp; end
code[x_, l_, t_] := If[LessEqual[t, -5e-310], N[(N[(1.0 / x), $MachinePrecision] + -1.0), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{x} + -1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 36.9%
associate-*l/37.0%
Simplified37.0%
Taylor expanded in t around inf 28.3%
+-commutative28.3%
associate-*r/40.6%
sub-neg40.6%
metadata-eval40.6%
unpow240.6%
+-commutative40.6%
Simplified40.6%
Taylor expanded in t around 0 1.7%
Taylor expanded in x around -inf 0.0%
unpow20.0%
rem-square-sqrt77.8%
Simplified77.8%
if -4.999999999999985e-310 < t Initial program 32.2%
associate-*l/32.2%
Simplified32.2%
Taylor expanded in t around inf 29.6%
+-commutative29.6%
associate-*r/37.7%
sub-neg37.7%
metadata-eval37.7%
unpow237.7%
+-commutative37.7%
Simplified37.7%
Taylor expanded in x around inf 73.8%
Final simplification75.8%
(FPCore (x l t) :precision binary64 1.0)
double code(double x, double l, double t) {
return 1.0;
}
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
public static double code(double x, double l, double t) {
return 1.0;
}
def code(x, l, t): return 1.0
function code(x, l, t) return 1.0 end
function tmp = code(x, l, t) tmp = 1.0; end
code[x_, l_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 34.5%
associate-*l/34.5%
Simplified34.5%
Taylor expanded in t around inf 29.0%
+-commutative29.0%
associate-*r/39.1%
sub-neg39.1%
metadata-eval39.1%
unpow239.1%
+-commutative39.1%
Simplified39.1%
Taylor expanded in x around inf 38.1%
Final simplification38.1%
herbie shell --seed 2023287
(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)))))