
(FPCore (x l t) :precision binary64 (/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
double code(double x, double l, double t) {
return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t): return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
function code(x, l, t) return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l)))) end
function tmp = code(x, l, t) tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l))); end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x l t) :precision binary64 (/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
double code(double x, double l, double t) {
return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
public static double code(double x, double l, double t) {
return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
def code(x, l, t): return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
function code(x, l, t) return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l)))) end
function tmp = code(x, l, t) tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l))); end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\end{array}
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -2.15e-224) (/ -1.0 (sqrt (/ (+ x 1.0) (+ -1.0 x)))) (if (<= t 2.7e-167) (/ t (* l (sqrt (/ 1.0 x)))) (+ 1.0 (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -2.15e-224) {
tmp = -1.0 / sqrt(((x + 1.0) / (-1.0 + x)));
} else if (t <= 2.7e-167) {
tmp = t / (l * sqrt((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 <= (-2.15d-224)) then
tmp = (-1.0d0) / sqrt(((x + 1.0d0) / ((-1.0d0) + x)))
else if (t <= 2.7d-167) then
tmp = t / (l * sqrt((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 <= -2.15e-224) {
tmp = -1.0 / Math.sqrt(((x + 1.0) / (-1.0 + x)));
} else if (t <= 2.7e-167) {
tmp = t / (l * Math.sqrt((1.0 / x)));
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -2.15e-224: tmp = -1.0 / math.sqrt(((x + 1.0) / (-1.0 + x))) elif t <= 2.7e-167: tmp = t / (l * math.sqrt((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 <= -2.15e-224) tmp = Float64(-1.0 / sqrt(Float64(Float64(x + 1.0) / Float64(-1.0 + x)))); elseif (t <= 2.7e-167) tmp = Float64(t / Float64(l * sqrt(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 <= -2.15e-224) tmp = -1.0 / sqrt(((x + 1.0) / (-1.0 + x))); elseif (t <= 2.7e-167) tmp = t / (l * sqrt((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, -2.15e-224], N[(-1.0 / N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e-167], N[(t / N[(l * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{-224}:\\
\;\;\;\;\frac{-1}{\sqrt{\frac{x + 1}{-1 + x}}}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -2.15e-224Initial program 37.0%
Simplified37.0%
Taylor expanded in t around -inf 82.5%
mul-1-neg82.5%
*-commutative82.5%
distribute-rgt-neg-in82.5%
+-commutative82.5%
sub-neg82.5%
metadata-eval82.5%
+-commutative82.5%
Simplified82.5%
frac-2neg82.5%
neg-sub082.5%
div-sub82.5%
distribute-rgt-neg-out82.5%
remove-double-neg82.5%
*-commutative82.5%
+-commutative82.5%
add-sqr-sqrt0.0%
sqrt-unprod3.2%
sqr-neg3.2%
sqrt-unprod1.7%
add-sqr-sqrt1.7%
frac-2neg1.7%
*-commutative1.7%
Applied egg-rr82.5%
div082.5%
neg-sub082.5%
associate-/r*82.5%
*-inverses82.5%
distribute-neg-frac82.5%
metadata-eval82.5%
+-commutative82.5%
Simplified82.5%
if -2.15e-224 < t < 2.7000000000000001e-167Initial program 4.1%
Simplified4.1%
Taylor expanded in x around inf 47.5%
Taylor expanded in t around 0 47.1%
cancel-sign-sub-inv47.1%
metadata-eval47.1%
distribute-rgt1-in47.1%
metadata-eval47.1%
Simplified47.1%
Taylor expanded in l around 0 52.9%
if 2.7000000000000001e-167 < t Initial program 37.1%
Simplified37.0%
Taylor expanded in t around inf 88.5%
+-commutative88.5%
sub-neg88.5%
metadata-eval88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in x around inf 88.5%
Final simplification79.5%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -2.55e-222) (+ -1.0 (/ 1.0 x)) (if (<= t 3.1e-167) (/ t (* l (sqrt (/ 1.0 x)))) (+ 1.0 (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -2.55e-222) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 3.1e-167) {
tmp = t / (l * sqrt((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 <= (-2.55d-222)) then
tmp = (-1.0d0) + (1.0d0 / x)
else if (t <= 3.1d-167) then
tmp = t / (l * sqrt((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 <= -2.55e-222) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 3.1e-167) {
tmp = t / (l * Math.sqrt((1.0 / x)));
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -2.55e-222: tmp = -1.0 + (1.0 / x) elif t <= 3.1e-167: tmp = t / (l * math.sqrt((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 <= -2.55e-222) tmp = Float64(-1.0 + Float64(1.0 / x)); elseif (t <= 3.1e-167) tmp = Float64(t / Float64(l * sqrt(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 <= -2.55e-222) tmp = -1.0 + (1.0 / x); elseif (t <= 3.1e-167) tmp = t / (l * sqrt((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, -2.55e-222], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e-167], N[(t / N[(l * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.55 \cdot 10^{-222}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -2.5500000000000001e-222Initial program 37.0%
Simplified37.0%
Taylor expanded in t around -inf 82.5%
mul-1-neg82.5%
*-commutative82.5%
distribute-rgt-neg-in82.5%
+-commutative82.5%
sub-neg82.5%
metadata-eval82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in x around inf 82.2%
if -2.5500000000000001e-222 < t < 3.1e-167Initial program 4.1%
Simplified4.1%
Taylor expanded in x around inf 47.5%
Taylor expanded in t around 0 47.1%
cancel-sign-sub-inv47.1%
metadata-eval47.1%
distribute-rgt1-in47.1%
metadata-eval47.1%
Simplified47.1%
Taylor expanded in l around 0 52.9%
if 3.1e-167 < t Initial program 37.1%
Simplified37.0%
Taylor expanded in t around inf 88.5%
+-commutative88.5%
sub-neg88.5%
metadata-eval88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in x around inf 88.5%
Final simplification79.4%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -8e-224) (- (sqrt (/ (+ -1.0 x) (+ x 1.0)))) (if (<= t 4.4e-167) (/ t (* l (sqrt (/ 1.0 x)))) (+ 1.0 (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -8e-224) {
tmp = -sqrt(((-1.0 + x) / (x + 1.0)));
} else if (t <= 4.4e-167) {
tmp = t / (l * sqrt((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 <= (-8d-224)) then
tmp = -sqrt((((-1.0d0) + x) / (x + 1.0d0)))
else if (t <= 4.4d-167) then
tmp = t / (l * sqrt((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 <= -8e-224) {
tmp = -Math.sqrt(((-1.0 + x) / (x + 1.0)));
} else if (t <= 4.4e-167) {
tmp = t / (l * Math.sqrt((1.0 / x)));
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -8e-224: tmp = -math.sqrt(((-1.0 + x) / (x + 1.0))) elif t <= 4.4e-167: tmp = t / (l * math.sqrt((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 <= -8e-224) tmp = Float64(-sqrt(Float64(Float64(-1.0 + x) / Float64(x + 1.0)))); elseif (t <= 4.4e-167) tmp = Float64(t / Float64(l * sqrt(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 <= -8e-224) tmp = -sqrt(((-1.0 + x) / (x + 1.0))); elseif (t <= 4.4e-167) tmp = t / (l * sqrt((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, -8e-224], (-N[Sqrt[N[(N[(-1.0 + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[t, 4.4e-167], N[(t / N[(l * N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-224}:\\
\;\;\;\;-\sqrt{\frac{-1 + x}{x + 1}}\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\ell \cdot \sqrt{\frac{1}{x}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -8.0000000000000002e-224Initial program 37.0%
Simplified37.0%
Taylor expanded in t around -inf 82.5%
mul-1-neg82.5%
*-commutative82.5%
distribute-rgt-neg-in82.5%
+-commutative82.5%
sub-neg82.5%
metadata-eval82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in t around 0 82.5%
mul-1-neg82.5%
sub-neg82.5%
metadata-eval82.5%
+-commutative82.5%
+-commutative82.5%
Simplified82.5%
if -8.0000000000000002e-224 < t < 4.3999999999999999e-167Initial program 4.1%
Simplified4.1%
Taylor expanded in x around inf 47.5%
Taylor expanded in t around 0 47.1%
cancel-sign-sub-inv47.1%
metadata-eval47.1%
distribute-rgt1-in47.1%
metadata-eval47.1%
Simplified47.1%
Taylor expanded in l around 0 52.9%
if 4.3999999999999999e-167 < t Initial program 37.1%
Simplified37.0%
Taylor expanded in t around inf 88.5%
+-commutative88.5%
sub-neg88.5%
metadata-eval88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in x around inf 88.5%
Final simplification79.5%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -2.4e-246) (+ -1.0 (/ 1.0 x)) (if (<= t 2.6e-167) (* (/ t l) (sqrt x)) (+ 1.0 (/ -1.0 x)))))
l = abs(l);
double code(double x, double l, double t) {
double tmp;
if (t <= -2.4e-246) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 2.6e-167) {
tmp = (t / l) * sqrt(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 <= (-2.4d-246)) then
tmp = (-1.0d0) + (1.0d0 / x)
else if (t <= 2.6d-167) then
tmp = (t / l) * sqrt(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 <= -2.4e-246) {
tmp = -1.0 + (1.0 / x);
} else if (t <= 2.6e-167) {
tmp = (t / l) * Math.sqrt(x);
} else {
tmp = 1.0 + (-1.0 / x);
}
return tmp;
}
l = abs(l) def code(x, l, t): tmp = 0 if t <= -2.4e-246: tmp = -1.0 + (1.0 / x) elif t <= 2.6e-167: tmp = (t / l) * math.sqrt(x) else: tmp = 1.0 + (-1.0 / x) return tmp
l = abs(l) function code(x, l, t) tmp = 0.0 if (t <= -2.4e-246) tmp = Float64(-1.0 + Float64(1.0 / x)); elseif (t <= 2.6e-167) tmp = Float64(Float64(t / l) * sqrt(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 <= -2.4e-246) tmp = -1.0 + (1.0 / x); elseif (t <= 2.6e-167) tmp = (t / l) * sqrt(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, -2.4e-246], N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.6e-167], N[(N[(t / l), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{-246}:\\
\;\;\;\;-1 + \frac{1}{x}\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-167}:\\
\;\;\;\;\frac{t}{\ell} \cdot \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -2.3999999999999998e-246Initial program 34.4%
Simplified34.4%
Taylor expanded in t around -inf 78.9%
mul-1-neg78.9%
*-commutative78.9%
distribute-rgt-neg-in78.9%
+-commutative78.9%
sub-neg78.9%
metadata-eval78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in x around inf 78.5%
if -2.3999999999999998e-246 < t < 2.5999999999999999e-167Initial program 4.6%
Simplified4.6%
Taylor expanded in x around inf 46.5%
Taylor expanded in t around 0 46.1%
cancel-sign-sub-inv46.1%
metadata-eval46.1%
distribute-rgt1-in46.1%
metadata-eval46.1%
Simplified46.1%
Taylor expanded in t around 0 55.0%
if 2.5999999999999999e-167 < t Initial program 37.1%
Simplified37.0%
Taylor expanded in t around inf 88.5%
+-commutative88.5%
sub-neg88.5%
metadata-eval88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in x around inf 88.5%
Final simplification78.9%
NOTE: l should be positive before calling this function (FPCore (x l t) :precision binary64 (if (<= t -5e-310) -1.0 (+ 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;
} 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
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;
} 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 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 = -1.0; 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; 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], -1.0, 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\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{-1}{x}\\
\end{array}
\end{array}
if t < -4.999999999999985e-310Initial program 32.8%
Simplified32.8%
Taylor expanded in t around -inf 75.9%
mul-1-neg75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
+-commutative75.9%
sub-neg75.9%
metadata-eval75.9%
+-commutative75.9%
Simplified75.9%
Taylor expanded in x around inf 75.0%
if -4.999999999999985e-310 < t Initial program 29.7%
Simplified29.6%
Taylor expanded in t around inf 75.6%
+-commutative75.6%
sub-neg75.6%
metadata-eval75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in x around inf 75.6%
Final simplification75.3%
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 32.8%
Simplified32.8%
Taylor expanded in t around -inf 75.9%
mul-1-neg75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
+-commutative75.9%
sub-neg75.9%
metadata-eval75.9%
+-commutative75.9%
Simplified75.9%
Taylor expanded in x around inf 75.6%
if -4.999999999999985e-310 < t Initial program 29.7%
Simplified29.6%
Taylor expanded in t around inf 75.6%
+-commutative75.6%
sub-neg75.6%
metadata-eval75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in x around inf 75.6%
Final simplification75.6%
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 32.8%
Simplified32.8%
Taylor expanded in t around -inf 75.9%
mul-1-neg75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
+-commutative75.9%
sub-neg75.9%
metadata-eval75.9%
+-commutative75.9%
Simplified75.9%
Taylor expanded in x around inf 75.0%
if -4.999999999999985e-310 < t Initial program 29.7%
Simplified29.6%
Taylor expanded in t around inf 75.6%
+-commutative75.6%
sub-neg75.6%
metadata-eval75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in x around inf 75.3%
Final simplification75.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 31.4%
Simplified31.4%
Taylor expanded in t around -inf 42.0%
mul-1-neg42.0%
*-commutative42.0%
distribute-rgt-neg-in42.0%
+-commutative42.0%
sub-neg42.0%
metadata-eval42.0%
+-commutative42.0%
Simplified42.0%
Taylor expanded in x around inf 41.5%
Final simplification41.5%
herbie shell --seed 2023309
(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)))))