
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.05e+18) (not (<= z 1.6e-87))) (- (/ y (- a (/ t z))) (/ x (- (* z a) t))) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.05e+18) || !(z <= 1.6e-87)) {
tmp = (y / (a - (t / z))) - (x / ((z * a) - t));
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.05d+18)) .or. (.not. (z <= 1.6d-87))) then
tmp = (y / (a - (t / z))) - (x / ((z * a) - t))
else
tmp = (x - (z * y)) / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.05e+18) || !(z <= 1.6e-87)) {
tmp = (y / (a - (t / z))) - (x / ((z * a) - t));
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.05e+18) or not (z <= 1.6e-87): tmp = (y / (a - (t / z))) - (x / ((z * a) - t)) else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.05e+18) || !(z <= 1.6e-87)) tmp = Float64(Float64(y / Float64(a - Float64(t / z))) - Float64(x / Float64(Float64(z * a) - t))); else tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.05e+18) || ~((z <= 1.6e-87))) tmp = (y / (a - (t / z))) - (x / ((z * a) - t)); else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.05e+18], N[Not[LessEqual[z, 1.6e-87]], $MachinePrecision]], N[(N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+18} \lor \neg \left(z \leq 1.6 \cdot 10^{-87}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}} - \frac{x}{z \cdot a - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.05e18 or 1.59999999999999989e-87 < z Initial program 72.7%
sub-neg72.7%
+-commutative72.7%
neg-sub072.7%
associate-+l-72.7%
sub0-neg72.7%
neg-mul-172.7%
sub-neg72.7%
+-commutative72.7%
neg-sub072.7%
associate-+l-72.7%
sub0-neg72.7%
neg-mul-172.7%
times-frac72.7%
metadata-eval72.7%
*-lft-identity72.7%
*-commutative72.7%
Simplified72.7%
div-sub72.7%
associate-/l*84.6%
Applied egg-rr84.6%
Taylor expanded in z around 0 97.8%
mul-1-neg97.8%
unsub-neg97.8%
Simplified97.8%
if -1.05e18 < z < 1.59999999999999989e-87Initial program 99.8%
Final simplification98.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (/ (* z y) t))))
(if (<= z -2100000000000.0)
(/ y a)
(if (<= z -2.1e-77)
t_1
(if (<= z -3.9e-81)
(/ y a)
(if (<= z 3.64e-148)
(/ x t)
(if (<= z 5.3e-74) t_1 (if (<= z 480000.0) (/ x t) (/ y a)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -((z * y) / t);
double tmp;
if (z <= -2100000000000.0) {
tmp = y / a;
} else if (z <= -2.1e-77) {
tmp = t_1;
} else if (z <= -3.9e-81) {
tmp = y / a;
} else if (z <= 3.64e-148) {
tmp = x / t;
} else if (z <= 5.3e-74) {
tmp = t_1;
} else if (z <= 480000.0) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = -((z * y) / t)
if (z <= (-2100000000000.0d0)) then
tmp = y / a
else if (z <= (-2.1d-77)) then
tmp = t_1
else if (z <= (-3.9d-81)) then
tmp = y / a
else if (z <= 3.64d-148) then
tmp = x / t
else if (z <= 5.3d-74) then
tmp = t_1
else if (z <= 480000.0d0) then
tmp = x / t
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -((z * y) / t);
double tmp;
if (z <= -2100000000000.0) {
tmp = y / a;
} else if (z <= -2.1e-77) {
tmp = t_1;
} else if (z <= -3.9e-81) {
tmp = y / a;
} else if (z <= 3.64e-148) {
tmp = x / t;
} else if (z <= 5.3e-74) {
tmp = t_1;
} else if (z <= 480000.0) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -((z * y) / t) tmp = 0 if z <= -2100000000000.0: tmp = y / a elif z <= -2.1e-77: tmp = t_1 elif z <= -3.9e-81: tmp = y / a elif z <= 3.64e-148: tmp = x / t elif z <= 5.3e-74: tmp = t_1 elif z <= 480000.0: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(-Float64(Float64(z * y) / t)) tmp = 0.0 if (z <= -2100000000000.0) tmp = Float64(y / a); elseif (z <= -2.1e-77) tmp = t_1; elseif (z <= -3.9e-81) tmp = Float64(y / a); elseif (z <= 3.64e-148) tmp = Float64(x / t); elseif (z <= 5.3e-74) tmp = t_1; elseif (z <= 480000.0) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -((z * y) / t); tmp = 0.0; if (z <= -2100000000000.0) tmp = y / a; elseif (z <= -2.1e-77) tmp = t_1; elseif (z <= -3.9e-81) tmp = y / a; elseif (z <= 3.64e-148) tmp = x / t; elseif (z <= 5.3e-74) tmp = t_1; elseif (z <= 480000.0) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = (-N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision])}, If[LessEqual[z, -2100000000000.0], N[(y / a), $MachinePrecision], If[LessEqual[z, -2.1e-77], t$95$1, If[LessEqual[z, -3.9e-81], N[(y / a), $MachinePrecision], If[LessEqual[z, 3.64e-148], N[(x / t), $MachinePrecision], If[LessEqual[z, 5.3e-74], t$95$1, If[LessEqual[z, 480000.0], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\frac{z \cdot y}{t}\\
\mathbf{if}\;z \leq -2100000000000:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{-81}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 3.64 \cdot 10^{-148}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{-74}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 480000:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.1e12 or -2.10000000000000015e-77 < z < -3.89999999999999985e-81 or 4.8e5 < z Initial program 68.6%
sub-neg68.6%
+-commutative68.6%
neg-sub068.6%
associate-+l-68.6%
sub0-neg68.6%
neg-mul-168.6%
sub-neg68.6%
+-commutative68.6%
neg-sub068.6%
associate-+l-68.6%
sub0-neg68.6%
neg-mul-168.6%
times-frac68.6%
metadata-eval68.6%
*-lft-identity68.6%
*-commutative68.6%
Simplified68.6%
Taylor expanded in z around inf 60.5%
if -2.1e12 < z < -2.10000000000000015e-77 or 3.6399999999999999e-148 < z < 5.29999999999999987e-74Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around 0 66.5%
associate-*r/66.5%
neg-mul-166.5%
neg-sub066.5%
sub-neg66.5%
+-commutative66.5%
associate--r+66.5%
neg-sub066.5%
remove-double-neg66.5%
*-commutative66.5%
Simplified66.5%
Taylor expanded in x around 0 53.9%
neg-mul-153.9%
distribute-lft-neg-in53.9%
Simplified53.9%
if -3.89999999999999985e-81 < z < 3.6399999999999999e-148 or 5.29999999999999987e-74 < z < 4.8e5Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 62.9%
Final simplification60.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.3e+162) (not (<= z 2.4e+167))) (/ y (- a (/ t z))) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+162) || !(z <= 2.4e+167)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-3.3d+162)) .or. (.not. (z <= 2.4d+167))) then
tmp = y / (a - (t / z))
else
tmp = (x - (z * y)) / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+162) || !(z <= 2.4e+167)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.3e+162) or not (z <= 2.4e+167): tmp = y / (a - (t / z)) else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.3e+162) || !(z <= 2.4e+167)) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.3e+162) || ~((z <= 2.4e+167))) tmp = y / (a - (t / z)); else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.3e+162], N[Not[LessEqual[z, 2.4e+167]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+162} \lor \neg \left(z \leq 2.4 \cdot 10^{+167}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -3.29999999999999987e162 or 2.39999999999999999e167 < z Initial program 48.3%
sub-neg48.3%
+-commutative48.3%
neg-sub048.3%
associate-+l-48.3%
sub0-neg48.3%
neg-mul-148.3%
sub-neg48.3%
+-commutative48.3%
neg-sub048.3%
associate-+l-48.3%
sub0-neg48.3%
neg-mul-148.3%
times-frac48.3%
metadata-eval48.3%
*-lft-identity48.3%
*-commutative48.3%
Simplified48.3%
div-sub48.3%
associate-/l*70.5%
Applied egg-rr70.5%
Taylor expanded in z around 0 98.1%
mul-1-neg98.1%
unsub-neg98.1%
Simplified98.1%
Taylor expanded in y around inf 93.6%
if -3.29999999999999987e162 < z < 2.39999999999999999e167Initial program 94.7%
Final simplification94.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -7e-90)
(/ (- y (/ x z)) a)
(if (<= z 8.5e-73)
(/ (- x (* z y)) t)
(if (<= z 7000000000000.0) (/ (- x) (- (* z a) t)) (/ y (- a (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e-90) {
tmp = (y - (x / z)) / a;
} else if (z <= 8.5e-73) {
tmp = (x - (z * y)) / t;
} else if (z <= 7000000000000.0) {
tmp = -x / ((z * a) - t);
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-7d-90)) then
tmp = (y - (x / z)) / a
else if (z <= 8.5d-73) then
tmp = (x - (z * y)) / t
else if (z <= 7000000000000.0d0) then
tmp = -x / ((z * a) - t)
else
tmp = y / (a - (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e-90) {
tmp = (y - (x / z)) / a;
} else if (z <= 8.5e-73) {
tmp = (x - (z * y)) / t;
} else if (z <= 7000000000000.0) {
tmp = -x / ((z * a) - t);
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7e-90: tmp = (y - (x / z)) / a elif z <= 8.5e-73: tmp = (x - (z * y)) / t elif z <= 7000000000000.0: tmp = -x / ((z * a) - t) else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7e-90) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 8.5e-73) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 7000000000000.0) tmp = Float64(Float64(-x) / Float64(Float64(z * a) - t)); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7e-90) tmp = (y - (x / z)) / a; elseif (z <= 8.5e-73) tmp = (x - (z * y)) / t; elseif (z <= 7000000000000.0) tmp = -x / ((z * a) - t); else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7e-90], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 8.5e-73], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 7000000000000.0], N[((-x) / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-90}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-73}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 7000000000000:\\
\;\;\;\;\frac{-x}{z \cdot a - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -6.9999999999999997e-90Initial program 75.4%
sub-neg75.4%
+-commutative75.4%
neg-sub075.4%
associate-+l-75.4%
sub0-neg75.4%
neg-mul-175.4%
sub-neg75.4%
+-commutative75.4%
neg-sub075.4%
associate-+l-75.4%
sub0-neg75.4%
neg-mul-175.4%
times-frac75.4%
metadata-eval75.4%
*-lft-identity75.4%
*-commutative75.4%
Simplified75.4%
div-sub75.4%
associate-/l*88.3%
Applied egg-rr88.3%
Taylor expanded in a around inf 75.6%
if -6.9999999999999997e-90 < z < 8.4999999999999996e-73Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around 0 80.2%
associate-*r/80.2%
neg-mul-180.2%
neg-sub080.2%
sub-neg80.2%
+-commutative80.2%
associate--r+80.2%
neg-sub080.2%
remove-double-neg80.2%
*-commutative80.2%
Simplified80.2%
if 8.4999999999999996e-73 < z < 7e12Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 78.8%
neg-mul-178.8%
Simplified78.8%
if 7e12 < z Initial program 67.0%
sub-neg67.0%
+-commutative67.0%
neg-sub067.0%
associate-+l-67.0%
sub0-neg67.0%
neg-mul-167.0%
sub-neg67.0%
+-commutative67.0%
neg-sub067.0%
associate-+l-67.0%
sub0-neg67.0%
neg-mul-167.0%
times-frac67.0%
metadata-eval67.0%
*-lft-identity67.0%
*-commutative67.0%
Simplified67.0%
div-sub67.0%
associate-/l*77.5%
Applied egg-rr77.5%
Taylor expanded in z around 0 97.0%
mul-1-neg97.0%
unsub-neg97.0%
Simplified97.0%
Taylor expanded in y around inf 80.6%
Final simplification79.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.8e-84) (not (<= z 3.64e-148))) (/ y (- a (/ t z))) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.8e-84) || !(z <= 3.64e-148)) {
tmp = y / (a - (t / z));
} else {
tmp = x / t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-7.8d-84)) .or. (.not. (z <= 3.64d-148))) then
tmp = y / (a - (t / z))
else
tmp = x / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.8e-84) || !(z <= 3.64e-148)) {
tmp = y / (a - (t / z));
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.8e-84) or not (z <= 3.64e-148): tmp = y / (a - (t / z)) else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.8e-84) || !(z <= 3.64e-148)) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.8e-84) || ~((z <= 3.64e-148))) tmp = y / (a - (t / z)); else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.8e-84], N[Not[LessEqual[z, 3.64e-148]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-84} \lor \neg \left(z \leq 3.64 \cdot 10^{-148}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -7.80000000000000045e-84 or 3.6399999999999999e-148 < z Initial program 77.4%
sub-neg77.4%
+-commutative77.4%
neg-sub077.4%
associate-+l-77.4%
sub0-neg77.4%
neg-mul-177.4%
sub-neg77.4%
+-commutative77.4%
neg-sub077.4%
associate-+l-77.4%
sub0-neg77.4%
neg-mul-177.4%
times-frac77.4%
metadata-eval77.4%
*-lft-identity77.4%
*-commutative77.4%
Simplified77.4%
div-sub77.4%
associate-/l*84.9%
Applied egg-rr84.9%
Taylor expanded in z around 0 95.9%
mul-1-neg95.9%
unsub-neg95.9%
Simplified95.9%
Taylor expanded in y around inf 69.6%
if -7.80000000000000045e-84 < z < 3.6399999999999999e-148Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 64.8%
Final simplification68.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.8e-81) (not (<= z 2.45))) (/ y (- a (/ t z))) (/ (- x (* z y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.8e-81) || !(z <= 2.45)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-6.8d-81)) .or. (.not. (z <= 2.45d0))) then
tmp = y / (a - (t / z))
else
tmp = (x - (z * y)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.8e-81) || !(z <= 2.45)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.8e-81) or not (z <= 2.45): tmp = y / (a - (t / z)) else: tmp = (x - (z * y)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.8e-81) || !(z <= 2.45)) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(Float64(x - Float64(z * y)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.8e-81) || ~((z <= 2.45))) tmp = y / (a - (t / z)); else tmp = (x - (z * y)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.8e-81], N[Not[LessEqual[z, 2.45]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-81} \lor \neg \left(z \leq 2.45\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\end{array}
\end{array}
if z < -6.7999999999999997e-81 or 2.4500000000000002 < z Initial program 71.7%
sub-neg71.7%
+-commutative71.7%
neg-sub071.7%
associate-+l-71.7%
sub0-neg71.7%
neg-mul-171.7%
sub-neg71.7%
+-commutative71.7%
neg-sub071.7%
associate-+l-71.7%
sub0-neg71.7%
neg-mul-171.7%
times-frac71.7%
metadata-eval71.7%
*-lft-identity71.7%
*-commutative71.7%
Simplified71.7%
div-sub71.7%
associate-/l*83.2%
Applied egg-rr83.2%
Taylor expanded in z around 0 97.0%
mul-1-neg97.0%
unsub-neg97.0%
Simplified97.0%
Taylor expanded in y around inf 76.3%
if -6.7999999999999997e-81 < z < 2.4500000000000002Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around 0 76.6%
associate-*r/76.6%
neg-mul-176.6%
neg-sub076.6%
sub-neg76.6%
+-commutative76.6%
associate--r+76.6%
neg-sub076.6%
remove-double-neg76.6%
*-commutative76.6%
Simplified76.6%
Final simplification76.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.4e-90) (/ (- y (/ x z)) a) (if (<= z 2.1) (/ (- x (* z y)) t) (/ y (- a (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e-90) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.1) {
tmp = (x - (z * y)) / t;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-4.4d-90)) then
tmp = (y - (x / z)) / a
else if (z <= 2.1d0) then
tmp = (x - (z * y)) / t
else
tmp = y / (a - (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e-90) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.1) {
tmp = (x - (z * y)) / t;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.4e-90: tmp = (y - (x / z)) / a elif z <= 2.1: tmp = (x - (z * y)) / t else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.4e-90) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 2.1) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.4e-90) tmp = (y - (x / z)) / a; elseif (z <= 2.1) tmp = (x - (z * y)) / t; else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e-90], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 2.1], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-90}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 2.1:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -4.39999999999999972e-90Initial program 75.4%
sub-neg75.4%
+-commutative75.4%
neg-sub075.4%
associate-+l-75.4%
sub0-neg75.4%
neg-mul-175.4%
sub-neg75.4%
+-commutative75.4%
neg-sub075.4%
associate-+l-75.4%
sub0-neg75.4%
neg-mul-175.4%
times-frac75.4%
metadata-eval75.4%
*-lft-identity75.4%
*-commutative75.4%
Simplified75.4%
div-sub75.4%
associate-/l*88.3%
Applied egg-rr88.3%
Taylor expanded in a around inf 75.6%
if -4.39999999999999972e-90 < z < 2.10000000000000009Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around 0 77.1%
associate-*r/77.1%
neg-mul-177.1%
neg-sub077.1%
sub-neg77.1%
+-commutative77.1%
associate--r+77.1%
neg-sub077.1%
remove-double-neg77.1%
*-commutative77.1%
Simplified77.1%
if 2.10000000000000009 < z Initial program 68.9%
sub-neg68.9%
+-commutative68.9%
neg-sub068.9%
associate-+l-68.9%
sub0-neg68.9%
neg-mul-168.9%
sub-neg68.9%
+-commutative68.9%
neg-sub068.9%
associate-+l-68.9%
sub0-neg68.9%
neg-mul-168.9%
times-frac68.9%
metadata-eval68.9%
*-lft-identity68.9%
*-commutative68.9%
Simplified68.9%
div-sub68.9%
associate-/l*78.8%
Applied egg-rr78.8%
Taylor expanded in z around 0 97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
Taylor expanded in y around inf 78.9%
Final simplification77.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -23.5) (/ y a) (if (<= z 6500.0) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -23.5) {
tmp = y / a;
} else if (z <= 6500.0) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-23.5d0)) then
tmp = y / a
else if (z <= 6500.0d0) then
tmp = x / t
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -23.5) {
tmp = y / a;
} else if (z <= 6500.0) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -23.5: tmp = y / a elif z <= 6500.0: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -23.5) tmp = Float64(y / a); elseif (z <= 6500.0) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -23.5) tmp = y / a; elseif (z <= 6500.0) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -23.5], N[(y / a), $MachinePrecision], If[LessEqual[z, 6500.0], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -23.5:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 6500:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -23.5 or 6500 < z Initial program 68.9%
sub-neg68.9%
+-commutative68.9%
neg-sub068.9%
associate-+l-68.9%
sub0-neg68.9%
neg-mul-168.9%
sub-neg68.9%
+-commutative68.9%
neg-sub068.9%
associate-+l-68.9%
sub0-neg68.9%
neg-mul-168.9%
times-frac68.9%
metadata-eval68.9%
*-lft-identity68.9%
*-commutative68.9%
Simplified68.9%
Taylor expanded in z around inf 58.5%
if -23.5 < z < 6500Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 55.4%
Final simplification56.9%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 85.1%
sub-neg85.1%
+-commutative85.1%
neg-sub085.1%
associate-+l-85.1%
sub0-neg85.1%
neg-mul-185.1%
sub-neg85.1%
+-commutative85.1%
neg-sub085.1%
associate-+l-85.1%
sub0-neg85.1%
neg-mul-185.1%
times-frac85.1%
metadata-eval85.1%
*-lft-identity85.1%
*-commutative85.1%
Simplified85.1%
Taylor expanded in z around 0 33.6%
Final simplification33.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / 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 a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2023181
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< z -32113435955957344.0) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))
(/ (- x (* y z)) (- t (* a z))))