
(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 12 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 (if (or (<= z -4.2e-6) (not (<= z 3e-13))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (+ x (/ (- (* z y) x) (fma z t (- x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e-6) || !(z <= 3e-13)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (((z * y) - x) / fma(z, t, -x))) / (x + 1.0);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.2e-6) || !(z <= 3e-13)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(z * y) - x) / fma(z, t, Float64(-x)))) / Float64(x + 1.0)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.2e-6], N[Not[LessEqual[z, 3e-13]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / N[(z * t + (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-6} \lor \neg \left(z \leq 3 \cdot 10^{-13}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{\mathsf{fma}\left(z, t, -x\right)}}{x + 1}\\
\end{array}
\end{array}
if z < -4.1999999999999996e-6 or 2.99999999999999984e-13 < z Initial program 80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in y around inf 79.8%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in t around 0 98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
if -4.1999999999999996e-6 < z < 2.99999999999999984e-13Initial program 99.8%
*-commutative99.8%
Simplified99.8%
fma-neg99.9%
Applied egg-rr99.9%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-5) (not (<= z 1.15e-41))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (+ x (/ (- (* z y) x) (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-5) || !(z <= 1.15e-41)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (((z * y) - x) / ((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 <= (-9d-5)) .or. (.not. (z <= 1.15d-41))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (x + (((z * y) - x) / ((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 <= -9e-5) || !(z <= 1.15e-41)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-5) or not (z <= 1.15e-41): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-5) || !(z <= 1.15e-41)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(z * y) - x) / 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 <= -9e-5) || ~((z <= 1.15e-41))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-5], N[Not[LessEqual[z, 1.15e-41]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-5} \lor \neg \left(z \leq 1.15 \cdot 10^{-41}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -9.00000000000000057e-5 or 1.15000000000000005e-41 < z Initial program 81.5%
*-commutative81.5%
Simplified81.5%
Taylor expanded in y around inf 80.7%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in t around 0 98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
if -9.00000000000000057e-5 < z < 1.15000000000000005e-41Initial program 99.9%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x (/ y (/ x z))) (+ x 1.0)))
(t_2 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -3.1e-99)
t_2
(if (<= t -1.4e-212)
t_1
(if (<= t -3.4e-302) 1.0 (if (<= t 5.9e-61) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - (y / (x / z))) / (x + 1.0);
double t_2 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -3.1e-99) {
tmp = t_2;
} else if (t <= -1.4e-212) {
tmp = t_1;
} else if (t <= -3.4e-302) {
tmp = 1.0;
} else if (t <= 5.9e-61) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = (x - (y / (x / z))) / (x + 1.0d0)
t_2 = (x + (y / t)) / (x + 1.0d0)
if (t <= (-3.1d-99)) then
tmp = t_2
else if (t <= (-1.4d-212)) then
tmp = t_1
else if (t <= (-3.4d-302)) then
tmp = 1.0d0
else if (t <= 5.9d-61) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - (y / (x / z))) / (x + 1.0);
double t_2 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -3.1e-99) {
tmp = t_2;
} else if (t <= -1.4e-212) {
tmp = t_1;
} else if (t <= -3.4e-302) {
tmp = 1.0;
} else if (t <= 5.9e-61) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - (y / (x / z))) / (x + 1.0) t_2 = (x + (y / t)) / (x + 1.0) tmp = 0 if t <= -3.1e-99: tmp = t_2 elif t <= -1.4e-212: tmp = t_1 elif t <= -3.4e-302: tmp = 1.0 elif t <= 5.9e-61: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - Float64(y / Float64(x / z))) / Float64(x + 1.0)) t_2 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (t <= -3.1e-99) tmp = t_2; elseif (t <= -1.4e-212) tmp = t_1; elseif (t <= -3.4e-302) tmp = 1.0; elseif (t <= 5.9e-61) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - (y / (x / z))) / (x + 1.0); t_2 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (t <= -3.1e-99) tmp = t_2; elseif (t <= -1.4e-212) tmp = t_1; elseif (t <= -3.4e-302) tmp = 1.0; elseif (t <= 5.9e-61) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.1e-99], t$95$2, If[LessEqual[t, -1.4e-212], t$95$1, If[LessEqual[t, -3.4e-302], 1.0, If[LessEqual[t, 5.9e-61], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - \frac{y}{\frac{x}{z}}}{x + 1}\\
t_2 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;t \leq -3.1 \cdot 10^{-99}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -1.4 \cdot 10^{-212}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -3.4 \cdot 10^{-302}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq 5.9 \cdot 10^{-61}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -3.0999999999999999e-99 or 5.89999999999999972e-61 < t Initial program 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in z around inf 90.2%
if -3.0999999999999999e-99 < t < -1.40000000000000007e-212 or -3.4e-302 < t < 5.89999999999999972e-61Initial program 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in y around inf 81.8%
associate-/l*88.4%
Simplified88.4%
Taylor expanded in t around 0 63.9%
+-commutative63.9%
mul-1-neg63.9%
unsub-neg63.9%
associate-/l*70.5%
+-commutative70.5%
Simplified70.5%
if -1.40000000000000007e-212 < t < -3.4e-302Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 58.3%
associate-/l*58.2%
Simplified58.2%
Taylor expanded in t around 0 58.2%
mul-1-neg58.2%
unsub-neg58.2%
Simplified58.2%
Taylor expanded in x around inf 87.6%
Final simplification83.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x (/ y (/ x z))) (+ x 1.0))))
(if (<= t -3.3e-99)
(+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
(if (<= t -6e-213)
t_1
(if (<= t -3.4e-302)
1.0
(if (<= t 2.7e-62) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - (y / (x / z))) / (x + 1.0);
double tmp;
if (t <= -3.3e-99) {
tmp = (x / (x + 1.0)) + (y / (t * (x + 1.0)));
} else if (t <= -6e-213) {
tmp = t_1;
} else if (t <= -3.4e-302) {
tmp = 1.0;
} else if (t <= 2.7e-62) {
tmp = t_1;
} 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) :: tmp
t_1 = (x - (y / (x / z))) / (x + 1.0d0)
if (t <= (-3.3d-99)) then
tmp = (x / (x + 1.0d0)) + (y / (t * (x + 1.0d0)))
else if (t <= (-6d-213)) then
tmp = t_1
else if (t <= (-3.4d-302)) then
tmp = 1.0d0
else if (t <= 2.7d-62) then
tmp = t_1
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 = (x - (y / (x / z))) / (x + 1.0);
double tmp;
if (t <= -3.3e-99) {
tmp = (x / (x + 1.0)) + (y / (t * (x + 1.0)));
} else if (t <= -6e-213) {
tmp = t_1;
} else if (t <= -3.4e-302) {
tmp = 1.0;
} else if (t <= 2.7e-62) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - (y / (x / z))) / (x + 1.0) tmp = 0 if t <= -3.3e-99: tmp = (x / (x + 1.0)) + (y / (t * (x + 1.0))) elif t <= -6e-213: tmp = t_1 elif t <= -3.4e-302: tmp = 1.0 elif t <= 2.7e-62: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - Float64(y / Float64(x / z))) / Float64(x + 1.0)) tmp = 0.0 if (t <= -3.3e-99) tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(t * Float64(x + 1.0)))); elseif (t <= -6e-213) tmp = t_1; elseif (t <= -3.4e-302) tmp = 1.0; elseif (t <= 2.7e-62) tmp = t_1; 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 = (x - (y / (x / z))) / (x + 1.0); tmp = 0.0; if (t <= -3.3e-99) tmp = (x / (x + 1.0)) + (y / (t * (x + 1.0))); elseif (t <= -6e-213) tmp = t_1; elseif (t <= -3.4e-302) tmp = 1.0; elseif (t <= 2.7e-62) tmp = t_1; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.3e-99], N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -6e-213], t$95$1, If[LessEqual[t, -3.4e-302], 1.0, If[LessEqual[t, 2.7e-62], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - \frac{y}{\frac{x}{z}}}{x + 1}\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{-99}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{elif}\;t \leq -6 \cdot 10^{-213}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -3.4 \cdot 10^{-302}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-62}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if t < -3.29999999999999986e-99Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in y around inf 82.7%
associate-/l*87.0%
Simplified87.0%
Taylor expanded in t around inf 89.7%
+-commutative89.7%
*-commutative89.7%
+-commutative89.7%
Simplified89.7%
if -3.29999999999999986e-99 < t < -5.99999999999999973e-213 or -3.4e-302 < t < 2.70000000000000019e-62Initial program 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in y around inf 81.8%
associate-/l*88.4%
Simplified88.4%
Taylor expanded in t around 0 63.9%
+-commutative63.9%
mul-1-neg63.9%
unsub-neg63.9%
associate-/l*70.5%
+-commutative70.5%
Simplified70.5%
if -5.99999999999999973e-213 < t < -3.4e-302Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 58.3%
associate-/l*58.2%
Simplified58.2%
Taylor expanded in t around 0 58.2%
mul-1-neg58.2%
unsub-neg58.2%
Simplified58.2%
Taylor expanded in x around inf 87.6%
if 2.70000000000000019e-62 < t Initial program 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in z around inf 90.6%
Final simplification83.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6e-247) (not (<= z 5.8e-110))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (- x (/ x (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6e-247) || !(z <= 5.8e-110)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x - (x / ((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 <= (-6d-247)) .or. (.not. (z <= 5.8d-110))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (x - (x / ((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 <= -6e-247) || !(z <= 5.8e-110)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6e-247) or not (z <= 5.8e-110): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6e-247) || !(z <= 5.8e-110)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(x / 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 <= -6e-247) || ~((z <= 5.8e-110))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (x - (x / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6e-247], N[Not[LessEqual[z, 5.8e-110]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(x / 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 -6 \cdot 10^{-247} \lor \neg \left(z \leq 5.8 \cdot 10^{-110}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -5.9999999999999995e-247 or 5.8000000000000005e-110 < z Initial program 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in y around inf 84.2%
associate-/l*91.4%
Simplified91.4%
Taylor expanded in t around 0 96.0%
mul-1-neg96.0%
unsub-neg96.0%
Simplified96.0%
if -5.9999999999999995e-247 < z < 5.8000000000000005e-110Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 91.2%
+-commutative91.2%
Simplified91.2%
Final simplification95.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))))
(if (<= x -1.95e-44)
t_1
(if (<= x 2.15e-125)
(/ y (* t (+ x 1.0)))
(if (<= x 0.000185) (* z (/ y (- (* z t) x))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -1.95e-44) {
tmp = t_1;
} else if (x <= 2.15e-125) {
tmp = y / (t * (x + 1.0));
} else if (x <= 0.000185) {
tmp = z * (y / ((z * t) - x));
} else {
tmp = t_1;
}
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 = x / (x + 1.0d0)
if (x <= (-1.95d-44)) then
tmp = t_1
else if (x <= 2.15d-125) then
tmp = y / (t * (x + 1.0d0))
else if (x <= 0.000185d0) then
tmp = z * (y / ((z * t) - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -1.95e-44) {
tmp = t_1;
} else if (x <= 2.15e-125) {
tmp = y / (t * (x + 1.0));
} else if (x <= 0.000185) {
tmp = z * (y / ((z * t) - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) tmp = 0 if x <= -1.95e-44: tmp = t_1 elif x <= 2.15e-125: tmp = y / (t * (x + 1.0)) elif x <= 0.000185: tmp = z * (y / ((z * t) - x)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -1.95e-44) tmp = t_1; elseif (x <= 2.15e-125) tmp = Float64(y / Float64(t * Float64(x + 1.0))); elseif (x <= 0.000185) tmp = Float64(z * Float64(y / Float64(Float64(z * t) - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (x + 1.0); tmp = 0.0; if (x <= -1.95e-44) tmp = t_1; elseif (x <= 2.15e-125) tmp = y / (t * (x + 1.0)); elseif (x <= 0.000185) tmp = z * (y / ((z * t) - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.95e-44], t$95$1, If[LessEqual[x, 2.15e-125], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.000185], N[(z * N[(y / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{-44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-125}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{elif}\;x \leq 0.000185:\\
\;\;\;\;z \cdot \frac{y}{z \cdot t - x}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.9500000000000001e-44 or 1.85e-4 < x Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in t around inf 85.1%
+-commutative85.1%
Simplified85.1%
if -1.9500000000000001e-44 < x < 2.1500000000000001e-125Initial program 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in y around inf 59.4%
times-frac51.9%
+-commutative51.9%
Simplified51.9%
Taylor expanded in t around inf 57.9%
if 2.1500000000000001e-125 < x < 1.85e-4Initial program 96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in y around inf 49.4%
times-frac46.3%
+-commutative46.3%
Simplified46.3%
Taylor expanded in x around 0 45.0%
Final simplification70.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.2e-240) (not (<= z 2.3e-110))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.2e-240) || !(z <= 2.3e-110)) {
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 <= (-8.2d-240)) .or. (.not. (z <= 2.3d-110))) 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 <= -8.2e-240) || !(z <= 2.3e-110)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.2e-240) or not (z <= 2.3e-110): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.2e-240) || !(z <= 2.3e-110)) 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 <= -8.2e-240) || ~((z <= 2.3e-110))) 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, -8.2e-240], N[Not[LessEqual[z, 2.3e-110]], $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 -8.2 \cdot 10^{-240} \lor \neg \left(z \leq 2.3 \cdot 10^{-110}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -8.2000000000000003e-240 or 2.3000000000000001e-110 < z Initial program 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in z around inf 78.2%
if -8.2000000000000003e-240 < z < 2.3000000000000001e-110Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 66.0%
associate-/l*65.9%
Simplified65.9%
Taylor expanded in t around 0 66.0%
mul-1-neg66.0%
unsub-neg66.0%
Simplified66.0%
Taylor expanded in x around inf 76.5%
Final simplification77.8%
(FPCore (x y z t) :precision binary64 (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (y / (t - (x / z)))) / (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 + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (y / (t - (x / z)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (y / (t - (x / z)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}
\end{array}
Initial program 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in y around inf 80.9%
associate-/l*86.7%
Simplified86.7%
Taylor expanded in t around 0 90.5%
mul-1-neg90.5%
unsub-neg90.5%
Simplified90.5%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.7e-43) (not (<= x 6.2e-132))) (/ x (+ x 1.0)) (/ y (* t (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.7e-43) || !(x <= 6.2e-132)) {
tmp = x / (x + 1.0);
} else {
tmp = 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 ((x <= (-2.7d-43)) .or. (.not. (x <= 6.2d-132))) then
tmp = x / (x + 1.0d0)
else
tmp = 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 ((x <= -2.7e-43) || !(x <= 6.2e-132)) {
tmp = x / (x + 1.0);
} else {
tmp = y / (t * (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.7e-43) or not (x <= 6.2e-132): tmp = x / (x + 1.0) else: tmp = y / (t * (x + 1.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.7e-43) || !(x <= 6.2e-132)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / Float64(t * Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.7e-43) || ~((x <= 6.2e-132))) tmp = x / (x + 1.0); else tmp = y / (t * (x + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.7e-43], N[Not[LessEqual[x, 6.2e-132]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-43} \lor \neg \left(x \leq 6.2 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -2.69999999999999991e-43 or 6.20000000000000016e-132 < x Initial program 90.1%
*-commutative90.1%
Simplified90.1%
Taylor expanded in t around inf 74.1%
+-commutative74.1%
Simplified74.1%
if -2.69999999999999991e-43 < x < 6.20000000000000016e-132Initial program 89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in y around inf 59.9%
times-frac52.4%
+-commutative52.4%
Simplified52.4%
Taylor expanded in t around inf 58.4%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.42e-140) (not (<= t 6.5e-72))) (/ x (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.42e-140) || !(t <= 6.5e-72)) {
tmp = x / (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 ((t <= (-1.42d-140)) .or. (.not. (t <= 6.5d-72))) then
tmp = x / (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 ((t <= -1.42e-140) || !(t <= 6.5e-72)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.42e-140) or not (t <= 6.5e-72): tmp = x / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.42e-140) || !(t <= 6.5e-72)) tmp = Float64(x / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.42e-140) || ~((t <= 6.5e-72))) tmp = x / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.42e-140], N[Not[LessEqual[t, 6.5e-72]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.42 \cdot 10^{-140} \lor \neg \left(t \leq 6.5 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -1.42e-140 or 6.4999999999999997e-72 < t Initial program 88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in t around inf 64.7%
+-commutative64.7%
Simplified64.7%
if -1.42e-140 < t < 6.4999999999999997e-72Initial program 93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in y around inf 76.2%
associate-/l*81.6%
Simplified81.6%
Taylor expanded in t around 0 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
Taylor expanded in x around inf 51.8%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (if (<= x -2.35e-27) 1.0 (if (<= x 7.6e-125) (- x (* x x)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.35e-27) {
tmp = 1.0;
} else if (x <= 7.6e-125) {
tmp = x - (x * 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 <= (-2.35d-27)) then
tmp = 1.0d0
else if (x <= 7.6d-125) then
tmp = x - (x * 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 <= -2.35e-27) {
tmp = 1.0;
} else if (x <= 7.6e-125) {
tmp = x - (x * x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.35e-27: tmp = 1.0 elif x <= 7.6e-125: tmp = x - (x * x) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.35e-27) tmp = 1.0; elseif (x <= 7.6e-125) tmp = Float64(x - Float64(x * x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.35e-27) tmp = 1.0; elseif (x <= 7.6e-125) tmp = x - (x * x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.35e-27], 1.0, If[LessEqual[x, 7.6e-125], N[(x - N[(x * x), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{-27}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{-125}:\\
\;\;\;\;x - x \cdot x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.35000000000000016e-27 or 7.6000000000000002e-125 < x Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in y around inf 83.9%
associate-/l*91.6%
Simplified91.6%
Taylor expanded in t around 0 92.9%
mul-1-neg92.9%
unsub-neg92.9%
Simplified92.9%
Taylor expanded in x around inf 75.6%
if -2.35000000000000016e-27 < x < 7.6000000000000002e-125Initial program 89.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in t around inf 23.9%
+-commutative23.9%
Simplified23.9%
Taylor expanded in x around 0 23.9%
+-commutative23.9%
mul-1-neg23.9%
unsub-neg23.9%
unpow223.9%
Simplified23.9%
Final simplification54.8%
(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 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in y around inf 80.9%
associate-/l*86.7%
Simplified86.7%
Taylor expanded in t around 0 90.5%
mul-1-neg90.5%
unsub-neg90.5%
Simplified90.5%
Taylor expanded in x around inf 49.4%
Final simplification49.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 2023274
(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)))