
(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 (if (or (<= z -5.5e+76) (not (<= z 2.8e+69))) (/ (+ 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 <= -5.5e+76) || !(z <= 2.8e+69)) {
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 <= -5.5e+76) || !(z <= 2.8e+69)) 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, -5.5e+76], N[Not[LessEqual[z, 2.8e+69]], $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 -5.5 \cdot 10^{+76} \lor \neg \left(z \leq 2.8 \cdot 10^{+69}\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 < -5.5000000000000001e76 or 2.79999999999999982e69 < z Initial program 71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in y around inf 71.4%
associate-/l*90.6%
Simplified90.6%
Taylor expanded in t around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
if -5.5000000000000001e76 < z < 2.79999999999999982e69Initial program 99.9%
*-commutative99.9%
Simplified99.9%
fma-neg99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e+77) (not (<= z 1.9e+69))) (/ (+ 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 <= -5e+77) || !(z <= 1.9e+69)) {
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 <= (-5d+77)) .or. (.not. (z <= 1.9d+69))) 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 <= -5e+77) || !(z <= 1.9e+69)) {
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 <= -5e+77) or not (z <= 1.9e+69): 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 <= -5e+77) || !(z <= 1.9e+69)) 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 <= -5e+77) || ~((z <= 1.9e+69))) 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, -5e+77], N[Not[LessEqual[z, 1.9e+69]], $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 -5 \cdot 10^{+77} \lor \neg \left(z \leq 1.9 \cdot 10^{+69}\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 < -5.00000000000000004e77 or 1.90000000000000014e69 < z Initial program 71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in y around inf 71.4%
associate-/l*90.6%
Simplified90.6%
Taylor expanded in t around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
if -5.00000000000000004e77 < z < 1.90000000000000014e69Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e-53) (not (<= z 1.75e-35))) (+ (/ y (* t (+ x 1.0))) (/ x (+ x 1.0))) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-53) || !(z <= 1.75e-35)) {
tmp = (y / (t * (x + 1.0))) + (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 ((z <= (-5d-53)) .or. (.not. (z <= 1.75d-35))) then
tmp = (y / (t * (x + 1.0d0))) + (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 ((z <= -5e-53) || !(z <= 1.75e-35)) {
tmp = (y / (t * (x + 1.0))) + (x / (x + 1.0));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e-53) or not (z <= 1.75e-35): tmp = (y / (t * (x + 1.0))) + (x / (x + 1.0)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e-53) || !(z <= 1.75e-35)) tmp = Float64(Float64(y / Float64(t * Float64(x + 1.0))) + 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 ((z <= -5e-53) || ~((z <= 1.75e-35))) tmp = (y / (t * (x + 1.0))) + (x / (x + 1.0)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5e-53], N[Not[LessEqual[z, 1.75e-35]], $MachinePrecision]], N[(N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-53} \lor \neg \left(z \leq 1.75 \cdot 10^{-35}\right):\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)} + \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -5e-53 or 1.74999999999999998e-35 < z Initial program 80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in t around inf 86.3%
Taylor expanded in z around inf 88.0%
if -5e-53 < z < 1.74999999999999998e-35Initial program 99.9%
*-commutative99.9%
Simplified99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 76.5%
Final simplification83.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.05e-159) (not (<= z 7.2e-126))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (+ 1.0 (- x (/ y (/ x z)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.05e-159) || !(z <= 7.2e-126)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.05d-159)) .or. (.not. (z <= 7.2d-126))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (1.0d0 + (x - (y / (x / z)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.05e-159) || !(z <= 7.2e-126)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.05e-159) or not (z <= 7.2e-126): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.05e-159) || !(z <= 7.2e-126)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.05e-159) || ~((z <= 7.2e-126))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.05e-159], N[Not[LessEqual[z, 7.2e-126]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-159} \lor \neg \left(z \leq 7.2 \cdot 10^{-126}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if z < -1.05e-159 or 7.1999999999999999e-126 < z Initial program 84.3%
*-commutative84.3%
Simplified84.3%
Taylor expanded in y around inf 81.0%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in t around 0 96.7%
neg-mul-196.7%
unsub-neg96.7%
Simplified96.7%
if -1.05e-159 < z < 7.1999999999999999e-126Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 87.8%
mul-1-neg87.8%
unsub-neg87.8%
associate-/l*87.7%
+-commutative87.7%
Simplified87.7%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4e-136) (not (<= y 3.3e-144))) (/ (+ 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 ((y <= -4e-136) || !(y <= 3.3e-144)) {
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 ((y <= (-4d-136)) .or. (.not. (y <= 3.3d-144))) 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 ((y <= -4e-136) || !(y <= 3.3e-144)) {
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 (y <= -4e-136) or not (y <= 3.3e-144): 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 ((y <= -4e-136) || !(y <= 3.3e-144)) 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 ((y <= -4e-136) || ~((y <= 3.3e-144))) 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[y, -4e-136], N[Not[LessEqual[y, 3.3e-144]], $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}\;y \leq -4 \cdot 10^{-136} \lor \neg \left(y \leq 3.3 \cdot 10^{-144}\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 y < -4.00000000000000001e-136 or 3.29999999999999995e-144 < y Initial program 83.2%
*-commutative83.2%
Simplified83.2%
Taylor expanded in y around inf 79.5%
associate-/l*90.6%
Simplified90.6%
Taylor expanded in t around 0 96.2%
neg-mul-196.2%
unsub-neg96.2%
Simplified96.2%
if -4.00000000000000001e-136 < y < 3.29999999999999995e-144Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 92.9%
+-commutative92.9%
Simplified92.9%
Final simplification95.1%
(FPCore (x y z t)
:precision binary64
(if (<= t -4.3e-141)
(+ (/ y (* t (+ x 1.0))) (/ x (+ x 1.0)))
(if (<= t 2.1e-100)
(/ (+ 1.0 (- x (/ y (/ x z)))) (+ x 1.0))
(/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.3e-141) {
tmp = (y / (t * (x + 1.0))) + (x / (x + 1.0));
} else if (t <= 2.1e-100) {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-4.3d-141)) then
tmp = (y / (t * (x + 1.0d0))) + (x / (x + 1.0d0))
else if (t <= 2.1d-100) then
tmp = (1.0d0 + (x - (y / (x / z)))) / (x + 1.0d0)
else
tmp = (x + (y / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.3e-141) {
tmp = (y / (t * (x + 1.0))) + (x / (x + 1.0));
} else if (t <= 2.1e-100) {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.3e-141: tmp = (y / (t * (x + 1.0))) + (x / (x + 1.0)) elif t <= 2.1e-100: tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0) else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.3e-141) tmp = Float64(Float64(y / Float64(t * Float64(x + 1.0))) + Float64(x / Float64(x + 1.0))); elseif (t <= 2.1e-100) tmp = Float64(Float64(1.0 + Float64(x - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.3e-141) tmp = (y / (t * (x + 1.0))) + (x / (x + 1.0)); elseif (t <= 2.1e-100) tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0); else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.3e-141], N[(N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e-100], N[(N[(1.0 + N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{-141}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)} + \frac{x}{x + 1}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-100}:\\
\;\;\;\;\frac{1 + \left(x - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if t < -4.29999999999999974e-141Initial program 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in t around inf 81.6%
Taylor expanded in z around inf 84.7%
if -4.29999999999999974e-141 < t < 2.10000000000000009e-100Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in t around 0 82.9%
mul-1-neg82.9%
unsub-neg82.9%
associate-/l*88.3%
+-commutative88.3%
Simplified88.3%
if 2.10000000000000009e-100 < t Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 88.0%
Final simplification87.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.5e-53) (not (<= z 2.5e-37))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e-53) || !(z <= 2.5e-37)) {
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-53)) .or. (.not. (z <= 2.5d-37))) 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-53) || !(z <= 2.5e-37)) {
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-53) or not (z <= 2.5e-37): 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-53) || !(z <= 2.5e-37)) 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-53) || ~((z <= 2.5e-37))) 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-53], N[Not[LessEqual[z, 2.5e-37]], $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^{-53} \lor \neg \left(z \leq 2.5 \cdot 10^{-37}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -6.4999999999999997e-53 or 2.4999999999999999e-37 < z Initial program 80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in z around inf 87.9%
if -6.4999999999999997e-53 < z < 2.4999999999999999e-37Initial program 99.9%
*-commutative99.9%
Simplified99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 76.5%
Final simplification83.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.36e-71) (not (<= x 1.35e-30))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.36e-71) || !(x <= 1.35e-30)) {
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 <= (-1.36d-71)) .or. (.not. (x <= 1.35d-30))) 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 <= -1.36e-71) || !(x <= 1.35e-30)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.36e-71) or not (x <= 1.35e-30): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.36e-71) || !(x <= 1.35e-30)) 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 <= -1.36e-71) || ~((x <= 1.35e-30))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.36e-71], N[Not[LessEqual[x, 1.35e-30]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.36 \cdot 10^{-71} \lor \neg \left(x \leq 1.35 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -1.3599999999999999e-71 or 1.34999999999999994e-30 < x Initial program 89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in t around inf 86.0%
+-commutative86.0%
Simplified86.0%
if -1.3599999999999999e-71 < x < 1.34999999999999994e-30Initial program 87.5%
*-commutative87.5%
Simplified87.5%
clear-num87.5%
inv-pow87.5%
Applied egg-rr87.5%
Taylor expanded in x around 0 53.7%
Final simplification72.9%
(FPCore (x y z t) :precision binary64 (if (<= x -3e-15) 1.0 (if (<= x 4.2e-32) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3e-15) {
tmp = 1.0;
} else if (x <= 4.2e-32) {
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 <= (-3d-15)) then
tmp = 1.0d0
else if (x <= 4.2d-32) 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 <= -3e-15) {
tmp = 1.0;
} else if (x <= 4.2e-32) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3e-15: tmp = 1.0 elif x <= 4.2e-32: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3e-15) tmp = 1.0; elseif (x <= 4.2e-32) 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 <= -3e-15) tmp = 1.0; elseif (x <= 4.2e-32) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3e-15], 1.0, If[LessEqual[x, 4.2e-32], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-15}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-32}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3e-15 or 4.1999999999999998e-32 < x Initial program 90.1%
*-commutative90.1%
Simplified90.1%
clear-num90.1%
inv-pow90.1%
Applied egg-rr90.1%
Taylor expanded in x around inf 88.4%
if -3e-15 < x < 4.1999999999999998e-32Initial program 86.4%
*-commutative86.4%
Simplified86.4%
clear-num86.3%
inv-pow86.3%
Applied egg-rr86.3%
Taylor expanded in x around 0 51.7%
Final simplification71.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 88.4%
*-commutative88.4%
Simplified88.4%
clear-num88.4%
inv-pow88.4%
Applied egg-rr88.4%
Taylor expanded in x around inf 56.4%
Final simplification56.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 2023285
(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)))