
(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 11 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)))
(if (<= (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0)) INFINITY)
(*
y
(+
(/ (+ (/ x (+ x 1.0)) (/ (/ x (- -1.0 x)) t_1)) y)
(/ z (* t_1 (+ x 1.0)))))
(/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double tmp;
if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= ((double) INFINITY)) {
tmp = y * ((((x / (x + 1.0)) + ((x / (-1.0 - x)) / t_1)) / y) + (z / (t_1 * (x + 1.0))));
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double tmp;
if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= Double.POSITIVE_INFINITY) {
tmp = y * ((((x / (x + 1.0)) + ((x / (-1.0 - x)) / t_1)) / y) + (z / (t_1 * (x + 1.0))));
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x tmp = 0 if ((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= math.inf: tmp = y * ((((x / (x + 1.0)) + ((x / (-1.0 - x)) / t_1)) / y) + (z / (t_1 * (x + 1.0)))) else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) tmp = 0.0 if (Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) <= Inf) tmp = Float64(y * Float64(Float64(Float64(Float64(x / Float64(x + 1.0)) + Float64(Float64(x / Float64(-1.0 - x)) / t_1)) / y) + Float64(z / Float64(t_1 * 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) t_1 = (z * t) - x; tmp = 0.0; if (((x + (((y * z) - x) / t_1)) / (x + 1.0)) <= Inf) tmp = y * ((((x / (x + 1.0)) + ((x / (-1.0 - x)) / t_1)) / y) + (z / (t_1 * (x + 1.0)))); 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]}, If[LessEqual[N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(y * N[(N[(N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(z / N[(t$95$1 * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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\\
\mathbf{if}\;\frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1} \leq \infty:\\
\;\;\;\;y \cdot \left(\frac{\frac{x}{x + 1} + \frac{\frac{x}{-1 - x}}{t\_1}}{y} + \frac{z}{t\_1 \cdot \left(x + 1\right)}\right)\\
\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 #s(literal 1 binary64))) < +inf.0Initial program 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in y around -inf 98.1%
mul-1-neg98.1%
*-commutative98.1%
distribute-rgt-neg-in98.1%
Simplified98.1%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.9e+128) (not (<= z 3.3e+78))) (+ (+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0)))) (/ x (* t (* z (- -1.0 x))))) (/ (+ x (* (- (* y z) x) (/ 1.0 (- (* z t) x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.9e+128) || !(z <= 3.3e+78)) {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) + (x / (t * (z * (-1.0 - x))));
} else {
tmp = (x + (((y * z) - x) * (1.0 / ((z * t) - x)))) / (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 <= (-5.9d+128)) .or. (.not. (z <= 3.3d+78))) then
tmp = ((x / (x + 1.0d0)) + (y / (t * (x + 1.0d0)))) + (x / (t * (z * ((-1.0d0) - x))))
else
tmp = (x + (((y * z) - x) * (1.0d0 / ((z * t) - x)))) / (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 <= -5.9e+128) || !(z <= 3.3e+78)) {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) + (x / (t * (z * (-1.0 - x))));
} else {
tmp = (x + (((y * z) - x) * (1.0 / ((z * t) - x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.9e+128) or not (z <= 3.3e+78): tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) + (x / (t * (z * (-1.0 - x)))) else: tmp = (x + (((y * z) - x) * (1.0 / ((z * t) - x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.9e+128) || !(z <= 3.3e+78)) tmp = Float64(Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(t * Float64(x + 1.0)))) + Float64(x / Float64(t * Float64(z * Float64(-1.0 - x))))); else tmp = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) * Float64(1.0 / Float64(Float64(z * t) - x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.9e+128) || ~((z <= 3.3e+78))) tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) + (x / (t * (z * (-1.0 - x)))); else tmp = (x + (((y * z) - x) * (1.0 / ((z * t) - x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.9e+128], N[Not[LessEqual[z, 3.3e+78]], $MachinePrecision]], 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[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] * N[(1.0 / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.9 \cdot 10^{+128} \lor \neg \left(z \leq 3.3 \cdot 10^{+78}\right):\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) + \frac{x}{t \cdot \left(z \cdot \left(-1 - x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(y \cdot z - x\right) \cdot \frac{1}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -5.89999999999999987e128 or 3.3e78 < z Initial program 68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in t around inf 95.8%
if -5.89999999999999987e128 < z < 3.3e78Initial program 98.2%
*-commutative98.2%
Simplified98.2%
clear-num98.1%
associate-/r/98.2%
Applied egg-rr98.2%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.4e+128) (not (<= z 6e+76))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (* (- (* y z) x) (/ 1.0 (- (* z t) x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.4e+128) || !(z <= 6e+76)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((y * z) - x) * (1.0 / ((z * t) - x)))) / (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 <= (-6.4d+128)) .or. (.not. (z <= 6d+76))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (((y * z) - x) * (1.0d0 / ((z * t) - x)))) / (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 <= -6.4e+128) || !(z <= 6e+76)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((y * z) - x) * (1.0 / ((z * t) - x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.4e+128) or not (z <= 6e+76): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (((y * z) - x) * (1.0 / ((z * t) - x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.4e+128) || !(z <= 6e+76)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) * Float64(1.0 / Float64(Float64(z * t) - x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.4e+128) || ~((z <= 6e+76))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (((y * z) - x) * (1.0 / ((z * t) - x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.4e+128], N[Not[LessEqual[z, 6e+76]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] * N[(1.0 / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+128} \lor \neg \left(z \leq 6 \cdot 10^{+76}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(y \cdot z - x\right) \cdot \frac{1}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -6.39999999999999971e128 or 5.9999999999999996e76 < z Initial program 68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in z around inf 95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
if -6.39999999999999971e128 < z < 5.9999999999999996e76Initial program 98.2%
*-commutative98.2%
Simplified98.2%
clear-num98.1%
associate-/r/98.2%
Applied egg-rr98.2%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+129) (not (<= z 4.5e+81))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (- x (/ (- x (* y z)) (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+129) || !(z <= 4.5e+81)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - ((x - (y * z)) / ((z * t) - x))) / (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.3d+129)) .or. (.not. (z <= 4.5d+81))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x - ((x - (y * z)) / ((z * t) - x))) / (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.3e+129) || !(z <= 4.5e+81)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.3e+129) or not (z <= 4.5e+81): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+129) || !(z <= 4.5e+81)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.3e+129) || ~((z <= 4.5e+81))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+129], N[Not[LessEqual[z, 4.5e+81]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+129} \lor \neg \left(z \leq 4.5 \cdot 10^{+81}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{x - y \cdot z}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -1.30000000000000006e129 or 4.50000000000000017e81 < z Initial program 68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in z around inf 95.7%
+-commutative95.7%
+-commutative95.7%
Simplified95.7%
if -1.30000000000000006e129 < z < 4.50000000000000017e81Initial program 98.2%
Final simplification97.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)))
(if (<= x -5.4e-5)
(/ x (+ x 1.0))
(if (<= x 2.1e-11)
(+ x (* (- (* y z) x) (/ 1.0 t_1)))
(/ (- (/ x t_1) x) (- -1.0 x))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double tmp;
if (x <= -5.4e-5) {
tmp = x / (x + 1.0);
} else if (x <= 2.1e-11) {
tmp = x + (((y * z) - x) * (1.0 / t_1));
} else {
tmp = ((x / t_1) - x) / (-1.0 - 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) :: t_1
real(8) :: tmp
t_1 = (z * t) - x
if (x <= (-5.4d-5)) then
tmp = x / (x + 1.0d0)
else if (x <= 2.1d-11) then
tmp = x + (((y * z) - x) * (1.0d0 / t_1))
else
tmp = ((x / t_1) - x) / ((-1.0d0) - x)
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 tmp;
if (x <= -5.4e-5) {
tmp = x / (x + 1.0);
} else if (x <= 2.1e-11) {
tmp = x + (((y * z) - x) * (1.0 / t_1));
} else {
tmp = ((x / t_1) - x) / (-1.0 - x);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x tmp = 0 if x <= -5.4e-5: tmp = x / (x + 1.0) elif x <= 2.1e-11: tmp = x + (((y * z) - x) * (1.0 / t_1)) else: tmp = ((x / t_1) - x) / (-1.0 - x) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) tmp = 0.0 if (x <= -5.4e-5) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 2.1e-11) tmp = Float64(x + Float64(Float64(Float64(y * z) - x) * Float64(1.0 / t_1))); else tmp = Float64(Float64(Float64(x / t_1) - x) / Float64(-1.0 - x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; tmp = 0.0; if (x <= -5.4e-5) tmp = x / (x + 1.0); elseif (x <= 2.1e-11) tmp = x + (((y * z) - x) * (1.0 / t_1)); else tmp = ((x / t_1) - x) / (-1.0 - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[x, -5.4e-5], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.1e-11], N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / t$95$1), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
\mathbf{if}\;x \leq -5.4 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-11}:\\
\;\;\;\;x + \left(y \cdot z - x\right) \cdot \frac{1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t\_1} - x}{-1 - x}\\
\end{array}
\end{array}
if x < -5.3999999999999998e-5Initial program 85.1%
*-commutative85.1%
Simplified85.1%
Taylor expanded in t around inf 94.6%
+-commutative94.6%
Simplified94.6%
if -5.3999999999999998e-5 < x < 2.0999999999999999e-11Initial program 89.4%
*-commutative89.4%
Simplified89.4%
clear-num89.3%
associate-/r/89.4%
Applied egg-rr89.4%
Taylor expanded in x around 0 89.2%
if 2.0999999999999999e-11 < x Initial program 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in y around 0 90.9%
+-commutative90.9%
Simplified90.9%
Final simplification90.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.4e-141) (not (<= z 1.95e-45))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ (- x (* y (/ z x))) 1.0) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.4e-141) || !(z <= 1.95e-45)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x - (y * (z / x))) + 1.0) / (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 <= (-4.4d-141)) .or. (.not. (z <= 1.95d-45))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = ((x - (y * (z / x))) + 1.0d0) / (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 <= -4.4e-141) || !(z <= 1.95e-45)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.4e-141) or not (z <= 1.95e-45): tmp = (x + (y / t)) / (x + 1.0) else: tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.4e-141) || !(z <= 1.95e-45)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x - Float64(y * Float64(z / x))) + 1.0) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.4e-141) || ~((z <= 1.95e-45))) tmp = (x + (y / t)) / (x + 1.0); else tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.4e-141], N[Not[LessEqual[z, 1.95e-45]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-141} \lor \neg \left(z \leq 1.95 \cdot 10^{-45}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y \cdot \frac{z}{x}\right) + 1}{x + 1}\\
\end{array}
\end{array}
if z < -4.40000000000000018e-141 or 1.95e-45 < z Initial program 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in z around inf 86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
if -4.40000000000000018e-141 < z < 1.95e-45Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 87.4%
mul-1-neg87.4%
unsub-neg87.4%
associate-/l*87.4%
+-commutative87.4%
Simplified87.4%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.5e-176) (not (<= z 2.15e-89))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e-176) || !(z <= 2.15e-89)) {
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 <= (-6.5d-176)) .or. (.not. (z <= 2.15d-89))) 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 <= -6.5e-176) || !(z <= 2.15e-89)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.5e-176) or not (z <= 2.15e-89): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.5e-176) || !(z <= 2.15e-89)) 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 <= -6.5e-176) || ~((z <= 2.15e-89))) 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, -6.5e-176], N[Not[LessEqual[z, 2.15e-89]], $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 -6.5 \cdot 10^{-176} \lor \neg \left(z \leq 2.15 \cdot 10^{-89}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -6.5e-176 or 2.14999999999999993e-89 < z Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
if -6.5e-176 < z < 2.14999999999999993e-89Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 77.1%
Final simplification82.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1.76e-25) 1.0 (if (<= x 7.1e-41) (+ x (/ y t)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.76e-25) {
tmp = 1.0;
} else if (x <= 7.1e-41) {
tmp = x + (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.76d-25)) then
tmp = 1.0d0
else if (x <= 7.1d-41) then
tmp = x + (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.76e-25) {
tmp = 1.0;
} else if (x <= 7.1e-41) {
tmp = x + (y / t);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.76e-25: tmp = 1.0 elif x <= 7.1e-41: tmp = x + (y / t) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.76e-25) tmp = 1.0; elseif (x <= 7.1e-41) tmp = Float64(x + 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.76e-25) tmp = 1.0; elseif (x <= 7.1e-41) tmp = x + (y / t); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.76e-25], 1.0, If[LessEqual[x, 7.1e-41], N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.76 \cdot 10^{-25}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.1 \cdot 10^{-41}:\\
\;\;\;\;x + \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.7600000000000001e-25 or 7.10000000000000003e-41 < x Initial program 88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in x around inf 89.6%
if -1.7600000000000001e-25 < x < 7.10000000000000003e-41Initial program 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in z around inf 73.0%
+-commutative73.0%
+-commutative73.0%
Simplified73.0%
Taylor expanded in x around 0 73.0%
/-rgt-identity73.0%
Applied egg-rr73.0%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.56e-29) 1.0 (if (<= x 6.2e-133) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.56e-29) {
tmp = 1.0;
} else if (x <= 6.2e-133) {
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.56d-29)) then
tmp = 1.0d0
else if (x <= 6.2d-133) 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.56e-29) {
tmp = 1.0;
} else if (x <= 6.2e-133) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.56e-29: tmp = 1.0 elif x <= 6.2e-133: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.56e-29) tmp = 1.0; elseif (x <= 6.2e-133) 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.56e-29) tmp = 1.0; elseif (x <= 6.2e-133) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.56e-29], 1.0, If[LessEqual[x, 6.2e-133], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.56 \cdot 10^{-29}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-133}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.5600000000000001e-29 or 6.20000000000000032e-133 < x Initial program 90.0%
*-commutative90.0%
Simplified90.0%
Taylor expanded in x around inf 80.2%
if -1.5600000000000001e-29 < x < 6.20000000000000032e-133Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in x around 0 57.9%
(FPCore (x y z t) :precision binary64 (if (<= x -3.8e-37) 1.0 (if (<= x 2.5e-135) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e-37) {
tmp = 1.0;
} else if (x <= 2.5e-135) {
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.8d-37)) then
tmp = 1.0d0
else if (x <= 2.5d-135) 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.8e-37) {
tmp = 1.0;
} else if (x <= 2.5e-135) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.8e-37: tmp = 1.0 elif x <= 2.5e-135: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.8e-37) tmp = 1.0; elseif (x <= 2.5e-135) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.8e-37) tmp = 1.0; elseif (x <= 2.5e-135) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.8e-37], 1.0, If[LessEqual[x, 2.5e-135], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-37}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-135}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.8000000000000004e-37 or 2.5000000000000001e-135 < x Initial program 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in x around inf 78.8%
if -3.8000000000000004e-37 < x < 2.5000000000000001e-135Initial program 87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in z around inf 80.5%
+-commutative80.5%
+-commutative80.5%
Simplified80.5%
Taylor expanded in x around 0 80.5%
Taylor expanded in y around 0 25.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.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in x around inf 50.4%
(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 2024157
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1)))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))