
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 (- INFINITY))
(/ (+ x (/ y t)) (+ x 1.0))
(if (<= t_1 5e+216)
t_1
(-
(+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
(/ x (* t (* z (+ x 1.0)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (t_1 <= 5e+216) {
tmp = t_1;
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0))));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (t_1 <= 5e+216) {
tmp = t_1;
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= -math.inf: tmp = (x + (y / t)) / (x + 1.0) elif t_1 <= 5e+216: tmp = t_1 else: tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0)))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); elseif (t_1 <= 5e+216) tmp = t_1; else tmp = Float64(Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(t * Float64(x + 1.0)))) - Float64(x / Float64(t * Float64(z * Float64(x + 1.0))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= -Inf) tmp = (x + (y / t)) / (x + 1.0); elseif (t_1 <= 5e+216) tmp = t_1; else tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (t * (z * (x + 1.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+216], t$95$1, N[(N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(t * N[(z * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+216}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{t \cdot \left(z \cdot \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -inf.0Initial program 31.2%
sub-neg31.2%
+-commutative31.2%
neg-sub031.2%
associate-+l-31.2%
div-sub31.2%
div031.2%
associate-+r-31.2%
+-commutative31.2%
+-lft-identity31.2%
*-commutative31.2%
Simplified31.2%
Taylor expanded in z around inf 72.1%
+-commutative72.1%
+-commutative72.1%
Simplified72.1%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 4.9999999999999998e216Initial program 99.0%
if 4.9999999999999998e216 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 27.0%
sub-neg27.0%
+-commutative27.0%
neg-sub027.0%
associate-+l-27.0%
div-sub27.0%
div027.0%
associate-+r-27.0%
+-commutative27.0%
+-lft-identity27.0%
*-commutative27.0%
Simplified27.0%
Taylor expanded in t around inf 96.0%
Final simplification97.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 (- INFINITY))
(/ (+ x (/ y t)) (+ x 1.0))
(if (<= t_1 5e+216) t_1 (/ (+ x (/ -1.0 (/ (- t) y))) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (t_1 <= 5e+216) {
tmp = t_1;
} else {
tmp = (x + (-1.0 / (-t / y))) / (x + 1.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (t_1 <= 5e+216) {
tmp = t_1;
} else {
tmp = (x + (-1.0 / (-t / y))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= -math.inf: tmp = (x + (y / t)) / (x + 1.0) elif t_1 <= 5e+216: tmp = t_1 else: tmp = (x + (-1.0 / (-t / y))) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); elseif (t_1 <= 5e+216) tmp = t_1; else tmp = Float64(Float64(x + Float64(-1.0 / Float64(Float64(-t) / y))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= -Inf) tmp = (x + (y / t)) / (x + 1.0); elseif (t_1 <= 5e+216) tmp = t_1; else tmp = (x + (-1.0 / (-t / y))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+216], t$95$1, N[(N[(x + N[(-1.0 / N[((-t) / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+216}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{-1}{\frac{-t}{y}}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -inf.0Initial program 31.2%
sub-neg31.2%
+-commutative31.2%
neg-sub031.2%
associate-+l-31.2%
div-sub31.2%
div031.2%
associate-+r-31.2%
+-commutative31.2%
+-lft-identity31.2%
*-commutative31.2%
Simplified31.2%
Taylor expanded in z around inf 72.1%
+-commutative72.1%
+-commutative72.1%
Simplified72.1%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 4.9999999999999998e216Initial program 99.0%
if 4.9999999999999998e216 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 27.0%
sub-neg27.0%
+-commutative27.0%
neg-sub027.0%
associate-+l-27.0%
div-sub27.0%
div027.0%
associate-+r-27.0%
+-commutative27.0%
+-lft-identity27.0%
*-commutative27.0%
Simplified27.0%
clear-num27.1%
inv-pow27.1%
Applied egg-rr27.1%
unpow-127.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in z around inf 95.9%
mul-1-neg95.9%
Simplified95.9%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.6e-154) (not (<= t 2.1e-56))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ 1.0 (- x (/ y (/ x z)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.6e-154) || !(t <= 2.1e-56)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-5.6d-154)) .or. (.not. (t <= 2.1d-56))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (1.0d0 + (x - (y / (x / z)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.6e-154) || !(t <= 2.1e-56)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.6e-154) or not (t <= 2.1e-56): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.6e-154) || !(t <= 2.1e-56)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.6e-154) || ~((t <= 2.1e-56))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.6e-154], N[Not[LessEqual[t, 2.1e-56]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{-154} \lor \neg \left(t \leq 2.1 \cdot 10^{-56}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -5.60000000000000025e-154 or 2.10000000000000006e-56 < t Initial program 85.2%
sub-neg85.2%
+-commutative85.2%
neg-sub085.2%
associate-+l-85.2%
div-sub85.2%
div085.2%
associate-+r-85.2%
+-commutative85.2%
+-lft-identity85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in z around inf 86.5%
+-commutative86.5%
+-commutative86.5%
Simplified86.5%
if -5.60000000000000025e-154 < t < 2.10000000000000006e-56Initial program 94.5%
sub-neg94.5%
+-commutative94.5%
neg-sub094.5%
associate-+l-94.5%
div-sub94.5%
div094.5%
associate-+r-94.5%
+-commutative94.5%
+-lft-identity94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in t around 0 84.5%
mul-1-neg84.5%
associate-/l*88.7%
+-commutative88.7%
Simplified88.7%
Final simplification87.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.7e-97)
(+ (/ (/ y t) (+ x 1.0)) (/ x (+ x 1.0)))
(if (<= z 6.6e-56)
(/ (- x (/ x (- (* z t) x))) (+ x 1.0))
(/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.7e-97) {
tmp = ((y / t) / (x + 1.0)) + (x / (x + 1.0));
} else if (z <= 6.6e-56) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3.7d-97)) then
tmp = ((y / t) / (x + 1.0d0)) + (x / (x + 1.0d0))
else if (z <= 6.6d-56) then
tmp = (x - (x / ((z * t) - x))) / (x + 1.0d0)
else
tmp = (x + (y / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.7e-97) {
tmp = ((y / t) / (x + 1.0)) + (x / (x + 1.0));
} else if (z <= 6.6e-56) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.7e-97: tmp = ((y / t) / (x + 1.0)) + (x / (x + 1.0)) elif z <= 6.6e-56: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.7e-97) tmp = Float64(Float64(Float64(y / t) / Float64(x + 1.0)) + Float64(x / Float64(x + 1.0))); elseif (z <= 6.6e-56) tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.7e-97) tmp = ((y / t) / (x + 1.0)) + (x / (x + 1.0)); elseif (z <= 6.6e-56) tmp = (x - (x / ((z * t) - x))) / (x + 1.0); else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.7e-97], N[(N[(N[(y / t), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e-56], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{y}{t}}{x + 1} + \frac{x}{x + 1}\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-56}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if z < -3.69999999999999976e-97Initial program 85.4%
sub-neg85.4%
+-commutative85.4%
neg-sub085.4%
associate-+l-85.4%
div-sub85.4%
div085.4%
associate-+r-85.4%
+-commutative85.4%
+-lft-identity85.4%
*-commutative85.4%
Simplified85.4%
div-sub85.4%
associate-/l/85.4%
Applied egg-rr85.4%
Taylor expanded in z around inf 88.3%
+-commutative88.3%
+-commutative88.3%
associate-/r*88.3%
+-commutative88.3%
Simplified88.3%
if -3.69999999999999976e-97 < z < 6.59999999999999967e-56Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
div-sub99.9%
div099.9%
associate-+r-99.9%
+-commutative99.9%
+-lft-identity99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 85.2%
if 6.59999999999999967e-56 < z Initial program 77.3%
sub-neg77.3%
+-commutative77.3%
neg-sub077.3%
associate-+l-77.3%
div-sub77.3%
div077.3%
associate-+r-77.3%
+-commutative77.3%
+-lft-identity77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in z around inf 83.7%
+-commutative83.7%
+-commutative83.7%
Simplified83.7%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.1e-97) (+ (/ (/ y t) (+ x 1.0)) (/ x (+ x 1.0))) (if (<= z 2.65e-188) 1.0 (/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e-97) {
tmp = ((y / t) / (x + 1.0)) + (x / (x + 1.0));
} else if (z <= 2.65e-188) {
tmp = 1.0;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.1d-97)) then
tmp = ((y / t) / (x + 1.0d0)) + (x / (x + 1.0d0))
else if (z <= 2.65d-188) then
tmp = 1.0d0
else
tmp = (x + (y / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e-97) {
tmp = ((y / t) / (x + 1.0)) + (x / (x + 1.0));
} else if (z <= 2.65e-188) {
tmp = 1.0;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.1e-97: tmp = ((y / t) / (x + 1.0)) + (x / (x + 1.0)) elif z <= 2.65e-188: tmp = 1.0 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.1e-97) tmp = Float64(Float64(Float64(y / t) / Float64(x + 1.0)) + Float64(x / Float64(x + 1.0))); elseif (z <= 2.65e-188) tmp = 1.0; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.1e-97) tmp = ((y / t) / (x + 1.0)) + (x / (x + 1.0)); elseif (z <= 2.65e-188) tmp = 1.0; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.1e-97], N[(N[(N[(y / t), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.65e-188], 1.0, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{y}{t}}{x + 1} + \frac{x}{x + 1}\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-188}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if z < -1.0999999999999999e-97Initial program 85.4%
sub-neg85.4%
+-commutative85.4%
neg-sub085.4%
associate-+l-85.4%
div-sub85.4%
div085.4%
associate-+r-85.4%
+-commutative85.4%
+-lft-identity85.4%
*-commutative85.4%
Simplified85.4%
div-sub85.4%
associate-/l/85.4%
Applied egg-rr85.4%
Taylor expanded in z around inf 88.3%
+-commutative88.3%
+-commutative88.3%
associate-/r*88.3%
+-commutative88.3%
Simplified88.3%
if -1.0999999999999999e-97 < z < 2.65000000000000007e-188Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
div-sub99.9%
div099.9%
associate-+r-99.9%
+-commutative99.9%
+-lft-identity99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 84.2%
if 2.65000000000000007e-188 < z Initial program 83.0%
sub-neg83.0%
+-commutative83.0%
neg-sub083.0%
associate-+l-83.0%
div-sub83.0%
div083.0%
associate-+r-83.0%
+-commutative83.0%
+-lft-identity83.0%
*-commutative83.0%
Simplified83.0%
Taylor expanded in z around inf 77.8%
+-commutative77.8%
+-commutative77.8%
Simplified77.8%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.7e-98) (not (<= z 2.65e-188))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e-98) || !(z <= 2.65e-188)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.7d-98)) .or. (.not. (z <= 2.65d-188))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e-98) || !(z <= 2.65e-188)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.7e-98) or not (z <= 2.65e-188): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.7e-98) || !(z <= 2.65e-188)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.7e-98) || ~((z <= 2.65e-188))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.7e-98], N[Not[LessEqual[z, 2.65e-188]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-98} \lor \neg \left(z \leq 2.65 \cdot 10^{-188}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -1.7000000000000001e-98 or 2.65000000000000007e-188 < z Initial program 84.0%
sub-neg84.0%
+-commutative84.0%
neg-sub084.0%
associate-+l-84.0%
div-sub84.0%
div084.0%
associate-+r-84.0%
+-commutative84.0%
+-lft-identity84.0%
*-commutative84.0%
Simplified84.0%
Taylor expanded in z around inf 82.0%
+-commutative82.0%
+-commutative82.0%
Simplified82.0%
if -1.7000000000000001e-98 < z < 2.65000000000000007e-188Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
div-sub99.9%
div099.9%
associate-+r-99.9%
+-commutative99.9%
+-lft-identity99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 84.2%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (if (<= x -3.9e-70) 1.0 (if (<= x 1.1e-111) (/ y (* t (+ x 1.0))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-70) {
tmp = 1.0;
} else if (x <= 1.1e-111) {
tmp = y / (t * (x + 1.0));
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.9d-70)) then
tmp = 1.0d0
else if (x <= 1.1d-111) then
tmp = y / (t * (x + 1.0d0))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-70) {
tmp = 1.0;
} else if (x <= 1.1e-111) {
tmp = y / (t * (x + 1.0));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.9e-70: tmp = 1.0 elif x <= 1.1e-111: tmp = y / (t * (x + 1.0)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.9e-70) tmp = 1.0; elseif (x <= 1.1e-111) tmp = Float64(y / Float64(t * Float64(x + 1.0))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.9e-70) tmp = 1.0; elseif (x <= 1.1e-111) tmp = y / (t * (x + 1.0)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.9e-70], 1.0, If[LessEqual[x, 1.1e-111], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-70}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-111}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.90000000000000019e-70 or 1.1e-111 < x Initial program 88.0%
sub-neg88.0%
+-commutative88.0%
neg-sub088.0%
associate-+l-88.0%
div-sub88.0%
div088.0%
associate-+r-88.0%
+-commutative88.0%
+-lft-identity88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in x around inf 79.0%
if -3.90000000000000019e-70 < x < 1.1e-111Initial program 89.4%
sub-neg89.4%
+-commutative89.4%
neg-sub089.4%
associate-+l-89.4%
div-sub89.4%
div089.4%
associate-+r-89.4%
+-commutative89.4%
+-lft-identity89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in y around inf 51.1%
Taylor expanded in z around inf 54.2%
+-commutative54.2%
Simplified54.2%
Final simplification70.1%
(FPCore (x y z t) :precision binary64 (if (<= x -3.9e-70) 1.0 (if (<= x 1e-111) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-70) {
tmp = 1.0;
} else if (x <= 1e-111) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.9d-70)) then
tmp = 1.0d0
else if (x <= 1d-111) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-70) {
tmp = 1.0;
} else if (x <= 1e-111) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.9e-70: tmp = 1.0 elif x <= 1e-111: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.9e-70) tmp = 1.0; elseif (x <= 1e-111) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.9e-70) tmp = 1.0; elseif (x <= 1e-111) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.9e-70], 1.0, If[LessEqual[x, 1e-111], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-70}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 10^{-111}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.90000000000000019e-70 or 1.00000000000000009e-111 < x Initial program 88.0%
sub-neg88.0%
+-commutative88.0%
neg-sub088.0%
associate-+l-88.0%
div-sub88.0%
div088.0%
associate-+r-88.0%
+-commutative88.0%
+-lft-identity88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in x around inf 79.0%
if -3.90000000000000019e-70 < x < 1.00000000000000009e-111Initial program 89.4%
sub-neg89.4%
+-commutative89.4%
neg-sub089.4%
associate-+l-89.4%
div-sub89.4%
div089.4%
associate-+r-89.4%
+-commutative89.4%
+-lft-identity89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in x around 0 54.2%
Final simplification70.1%
(FPCore (x y z t) :precision binary64 (if (<= x -3.35e-79) 1.0 (if (<= x 2.45e-107) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.35e-79) {
tmp = 1.0;
} else if (x <= 2.45e-107) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.35d-79)) then
tmp = 1.0d0
else if (x <= 2.45d-107) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.35e-79) {
tmp = 1.0;
} else if (x <= 2.45e-107) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.35e-79: tmp = 1.0 elif x <= 2.45e-107: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.35e-79) tmp = 1.0; elseif (x <= 2.45e-107) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.35e-79) tmp = 1.0; elseif (x <= 2.45e-107) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.35e-79], 1.0, If[LessEqual[x, 2.45e-107], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.35 \cdot 10^{-79}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.45 \cdot 10^{-107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.35000000000000009e-79 or 2.4499999999999999e-107 < x Initial program 88.1%
sub-neg88.1%
+-commutative88.1%
neg-sub088.1%
associate-+l-88.1%
div-sub88.1%
div088.1%
associate-+r-88.1%
+-commutative88.1%
+-lft-identity88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in x around inf 78.5%
if -3.35000000000000009e-79 < x < 2.4499999999999999e-107Initial program 89.2%
sub-neg89.2%
+-commutative89.2%
neg-sub089.2%
associate-+l-89.2%
div-sub89.2%
div089.2%
associate-+r-89.2%
+-commutative89.2%
+-lft-identity89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in t around inf 24.3%
+-commutative24.3%
Simplified24.3%
Taylor expanded in x around 0 24.3%
Final simplification59.5%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 88.5%
sub-neg88.5%
+-commutative88.5%
neg-sub088.5%
associate-+l-88.5%
div-sub88.5%
div088.5%
associate-+r-88.5%
+-commutative88.5%
+-lft-identity88.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in x around inf 55.9%
Final simplification55.9%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2023336
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))