
(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 -4.2e+109) (not (<= z 3.8e+83))) (/ (- y (/ x z)) a) (+ (/ (* z y) (- (* z a) t)) (/ x (- t (* z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e+109) || !(z <= 3.8e+83)) {
tmp = (y - (x / z)) / a;
} else {
tmp = ((z * y) / ((z * a) - t)) + (x / (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 <= (-4.2d+109)) .or. (.not. (z <= 3.8d+83))) then
tmp = (y - (x / z)) / a
else
tmp = ((z * y) / ((z * a) - t)) + (x / (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 <= -4.2e+109) || !(z <= 3.8e+83)) {
tmp = (y - (x / z)) / a;
} else {
tmp = ((z * y) / ((z * a) - t)) + (x / (t - (z * a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.2e+109) or not (z <= 3.8e+83): tmp = (y - (x / z)) / a else: tmp = ((z * y) / ((z * a) - t)) + (x / (t - (z * a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.2e+109) || !(z <= 3.8e+83)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(Float64(z * y) / Float64(Float64(z * a) - t)) + Float64(x / Float64(t - Float64(z * a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.2e+109) || ~((z <= 3.8e+83))) tmp = (y - (x / z)) / a; else tmp = ((z * y) / ((z * a) - t)) + (x / (t - (z * a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.2e+109], N[Not[LessEqual[z, 3.8e+83]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+109} \lor \neg \left(z \leq 3.8 \cdot 10^{+83}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{z \cdot a - t} + \frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -4.2000000000000003e109 or 3.8000000000000002e83 < z Initial program 60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in x around 0 59.0%
*-commutative59.0%
*-commutative59.0%
*-un-lft-identity59.0%
times-frac66.6%
Applied egg-rr66.6%
Taylor expanded in a around inf 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
if -4.2000000000000003e109 < z < 3.8000000000000002e83Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 98.7%
Final simplification93.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* z y)) t)) (t_2 (/ x (- t (* z a)))))
(if (<= z -620000.0)
(/ y a)
(if (<= z -1.05e-134)
t_2
(if (<= z 3e-181)
t_1
(if (<= z 6.2e-20) t_2 (if (<= z 4.2e+33) t_1 (/ y a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (z * y)) / t;
double t_2 = x / (t - (z * a));
double tmp;
if (z <= -620000.0) {
tmp = y / a;
} else if (z <= -1.05e-134) {
tmp = t_2;
} else if (z <= 3e-181) {
tmp = t_1;
} else if (z <= 6.2e-20) {
tmp = t_2;
} else if (z <= 4.2e+33) {
tmp = t_1;
} 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) :: t_2
real(8) :: tmp
t_1 = (x - (z * y)) / t
t_2 = x / (t - (z * a))
if (z <= (-620000.0d0)) then
tmp = y / a
else if (z <= (-1.05d-134)) then
tmp = t_2
else if (z <= 3d-181) then
tmp = t_1
else if (z <= 6.2d-20) then
tmp = t_2
else if (z <= 4.2d+33) then
tmp = t_1
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 = (x - (z * y)) / t;
double t_2 = x / (t - (z * a));
double tmp;
if (z <= -620000.0) {
tmp = y / a;
} else if (z <= -1.05e-134) {
tmp = t_2;
} else if (z <= 3e-181) {
tmp = t_1;
} else if (z <= 6.2e-20) {
tmp = t_2;
} else if (z <= 4.2e+33) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (z * y)) / t t_2 = x / (t - (z * a)) tmp = 0 if z <= -620000.0: tmp = y / a elif z <= -1.05e-134: tmp = t_2 elif z <= 3e-181: tmp = t_1 elif z <= 6.2e-20: tmp = t_2 elif z <= 4.2e+33: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(z * y)) / t) t_2 = Float64(x / Float64(t - Float64(z * a))) tmp = 0.0 if (z <= -620000.0) tmp = Float64(y / a); elseif (z <= -1.05e-134) tmp = t_2; elseif (z <= 3e-181) tmp = t_1; elseif (z <= 6.2e-20) tmp = t_2; elseif (z <= 4.2e+33) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (z * y)) / t; t_2 = x / (t - (z * a)); tmp = 0.0; if (z <= -620000.0) tmp = y / a; elseif (z <= -1.05e-134) tmp = t_2; elseif (z <= 3e-181) tmp = t_1; elseif (z <= 6.2e-20) tmp = t_2; elseif (z <= 4.2e+33) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -620000.0], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.05e-134], t$95$2, If[LessEqual[z, 3e-181], t$95$1, If[LessEqual[z, 6.2e-20], t$95$2, If[LessEqual[z, 4.2e+33], t$95$1, N[(y / a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - z \cdot y}{t}\\
t_2 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;z \leq -620000:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-134}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-181}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-20}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -6.2e5 or 4.2000000000000001e33 < z Initial program 69.6%
*-commutative69.6%
Simplified69.6%
Taylor expanded in z around inf 59.6%
if -6.2e5 < z < -1.05e-134 or 2.99999999999999974e-181 < z < 6.19999999999999999e-20Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 79.7%
*-commutative79.7%
Simplified79.7%
if -1.05e-134 < z < 2.99999999999999974e-181 or 6.19999999999999999e-20 < z < 4.2000000000000001e33Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 94.0%
Final simplification74.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* z a))))
(t_2 (/ (- y (/ x z)) a))
(t_3 (/ (- x (* z y)) t)))
(if (<= z -0.16)
t_2
(if (<= z -8.2e-134)
t_1
(if (<= z 1.02e-185)
t_3
(if (<= z 7.6e-20) t_1 (if (<= z 3.5e+29) t_3 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double t_2 = (y - (x / z)) / a;
double t_3 = (x - (z * y)) / t;
double tmp;
if (z <= -0.16) {
tmp = t_2;
} else if (z <= -8.2e-134) {
tmp = t_1;
} else if (z <= 1.02e-185) {
tmp = t_3;
} else if (z <= 7.6e-20) {
tmp = t_1;
} else if (z <= 3.5e+29) {
tmp = t_3;
} 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) :: t_3
real(8) :: tmp
t_1 = x / (t - (z * a))
t_2 = (y - (x / z)) / a
t_3 = (x - (z * y)) / t
if (z <= (-0.16d0)) then
tmp = t_2
else if (z <= (-8.2d-134)) then
tmp = t_1
else if (z <= 1.02d-185) then
tmp = t_3
else if (z <= 7.6d-20) then
tmp = t_1
else if (z <= 3.5d+29) then
tmp = t_3
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 = x / (t - (z * a));
double t_2 = (y - (x / z)) / a;
double t_3 = (x - (z * y)) / t;
double tmp;
if (z <= -0.16) {
tmp = t_2;
} else if (z <= -8.2e-134) {
tmp = t_1;
} else if (z <= 1.02e-185) {
tmp = t_3;
} else if (z <= 7.6e-20) {
tmp = t_1;
} else if (z <= 3.5e+29) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x / (t - (z * a)) t_2 = (y - (x / z)) / a t_3 = (x - (z * y)) / t tmp = 0 if z <= -0.16: tmp = t_2 elif z <= -8.2e-134: tmp = t_1 elif z <= 1.02e-185: tmp = t_3 elif z <= 7.6e-20: tmp = t_1 elif z <= 3.5e+29: tmp = t_3 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(z * a))) t_2 = Float64(Float64(y - Float64(x / z)) / a) t_3 = Float64(Float64(x - Float64(z * y)) / t) tmp = 0.0 if (z <= -0.16) tmp = t_2; elseif (z <= -8.2e-134) tmp = t_1; elseif (z <= 1.02e-185) tmp = t_3; elseif (z <= 7.6e-20) tmp = t_1; elseif (z <= 3.5e+29) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x / (t - (z * a)); t_2 = (y - (x / z)) / a; t_3 = (x - (z * y)) / t; tmp = 0.0; if (z <= -0.16) tmp = t_2; elseif (z <= -8.2e-134) tmp = t_1; elseif (z <= 1.02e-185) tmp = t_3; elseif (z <= 7.6e-20) tmp = t_1; elseif (z <= 3.5e+29) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[z, -0.16], t$95$2, If[LessEqual[z, -8.2e-134], t$95$1, If[LessEqual[z, 1.02e-185], t$95$3, If[LessEqual[z, 7.6e-20], t$95$1, If[LessEqual[z, 3.5e+29], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
t_2 := \frac{y - \frac{x}{z}}{a}\\
t_3 := \frac{x - z \cdot y}{t}\\
\mathbf{if}\;z \leq -0.16:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-185}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+29}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -0.160000000000000003 or 3.49999999999999979e29 < z Initial program 69.6%
*-commutative69.6%
Simplified69.6%
Taylor expanded in x around 0 68.7%
*-commutative68.7%
*-commutative68.7%
*-un-lft-identity68.7%
times-frac72.4%
Applied egg-rr72.4%
Taylor expanded in a around inf 77.7%
mul-1-neg77.7%
unsub-neg77.7%
Simplified77.7%
if -0.160000000000000003 < z < -8.2000000000000004e-134 or 1.0200000000000001e-185 < z < 7.5999999999999995e-20Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 79.7%
*-commutative79.7%
Simplified79.7%
if -8.2000000000000004e-134 < z < 1.0200000000000001e-185 or 7.5999999999999995e-20 < z < 3.49999999999999979e29Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 94.0%
Final simplification82.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e+109) (not (<= z 3.2e+94))) (/ (- y (/ x z)) a) (/ (- (* z y) x) (- (* z a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e+109) || !(z <= 3.2e+94)) {
tmp = (y - (x / z)) / a;
} else {
tmp = ((z * y) - 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) :: tmp
if ((z <= (-9d+109)) .or. (.not. (z <= 3.2d+94))) then
tmp = (y - (x / z)) / a
else
tmp = ((z * y) - 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 tmp;
if ((z <= -9e+109) || !(z <= 3.2e+94)) {
tmp = (y - (x / z)) / a;
} else {
tmp = ((z * y) - x) / ((z * a) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e+109) or not (z <= 3.2e+94): tmp = (y - (x / z)) / a else: tmp = ((z * y) - x) / ((z * a) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9e+109) || !(z <= 3.2e+94)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(Float64(z * y) - x) / Float64(Float64(z * a) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9e+109) || ~((z <= 3.2e+94))) tmp = (y - (x / z)) / a; else tmp = ((z * y) - x) / ((z * a) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9e+109], N[Not[LessEqual[z, 3.2e+94]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+109} \lor \neg \left(z \leq 3.2 \cdot 10^{+94}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y - x}{z \cdot a - t}\\
\end{array}
\end{array}
if z < -8.9999999999999992e109 or 3.20000000000000014e94 < z Initial program 60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in x around 0 59.0%
*-commutative59.0%
*-commutative59.0%
*-un-lft-identity59.0%
times-frac66.6%
Applied egg-rr66.6%
Taylor expanded in a around inf 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
if -8.9999999999999992e109 < z < 3.20000000000000014e94Initial program 98.7%
Final simplification93.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -440.0)
(/ y a)
(if (<= z -1.2e-133)
(/ x (* z (- a)))
(if (<= z 1.2e+32) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -440.0) {
tmp = y / a;
} else if (z <= -1.2e-133) {
tmp = x / (z * -a);
} else if (z <= 1.2e+32) {
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 <= (-440.0d0)) then
tmp = y / a
else if (z <= (-1.2d-133)) then
tmp = x / (z * -a)
else if (z <= 1.2d+32) 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 <= -440.0) {
tmp = y / a;
} else if (z <= -1.2e-133) {
tmp = x / (z * -a);
} else if (z <= 1.2e+32) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -440.0: tmp = y / a elif z <= -1.2e-133: tmp = x / (z * -a) elif z <= 1.2e+32: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -440.0) tmp = Float64(y / a); elseif (z <= -1.2e-133) tmp = Float64(x / Float64(z * Float64(-a))); elseif (z <= 1.2e+32) 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 <= -440.0) tmp = y / a; elseif (z <= -1.2e-133) tmp = x / (z * -a); elseif (z <= 1.2e+32) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -440.0], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.2e-133], N[(x / N[(z * (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+32], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -440:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-133}:\\
\;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -440 or 1.19999999999999996e32 < z Initial program 69.6%
*-commutative69.6%
Simplified69.6%
Taylor expanded in z around inf 59.6%
if -440 < z < -1.2e-133Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 78.2%
*-commutative78.2%
Simplified78.2%
Taylor expanded in t around 0 51.7%
associate-*r*51.7%
neg-mul-151.7%
*-commutative51.7%
Simplified51.7%
if -1.2e-133 < z < 1.19999999999999996e32Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 68.2%
Final simplification61.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -460000.0) (not (<= z 1.1e+116))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -460000.0) || !(z <= 1.1e+116)) {
tmp = y / a;
} else {
tmp = x / (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 <= (-460000.0d0)) .or. (.not. (z <= 1.1d+116))) then
tmp = y / a
else
tmp = x / (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 <= -460000.0) || !(z <= 1.1e+116)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -460000.0) or not (z <= 1.1e+116): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -460000.0) || !(z <= 1.1e+116)) tmp = Float64(y / a); else tmp = Float64(x / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -460000.0) || ~((z <= 1.1e+116))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -460000.0], N[Not[LessEqual[z, 1.1e+116]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -460000 \lor \neg \left(z \leq 1.1 \cdot 10^{+116}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -4.6e5 or 1.1e116 < z Initial program 67.1%
*-commutative67.1%
Simplified67.1%
Taylor expanded in z around inf 62.3%
if -4.6e5 < z < 1.1e116Initial program 97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around inf 73.6%
*-commutative73.6%
Simplified73.6%
Final simplification69.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -290000.0) (not (<= z 2.2e+34))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -290000.0) || !(z <= 2.2e+34)) {
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 <= (-290000.0d0)) .or. (.not. (z <= 2.2d+34))) 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 <= -290000.0) || !(z <= 2.2e+34)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -290000.0) or not (z <= 2.2e+34): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -290000.0) || !(z <= 2.2e+34)) 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 <= -290000.0) || ~((z <= 2.2e+34))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -290000.0], N[Not[LessEqual[z, 2.2e+34]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -290000 \lor \neg \left(z \leq 2.2 \cdot 10^{+34}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -2.9e5 or 2.2000000000000002e34 < z Initial program 69.6%
*-commutative69.6%
Simplified69.6%
Taylor expanded in z around inf 59.6%
if -2.9e5 < z < 2.2000000000000002e34Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 58.8%
Final simplification59.2%
(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.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in z around 0 36.4%
Final simplification36.4%
(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 2024076
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(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))))