
(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 8 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.65e+55) (not (<= z 6.6e+118))) (/ (- y (/ x z)) a) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e+55) || !(z <= 6.6e+118)) {
tmp = (y - (x / z)) / a;
} 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.65d+55)) .or. (.not. (z <= 6.6d+118))) then
tmp = (y - (x / z)) / a
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.65e+55) || !(z <= 6.6e+118)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.65e+55) or not (z <= 6.6e+118): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.65e+55) || !(z <= 6.6e+118)) tmp = Float64(Float64(y - Float64(x / z)) / a); 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.65e+55) || ~((z <= 6.6e+118))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.65e+55], N[Not[LessEqual[z, 6.6e+118]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $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.65 \cdot 10^{+55} \lor \neg \left(z \leq 6.6 \cdot 10^{+118}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.65e55 or 6.6e118 < z Initial program 51.8%
sub-neg51.8%
+-commutative51.8%
neg-sub051.8%
associate-+l-51.8%
sub0-neg51.8%
neg-mul-151.8%
sub-neg51.8%
+-commutative51.8%
neg-sub051.8%
associate-+l-51.8%
sub0-neg51.8%
neg-mul-151.8%
times-frac51.8%
metadata-eval51.8%
*-lft-identity51.8%
*-commutative51.8%
Simplified51.8%
Taylor expanded in y around 0 51.8%
Taylor expanded in a around inf 88.9%
mul-1-neg88.9%
sub-neg88.9%
Simplified88.9%
if -1.65e55 < z < 6.6e118Initial program 96.5%
Final simplification94.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -9.6e+47)
t_1
(if (<= z -8.6e-49)
(/ (- x (* z y)) t)
(if (or (<= z -9.2e-78) (not (<= z 15200000000.0)))
t_1
(/ (- x) (- (* z a) t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -9.6e+47) {
tmp = t_1;
} else if (z <= -8.6e-49) {
tmp = (x - (z * y)) / t;
} else if ((z <= -9.2e-78) || !(z <= 15200000000.0)) {
tmp = t_1;
} else {
tmp = -x / ((z * a) - 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) :: t_1
real(8) :: tmp
t_1 = (y - (x / z)) / a
if (z <= (-9.6d+47)) then
tmp = t_1
else if (z <= (-8.6d-49)) then
tmp = (x - (z * y)) / t
else if ((z <= (-9.2d-78)) .or. (.not. (z <= 15200000000.0d0))) then
tmp = t_1
else
tmp = -x / ((z * a) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -9.6e+47) {
tmp = t_1;
} else if (z <= -8.6e-49) {
tmp = (x - (z * y)) / t;
} else if ((z <= -9.2e-78) || !(z <= 15200000000.0)) {
tmp = t_1;
} else {
tmp = -x / ((z * a) - t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -9.6e+47: tmp = t_1 elif z <= -8.6e-49: tmp = (x - (z * y)) / t elif (z <= -9.2e-78) or not (z <= 15200000000.0): tmp = t_1 else: tmp = -x / ((z * a) - t) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -9.6e+47) tmp = t_1; elseif (z <= -8.6e-49) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif ((z <= -9.2e-78) || !(z <= 15200000000.0)) tmp = t_1; else tmp = Float64(Float64(-x) / Float64(Float64(z * a) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; tmp = 0.0; if (z <= -9.6e+47) tmp = t_1; elseif (z <= -8.6e-49) tmp = (x - (z * y)) / t; elseif ((z <= -9.2e-78) || ~((z <= 15200000000.0))) tmp = t_1; else tmp = -x / ((z * a) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -9.6e+47], t$95$1, If[LessEqual[z, -8.6e-49], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[z, -9.2e-78], N[Not[LessEqual[z, 15200000000.0]], $MachinePrecision]], t$95$1, N[((-x) / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -9.6 \cdot 10^{+47}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -8.6 \cdot 10^{-49}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq -9.2 \cdot 10^{-78} \lor \neg \left(z \leq 15200000000\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z \cdot a - t}\\
\end{array}
\end{array}
if z < -9.60000000000000075e47 or -8.60000000000000033e-49 < z < -9.2000000000000007e-78 or 1.52e10 < z Initial program 62.5%
sub-neg62.5%
+-commutative62.5%
neg-sub062.5%
associate-+l-62.5%
sub0-neg62.5%
neg-mul-162.5%
sub-neg62.5%
+-commutative62.5%
neg-sub062.5%
associate-+l-62.5%
sub0-neg62.5%
neg-mul-162.5%
times-frac62.5%
metadata-eval62.5%
*-lft-identity62.5%
*-commutative62.5%
Simplified62.5%
Taylor expanded in y around 0 62.5%
Taylor expanded in a around inf 85.0%
mul-1-neg85.0%
sub-neg85.0%
Simplified85.0%
if -9.60000000000000075e47 < z < -8.60000000000000033e-49Initial program 95.6%
sub-neg95.6%
+-commutative95.6%
neg-sub095.6%
associate-+l-95.6%
sub0-neg95.6%
neg-mul-195.6%
sub-neg95.6%
+-commutative95.6%
neg-sub095.6%
associate-+l-95.6%
sub0-neg95.6%
neg-mul-195.6%
times-frac95.6%
metadata-eval95.6%
*-lft-identity95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in a around 0 62.1%
associate-*r/62.1%
neg-mul-162.1%
neg-sub062.1%
sub-neg62.1%
+-commutative62.1%
associate--r+62.1%
neg-sub062.1%
remove-double-neg62.1%
*-commutative62.1%
Simplified62.1%
if -9.2000000000000007e-78 < z < 1.52e10Initial 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 y around 0 79.3%
neg-mul-179.3%
Simplified79.3%
Final simplification80.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -1.32e+48)
t_1
(if (<= z -1.6e-49)
(/ (- x (* z y)) t)
(if (<= z -3.3e-84)
(- (/ y a) (/ (/ x a) z))
(if (<= z 16200000000.0) (/ (- x) (- (* z a) t)) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -1.32e+48) {
tmp = t_1;
} else if (z <= -1.6e-49) {
tmp = (x - (z * y)) / t;
} else if (z <= -3.3e-84) {
tmp = (y / a) - ((x / a) / z);
} else if (z <= 16200000000.0) {
tmp = -x / ((z * a) - t);
} else {
tmp = t_1;
}
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 = (y - (x / z)) / a
if (z <= (-1.32d+48)) then
tmp = t_1
else if (z <= (-1.6d-49)) then
tmp = (x - (z * y)) / t
else if (z <= (-3.3d-84)) then
tmp = (y / a) - ((x / a) / z)
else if (z <= 16200000000.0d0) then
tmp = -x / ((z * a) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -1.32e+48) {
tmp = t_1;
} else if (z <= -1.6e-49) {
tmp = (x - (z * y)) / t;
} else if (z <= -3.3e-84) {
tmp = (y / a) - ((x / a) / z);
} else if (z <= 16200000000.0) {
tmp = -x / ((z * a) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -1.32e+48: tmp = t_1 elif z <= -1.6e-49: tmp = (x - (z * y)) / t elif z <= -3.3e-84: tmp = (y / a) - ((x / a) / z) elif z <= 16200000000.0: tmp = -x / ((z * a) - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -1.32e+48) tmp = t_1; elseif (z <= -1.6e-49) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= -3.3e-84) tmp = Float64(Float64(y / a) - Float64(Float64(x / a) / z)); elseif (z <= 16200000000.0) tmp = Float64(Float64(-x) / Float64(Float64(z * a) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; tmp = 0.0; if (z <= -1.32e+48) tmp = t_1; elseif (z <= -1.6e-49) tmp = (x - (z * y)) / t; elseif (z <= -3.3e-84) tmp = (y / a) - ((x / a) / z); elseif (z <= 16200000000.0) tmp = -x / ((z * a) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -1.32e+48], t$95$1, If[LessEqual[z, -1.6e-49], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, -3.3e-84], N[(N[(y / a), $MachinePrecision] - N[(N[(x / a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 16200000000.0], N[((-x) / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -1.32 \cdot 10^{+48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-49}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-84}:\\
\;\;\;\;\frac{y}{a} - \frac{\frac{x}{a}}{z}\\
\mathbf{elif}\;z \leq 16200000000:\\
\;\;\;\;\frac{-x}{z \cdot a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.32e48 or 1.62e10 < z Initial program 61.2%
sub-neg61.2%
+-commutative61.2%
neg-sub061.2%
associate-+l-61.2%
sub0-neg61.2%
neg-mul-161.2%
sub-neg61.2%
+-commutative61.2%
neg-sub061.2%
associate-+l-61.2%
sub0-neg61.2%
neg-mul-161.2%
times-frac61.2%
metadata-eval61.2%
*-lft-identity61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in y around 0 61.2%
Taylor expanded in a around inf 85.3%
mul-1-neg85.3%
sub-neg85.3%
Simplified85.3%
if -1.32e48 < z < -1.60000000000000001e-49Initial program 95.6%
sub-neg95.6%
+-commutative95.6%
neg-sub095.6%
associate-+l-95.6%
sub0-neg95.6%
neg-mul-195.6%
sub-neg95.6%
+-commutative95.6%
neg-sub095.6%
associate-+l-95.6%
sub0-neg95.6%
neg-mul-195.6%
times-frac95.6%
metadata-eval95.6%
*-lft-identity95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in a around 0 62.1%
associate-*r/62.1%
neg-mul-162.1%
neg-sub062.1%
sub-neg62.1%
+-commutative62.1%
associate--r+62.1%
neg-sub062.1%
remove-double-neg62.1%
*-commutative62.1%
Simplified62.1%
if -1.60000000000000001e-49 < z < -3.29999999999999984e-84Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
times-frac99.7%
metadata-eval99.7%
*-lft-identity99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in z around inf 67.2%
mul-1-neg67.2%
+-commutative67.2%
associate--l+67.2%
associate-/r*67.2%
distribute-neg-frac67.2%
mul-1-neg67.2%
associate-/r*67.2%
associate-*r/67.2%
div-sub67.2%
distribute-lft-out--67.2%
associate-*r/67.2%
Simplified67.2%
Taylor expanded in x around inf 84.0%
if -3.29999999999999984e-84 < z < 1.62e10Initial 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 y around 0 79.8%
neg-mul-179.8%
Simplified79.8%
Final simplification80.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.25e+48)
(/ y a)
(if (<= z -4e-49)
(/ (* z (- y)) t)
(if (or (<= z -1.9e-79) (not (<= z 3.9e+21))) (/ y a) (/ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.25e+48) {
tmp = y / a;
} else if (z <= -4e-49) {
tmp = (z * -y) / t;
} else if ((z <= -1.9e-79) || !(z <= 3.9e+21)) {
tmp = y / a;
} 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 <= (-2.25d+48)) then
tmp = y / a
else if (z <= (-4d-49)) then
tmp = (z * -y) / t
else if ((z <= (-1.9d-79)) .or. (.not. (z <= 3.9d+21))) then
tmp = y / a
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 <= -2.25e+48) {
tmp = y / a;
} else if (z <= -4e-49) {
tmp = (z * -y) / t;
} else if ((z <= -1.9e-79) || !(z <= 3.9e+21)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.25e+48: tmp = y / a elif z <= -4e-49: tmp = (z * -y) / t elif (z <= -1.9e-79) or not (z <= 3.9e+21): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.25e+48) tmp = Float64(y / a); elseif (z <= -4e-49) tmp = Float64(Float64(z * Float64(-y)) / t); elseif ((z <= -1.9e-79) || !(z <= 3.9e+21)) tmp = Float64(y / a); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.25e+48) tmp = y / a; elseif (z <= -4e-49) tmp = (z * -y) / t; elseif ((z <= -1.9e-79) || ~((z <= 3.9e+21))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.25e+48], N[(y / a), $MachinePrecision], If[LessEqual[z, -4e-49], N[(N[(z * (-y)), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[z, -1.9e-79], N[Not[LessEqual[z, 3.9e+21]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+48}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-49}:\\
\;\;\;\;\frac{z \cdot \left(-y\right)}{t}\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-79} \lor \neg \left(z \leq 3.9 \cdot 10^{+21}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -2.24999999999999998e48 or -3.99999999999999975e-49 < z < -1.9000000000000001e-79 or 3.9e21 < z Initial program 62.2%
sub-neg62.2%
+-commutative62.2%
neg-sub062.2%
associate-+l-62.2%
sub0-neg62.2%
neg-mul-162.2%
sub-neg62.2%
+-commutative62.2%
neg-sub062.2%
associate-+l-62.2%
sub0-neg62.2%
neg-mul-162.2%
times-frac62.2%
metadata-eval62.2%
*-lft-identity62.2%
*-commutative62.2%
Simplified62.2%
Taylor expanded in z around inf 65.1%
if -2.24999999999999998e48 < z < -3.99999999999999975e-49Initial program 95.6%
sub-neg95.6%
+-commutative95.6%
neg-sub095.6%
associate-+l-95.6%
sub0-neg95.6%
neg-mul-195.6%
sub-neg95.6%
+-commutative95.6%
neg-sub095.6%
associate-+l-95.6%
sub0-neg95.6%
neg-mul-195.6%
times-frac95.6%
metadata-eval95.6%
*-lft-identity95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in y around inf 60.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in z around 0 50.1%
mul-1-neg50.1%
Simplified50.1%
if -1.9000000000000001e-79 < z < 3.9e21Initial 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 59.3%
Final simplification61.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.5e+47) (not (<= z 12000000000.0))) (/ (- y (/ x z)) a) (/ (- x (* z y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+47) || !(z <= 12000000000.0)) {
tmp = (y - (x / z)) / a;
} 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 <= (-9.5d+47)) .or. (.not. (z <= 12000000000.0d0))) then
tmp = (y - (x / z)) / a
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 <= -9.5e+47) || !(z <= 12000000000.0)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.5e+47) or not (z <= 12000000000.0): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+47) || !(z <= 12000000000.0)) tmp = Float64(Float64(y - Float64(x / z)) / a); 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 <= -9.5e+47) || ~((z <= 12000000000.0))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.5e+47], N[Not[LessEqual[z, 12000000000.0]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+47} \lor \neg \left(z \leq 12000000000\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\end{array}
\end{array}
if z < -9.50000000000000001e47 or 1.2e10 < z Initial program 61.2%
sub-neg61.2%
+-commutative61.2%
neg-sub061.2%
associate-+l-61.2%
sub0-neg61.2%
neg-mul-161.2%
sub-neg61.2%
+-commutative61.2%
neg-sub061.2%
associate-+l-61.2%
sub0-neg61.2%
neg-mul-161.2%
times-frac61.2%
metadata-eval61.2%
*-lft-identity61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in y around 0 61.2%
Taylor expanded in a around inf 85.3%
mul-1-neg85.3%
sub-neg85.3%
Simplified85.3%
if -9.50000000000000001e47 < z < 1.2e10Initial program 99.1%
sub-neg99.1%
+-commutative99.1%
neg-sub099.1%
associate-+l-99.1%
sub0-neg99.1%
neg-mul-199.1%
sub-neg99.1%
+-commutative99.1%
neg-sub099.1%
associate-+l-99.1%
sub0-neg99.1%
neg-mul-199.1%
times-frac99.1%
metadata-eval99.1%
*-lft-identity99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in a around 0 70.9%
associate-*r/70.9%
neg-mul-170.9%
neg-sub070.9%
sub-neg70.9%
+-commutative70.9%
associate--r+70.9%
neg-sub070.9%
remove-double-neg70.9%
*-commutative70.9%
Simplified70.9%
Final simplification77.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.6e+54) (/ y a) (if (<= z 1.52e+16) (/ (- x (* z y)) t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+54) {
tmp = y / a;
} else if (z <= 1.52e+16) {
tmp = (x - (z * y)) / 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 <= (-1.6d+54)) then
tmp = y / a
else if (z <= 1.52d+16) then
tmp = (x - (z * y)) / 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 <= -1.6e+54) {
tmp = y / a;
} else if (z <= 1.52e+16) {
tmp = (x - (z * y)) / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.6e+54: tmp = y / a elif z <= 1.52e+16: tmp = (x - (z * y)) / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e+54) tmp = Float64(y / a); elseif (z <= 1.52e+16) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.6e+54) tmp = y / a; elseif (z <= 1.52e+16) tmp = (x - (z * y)) / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e+54], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.52e+16], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+54}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.52 \cdot 10^{+16}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.6e54 or 1.52e16 < z Initial program 60.9%
sub-neg60.9%
+-commutative60.9%
neg-sub060.9%
associate-+l-60.9%
sub0-neg60.9%
neg-mul-160.9%
sub-neg60.9%
+-commutative60.9%
neg-sub060.9%
associate-+l-60.9%
sub0-neg60.9%
neg-mul-160.9%
times-frac60.9%
metadata-eval60.9%
*-lft-identity60.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in z around inf 64.7%
if -1.6e54 < z < 1.52e16Initial program 99.1%
sub-neg99.1%
+-commutative99.1%
neg-sub099.1%
associate-+l-99.1%
sub0-neg99.1%
neg-mul-199.1%
sub-neg99.1%
+-commutative99.1%
neg-sub099.1%
associate-+l-99.1%
sub0-neg99.1%
neg-mul-199.1%
times-frac99.1%
metadata-eval99.1%
*-lft-identity99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in a around 0 70.4%
associate-*r/70.4%
neg-mul-170.4%
neg-sub070.4%
sub-neg70.4%
+-commutative70.4%
associate--r+70.4%
neg-sub070.4%
remove-double-neg70.4%
*-commutative70.4%
Simplified70.4%
Final simplification67.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2e-79) (/ y a) (if (<= z 2.2e+16) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2e-79) {
tmp = y / a;
} else if (z <= 2.2e+16) {
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 <= (-2d-79)) then
tmp = y / a
else if (z <= 2.2d+16) 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 <= -2e-79) {
tmp = y / a;
} else if (z <= 2.2e+16) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2e-79: tmp = y / a elif z <= 2.2e+16: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2e-79) tmp = Float64(y / a); elseif (z <= 2.2e+16) 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 <= -2e-79) tmp = y / a; elseif (z <= 2.2e+16) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2e-79], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.2e+16], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-79}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2e-79 or 2.2e16 < z Initial program 67.6%
sub-neg67.6%
+-commutative67.6%
neg-sub067.6%
associate-+l-67.6%
sub0-neg67.6%
neg-mul-167.6%
sub-neg67.6%
+-commutative67.6%
neg-sub067.6%
associate-+l-67.6%
sub0-neg67.6%
neg-mul-167.6%
times-frac67.6%
metadata-eval67.6%
*-lft-identity67.6%
*-commutative67.6%
Simplified67.6%
Taylor expanded in z around inf 59.0%
if -2e-79 < z < 2.2e16Initial 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 59.3%
Final simplification59.1%
(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 81.8%
sub-neg81.8%
+-commutative81.8%
neg-sub081.8%
associate-+l-81.8%
sub0-neg81.8%
neg-mul-181.8%
sub-neg81.8%
+-commutative81.8%
neg-sub081.8%
associate-+l-81.8%
sub0-neg81.8%
neg-mul-181.8%
times-frac81.8%
metadata-eval81.8%
*-lft-identity81.8%
*-commutative81.8%
Simplified81.8%
Taylor expanded in z around 0 31.7%
Final simplification31.7%
(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 2023221
(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))))