
(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 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* z y) x) t_1)) (+ x 1.0))))
(if (<= t_2 -5e+68)
(/ (- x (- -1.0 (/ y (/ t_1 z)))) (+ x 1.0))
(if (<= t_2 1e+302) t_2 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((z * y) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+68) {
tmp = (x - (-1.0 - (y / (t_1 / z)))) / (x + 1.0);
} else if (t_2 <= 1e+302) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x + (((z * y) - x) / t_1)) / (x + 1.0d0)
if (t_2 <= (-5d+68)) then
tmp = (x - ((-1.0d0) - (y / (t_1 / z)))) / (x + 1.0d0)
else if (t_2 <= 1d+302) then
tmp = t_2
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 t_1 = (z * t) - x;
double t_2 = (x + (((z * y) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+68) {
tmp = (x - (-1.0 - (y / (t_1 / z)))) / (x + 1.0);
} else if (t_2 <= 1e+302) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x + (((z * y) - x) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -5e+68: tmp = (x - (-1.0 - (y / (t_1 / z)))) / (x + 1.0) elif t_2 <= 1e+302: tmp = t_2 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x + Float64(Float64(Float64(z * y) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -5e+68) tmp = Float64(Float64(x - Float64(-1.0 - Float64(y / Float64(t_1 / z)))) / Float64(x + 1.0)); elseif (t_2 <= 1e+302) tmp = t_2; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x + (((z * y) - x) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -5e+68) tmp = (x - (-1.0 - (y / (t_1 / z)))) / (x + 1.0); elseif (t_2 <= 1e+302) tmp = t_2; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+68], N[(N[(x - N[(-1.0 - N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+302], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + \frac{z \cdot y - x}{t_1}}{x + 1}\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{+68}:\\
\;\;\;\;\frac{x - \left(-1 - \frac{y}{\frac{t_1}{z}}\right)}{x + 1}\\
\mathbf{elif}\;t_2 \leq 10^{+302}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -5.0000000000000004e68Initial program 82.4%
sub-neg82.4%
+-commutative82.4%
neg-sub082.4%
associate-+l-82.4%
div-sub82.4%
div082.4%
associate-+r-82.4%
+-commutative82.4%
+-lft-identity82.4%
*-commutative82.4%
Simplified82.4%
div-sub82.4%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 99.9%
if -5.0000000000000004e68 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.0000000000000001e302Initial program 99.4%
if 1.0000000000000001e302 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 22.4%
sub-neg22.4%
+-commutative22.4%
neg-sub022.4%
associate-+l-22.4%
div-sub22.4%
div022.4%
associate-+r-22.4%
+-commutative22.4%
+-lft-identity22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in z around inf 86.9%
+-commutative86.9%
+-commutative86.9%
Simplified86.9%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* z y) x) (- (* z t) x))) (+ x 1.0))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+302)))
(/ (+ x (/ y t)) (+ x 1.0))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+302)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+302)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+302): tmp = (x + (y / t)) / (x + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(z * y) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+302)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 1e+302))) tmp = (x + (y / t)) / (x + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+302]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 10^{+302}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -inf.0 or 1.0000000000000001e302 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 31.0%
sub-neg31.0%
+-commutative31.0%
neg-sub031.0%
associate-+l-31.0%
div-sub31.0%
div031.0%
associate-+r-31.0%
+-commutative31.0%
+-lft-identity31.0%
*-commutative31.0%
Simplified31.0%
Taylor expanded in z around inf 89.8%
+-commutative89.8%
+-commutative89.8%
Simplified89.8%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.0000000000000001e302Initial program 99.4%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* z t) x))) (/ (+ x (- (/ y (/ t_1 z)) (/ x t_1))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
return (x + ((y / (t_1 / z)) - (x / t_1))) / (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
real(8) :: t_1
t_1 = (z * t) - x
code = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
return (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0);
}
def code(x, y, z, t): t_1 = (z * t) - x return (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0)
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) return Float64(Float64(x + Float64(Float64(y / Float64(t_1 / z)) - Float64(x / t_1))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) t_1 = (z * t) - x; tmp = (x + ((y / (t_1 / z)) - (x / t_1))) / (x + 1.0); end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, N[(N[(x + N[(N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] - N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
\frac{x + \left(\frac{y}{\frac{t_1}{z}} - \frac{x}{t_1}\right)}{x + 1}
\end{array}
\end{array}
Initial program 90.3%
sub-neg90.3%
+-commutative90.3%
neg-sub090.3%
associate-+l-90.3%
div-sub90.3%
div090.3%
associate-+r-90.3%
+-commutative90.3%
+-lft-identity90.3%
*-commutative90.3%
Simplified90.3%
div-sub90.3%
associate-/l*97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.3e-24) (not (<= t 2.05e-57))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (/ (/ y (/ (+ x 1.0) z)) (- (* z t) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.3e-24) || !(t <= 2.05e-57)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y / ((x + 1.0) / z)) / ((z * t) - x));
}
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 <= (-3.3d-24)) .or. (.not. (t <= 2.05d-57))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((y / ((x + 1.0d0) / z)) / ((z * t) - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.3e-24) || !(t <= 2.05e-57)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y / ((x + 1.0) / z)) / ((z * t) - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.3e-24) or not (t <= 2.05e-57): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((y / ((x + 1.0) / z)) / ((z * t) - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.3e-24) || !(t <= 2.05e-57)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(y / Float64(Float64(x + 1.0) / z)) / Float64(Float64(z * t) - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.3e-24) || ~((t <= 2.05e-57))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((y / ((x + 1.0) / z)) / ((z * t) - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.3e-24], N[Not[LessEqual[t, 2.05e-57]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y / N[(N[(x + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{-24} \lor \neg \left(t \leq 2.05 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{y}{\frac{x + 1}{z}}}{z \cdot t - x}\\
\end{array}
\end{array}
if t < -3.29999999999999984e-24 or 2.0500000000000001e-57 < t Initial program 86.8%
sub-neg86.8%
+-commutative86.8%
neg-sub086.8%
associate-+l-86.8%
div-sub86.8%
div086.8%
associate-+r-86.8%
+-commutative86.8%
+-lft-identity86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in z around inf 88.3%
+-commutative88.3%
+-commutative88.3%
Simplified88.3%
if -3.29999999999999984e-24 < t < 2.0500000000000001e-57Initial program 94.3%
sub-neg94.3%
+-commutative94.3%
neg-sub094.3%
associate-+l-94.3%
div-sub94.3%
div094.3%
associate-+r-94.3%
+-commutative94.3%
+-lft-identity94.3%
*-commutative94.3%
Simplified94.3%
div-sub94.3%
associate-/l*99.1%
Applied egg-rr99.1%
Taylor expanded in x around inf 88.4%
Taylor expanded in y around 0 83.5%
+-commutative83.5%
associate-/r*83.6%
associate-/l*88.4%
+-commutative88.4%
Simplified88.4%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.85e-69) (not (<= z 5.5e-11))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (/ (* z y) (- (* z t) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.85e-69) || !(z <= 5.5e-11)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((z * y) / ((z * t) - x));
}
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.85d-69)) .or. (.not. (z <= 5.5d-11))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((z * y) / ((z * t) - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.85e-69) || !(z <= 5.5e-11)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((z * y) / ((z * t) - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.85e-69) or not (z <= 5.5e-11): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((z * y) / ((z * t) - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.85e-69) || !(z <= 5.5e-11)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(z * y) / Float64(Float64(z * t) - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.85e-69) || ~((z <= 5.5e-11))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((z * y) / ((z * t) - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.85e-69], N[Not[LessEqual[z, 5.5e-11]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(z * y), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{-69} \lor \neg \left(z \leq 5.5 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{z \cdot y}{z \cdot t - x}\\
\end{array}
\end{array}
if z < -1.8500000000000001e-69 or 5.49999999999999975e-11 < z Initial program 84.1%
sub-neg84.1%
+-commutative84.1%
neg-sub084.1%
associate-+l-84.1%
div-sub84.1%
div084.1%
associate-+r-84.1%
+-commutative84.1%
+-lft-identity84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in z around inf 86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
if -1.8500000000000001e-69 < z < 5.49999999999999975e-11Initial 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%
div-sub99.9%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 83.6%
Taylor expanded in y around 0 83.6%
+-commutative83.6%
associate-/r*83.6%
associate-/l*83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in x around 0 81.8%
Final simplification84.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.85e-97) (not (<= z 7.6e-133))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.85e-97) || !(z <= 7.6e-133)) {
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.85d-97)) .or. (.not. (z <= 7.6d-133))) 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.85e-97) || !(z <= 7.6e-133)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.85e-97) or not (z <= 7.6e-133): 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.85e-97) || !(z <= 7.6e-133)) 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.85e-97) || ~((z <= 7.6e-133))) 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.85e-97], N[Not[LessEqual[z, 7.6e-133]], $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.85 \cdot 10^{-97} \lor \neg \left(z \leq 7.6 \cdot 10^{-133}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -1.84999999999999988e-97 or 7.6000000000000006e-133 < z Initial program 86.9%
sub-neg86.9%
+-commutative86.9%
neg-sub086.9%
associate-+l-86.9%
div-sub86.9%
div086.9%
associate-+r-86.9%
+-commutative86.9%
+-lft-identity86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in z around inf 82.6%
+-commutative82.6%
+-commutative82.6%
Simplified82.6%
if -1.84999999999999988e-97 < z < 7.6000000000000006e-133Initial 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 65.8%
Final simplification78.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8.6e-125) (not (<= x 3.3e-162))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.6e-125) || !(x <= 3.3e-162)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
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 <= (-8.6d-125)) .or. (.not. (x <= 3.3d-162))) then
tmp = x / (x + 1.0d0)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.6e-125) || !(x <= 3.3e-162)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8.6e-125) or not (x <= 3.3e-162): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -8.6e-125) || !(x <= 3.3e-162)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -8.6e-125) || ~((x <= 3.3e-162))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -8.6e-125], N[Not[LessEqual[x, 3.3e-162]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{-125} \lor \neg \left(x \leq 3.3 \cdot 10^{-162}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -8.6000000000000004e-125 or 3.30000000000000013e-162 < x Initial program 88.2%
sub-neg88.2%
+-commutative88.2%
neg-sub088.2%
associate-+l-88.2%
div-sub88.2%
div088.2%
associate-+r-88.2%
+-commutative88.2%
+-lft-identity88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in t around inf 74.2%
+-commutative74.2%
Simplified74.2%
if -8.6000000000000004e-125 < x < 3.30000000000000013e-162Initial program 95.7%
sub-neg95.7%
+-commutative95.7%
neg-sub095.7%
associate-+l-95.7%
div-sub95.7%
div095.7%
associate-+r-95.7%
+-commutative95.7%
+-lft-identity95.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in x around 0 54.8%
Final simplification68.7%
(FPCore (x y z t) :precision binary64 (if (<= x -1.36e-38) 1.0 (if (<= x 1.5e-54) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.36e-38) {
tmp = 1.0;
} else if (x <= 1.5e-54) {
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 <= (-1.36d-38)) then
tmp = 1.0d0
else if (x <= 1.5d-54) 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 <= -1.36e-38) {
tmp = 1.0;
} else if (x <= 1.5e-54) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.36e-38: tmp = 1.0 elif x <= 1.5e-54: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.36e-38) tmp = 1.0; elseif (x <= 1.5e-54) 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 <= -1.36e-38) tmp = 1.0; elseif (x <= 1.5e-54) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.36e-38], 1.0, If[LessEqual[x, 1.5e-54], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.36 \cdot 10^{-38}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-54}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.36e-38 or 1.50000000000000005e-54 < x Initial program 86.5%
sub-neg86.5%
+-commutative86.5%
neg-sub086.5%
associate-+l-86.5%
div-sub86.5%
div086.5%
associate-+r-86.5%
+-commutative86.5%
+-lft-identity86.5%
*-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 82.7%
if -1.36e-38 < x < 1.50000000000000005e-54Initial program 95.4%
sub-neg95.4%
+-commutative95.4%
neg-sub095.4%
associate-+l-95.4%
div-sub95.4%
div095.4%
associate-+r-95.4%
+-commutative95.4%
+-lft-identity95.4%
*-commutative95.4%
Simplified95.4%
Taylor expanded in x around 0 46.1%
Final simplification67.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.32e-46) 1.0 (if (<= x 6.2e-36) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.32e-46) {
tmp = 1.0;
} else if (x <= 6.2e-36) {
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 <= (-1.32d-46)) then
tmp = 1.0d0
else if (x <= 6.2d-36) 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 <= -1.32e-46) {
tmp = 1.0;
} else if (x <= 6.2e-36) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.32e-46: tmp = 1.0 elif x <= 6.2e-36: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.32e-46) tmp = 1.0; elseif (x <= 6.2e-36) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.32e-46) tmp = 1.0; elseif (x <= 6.2e-36) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.32e-46], 1.0, If[LessEqual[x, 6.2e-36], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{-46}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-36}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.32000000000000001e-46 or 6.1999999999999997e-36 < x Initial program 85.6%
sub-neg85.6%
+-commutative85.6%
neg-sub085.6%
associate-+l-85.6%
div-sub85.6%
div085.6%
associate-+r-85.6%
+-commutative85.6%
+-lft-identity85.6%
*-commutative85.6%
Simplified85.6%
Taylor expanded in x around inf 84.3%
if -1.32000000000000001e-46 < x < 6.1999999999999997e-36Initial program 96.4%
sub-neg96.4%
+-commutative96.4%
neg-sub096.4%
associate-+l-96.4%
div-sub96.4%
div096.4%
associate-+r-96.4%
+-commutative96.4%
+-lft-identity96.4%
*-commutative96.4%
Simplified96.4%
Taylor expanded in t around inf 23.4%
+-commutative23.4%
Simplified23.4%
Taylor expanded in x around 0 23.4%
Final simplification57.4%
(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 90.3%
sub-neg90.3%
+-commutative90.3%
neg-sub090.3%
associate-+l-90.3%
div-sub90.3%
div090.3%
associate-+r-90.3%
+-commutative90.3%
+-lft-identity90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in x around inf 52.9%
Final simplification52.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 2023326
(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)))