
(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
(let* ((t_1 (- t (* z a))) (t_2 (/ (- x (* y z)) t_1)))
(if (<= t_2 (- INFINITY))
(/ y (/ t_1 (- z)))
(if (<= t_2 -5e-313)
(- (/ x t_1) (/ (* y z) t_1))
(if (or (<= t_2 0.0) (not (<= t_2 5e+302))) (/ (- y (/ x z)) a) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = y / (t_1 / -z);
} else if (t_2 <= -5e-313) {
tmp = (x / t_1) - ((y * z) / t_1);
} else if ((t_2 <= 0.0) || !(t_2 <= 5e+302)) {
tmp = (y - (x / z)) / a;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = y / (t_1 / -z);
} else if (t_2 <= -5e-313) {
tmp = (x / t_1) - ((y * z) / t_1);
} else if ((t_2 <= 0.0) || !(t_2 <= 5e+302)) {
tmp = (y - (x / z)) / a;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (z * a) t_2 = (x - (y * z)) / t_1 tmp = 0 if t_2 <= -math.inf: tmp = y / (t_1 / -z) elif t_2 <= -5e-313: tmp = (x / t_1) - ((y * z) / t_1) elif (t_2 <= 0.0) or not (t_2 <= 5e+302): tmp = (y - (x / z)) / a else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) t_2 = Float64(Float64(x - Float64(y * z)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(y / Float64(t_1 / Float64(-z))); elseif (t_2 <= -5e-313) tmp = Float64(Float64(x / t_1) - Float64(Float64(y * z) / t_1)); elseif ((t_2 <= 0.0) || !(t_2 <= 5e+302)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (z * a); t_2 = (x - (y * z)) / t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = y / (t_1 / -z); elseif (t_2 <= -5e-313) tmp = (x / t_1) - ((y * z) / t_1); elseif ((t_2 <= 0.0) || ~((t_2 <= 5e+302))) tmp = (y - (x / z)) / a; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(y / N[(t$95$1 / (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -5e-313], N[(N[(x / t$95$1), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$2, 0.0], N[Not[LessEqual[t$95$2, 5e+302]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
t_2 := \frac{x - y \cdot z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{t\_1}{-z}}\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-313}:\\
\;\;\;\;\frac{x}{t\_1} - \frac{y \cdot z}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 0 \lor \neg \left(t\_2 \leq 5 \cdot 10^{+302}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in x around 0 36.4%
associate-*r/36.4%
mul-1-neg36.4%
distribute-rgt-neg-out36.4%
associate-/l*83.7%
*-commutative83.7%
Simplified83.7%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -5.00000000002e-313Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
if -5.00000000002e-313 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0 or 5e302 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 42.4%
*-commutative42.4%
Simplified42.4%
Taylor expanded in x around 0 42.4%
Taylor expanded in a around inf 75.0%
mul-1-neg75.0%
unsub-neg75.0%
Simplified75.0%
if 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 5e302Initial program 99.7%
Final simplification93.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* z a))) (t_2 (/ (- x (* y z)) t_1)))
(if (<= t_2 (- INFINITY))
(/ y (/ t_1 (- z)))
(if (or (<= t_2 -5e-313) (and (not (<= t_2 0.0)) (<= t_2 5e+302)))
t_2
(/ (- y (/ x z)) a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = y / (t_1 / -z);
} else if ((t_2 <= -5e-313) || (!(t_2 <= 0.0) && (t_2 <= 5e+302))) {
tmp = t_2;
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = (x - (y * z)) / t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = y / (t_1 / -z);
} else if ((t_2 <= -5e-313) || (!(t_2 <= 0.0) && (t_2 <= 5e+302))) {
tmp = t_2;
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (z * a) t_2 = (x - (y * z)) / t_1 tmp = 0 if t_2 <= -math.inf: tmp = y / (t_1 / -z) elif (t_2 <= -5e-313) or (not (t_2 <= 0.0) and (t_2 <= 5e+302)): tmp = t_2 else: tmp = (y - (x / z)) / a return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) t_2 = Float64(Float64(x - Float64(y * z)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(y / Float64(t_1 / Float64(-z))); elseif ((t_2 <= -5e-313) || (!(t_2 <= 0.0) && (t_2 <= 5e+302))) tmp = t_2; else tmp = Float64(Float64(y - Float64(x / z)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (z * a); t_2 = (x - (y * z)) / t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = y / (t_1 / -z); elseif ((t_2 <= -5e-313) || (~((t_2 <= 0.0)) && (t_2 <= 5e+302))) tmp = t_2; else tmp = (y - (x / z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(y / N[(t$95$1 / (-z)), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$2, -5e-313], And[N[Not[LessEqual[t$95$2, 0.0]], $MachinePrecision], LessEqual[t$95$2, 5e+302]]], t$95$2, N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
t_2 := \frac{x - y \cdot z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{t\_1}{-z}}\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-313} \lor \neg \left(t\_2 \leq 0\right) \land t\_2 \leq 5 \cdot 10^{+302}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in x around 0 36.4%
associate-*r/36.4%
mul-1-neg36.4%
distribute-rgt-neg-out36.4%
associate-/l*83.7%
*-commutative83.7%
Simplified83.7%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -5.00000000002e-313 or 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 5e302Initial program 99.7%
if -5.00000000002e-313 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0 or 5e302 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 42.4%
*-commutative42.4%
Simplified42.4%
Taylor expanded in x around 0 42.4%
Taylor expanded in a around inf 75.0%
mul-1-neg75.0%
unsub-neg75.0%
Simplified75.0%
Final simplification93.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ (- y) t))))
(if (<= z -3.8e+117)
(/ y a)
(if (<= z -1.5e+16)
t_1
(if (<= z -6.5e-7)
(/ y a)
(if (<= z 1.15e-10) (/ x t) (if (<= z 7.6e+81) t_1 (/ y a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-y / t);
double tmp;
if (z <= -3.8e+117) {
tmp = y / a;
} else if (z <= -1.5e+16) {
tmp = t_1;
} else if (z <= -6.5e-7) {
tmp = y / a;
} else if (z <= 1.15e-10) {
tmp = x / t;
} else if (z <= 7.6e+81) {
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) :: tmp
t_1 = z * (-y / t)
if (z <= (-3.8d+117)) then
tmp = y / a
else if (z <= (-1.5d+16)) then
tmp = t_1
else if (z <= (-6.5d-7)) then
tmp = y / a
else if (z <= 1.15d-10) then
tmp = x / t
else if (z <= 7.6d+81) 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 = z * (-y / t);
double tmp;
if (z <= -3.8e+117) {
tmp = y / a;
} else if (z <= -1.5e+16) {
tmp = t_1;
} else if (z <= -6.5e-7) {
tmp = y / a;
} else if (z <= 1.15e-10) {
tmp = x / t;
} else if (z <= 7.6e+81) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (-y / t) tmp = 0 if z <= -3.8e+117: tmp = y / a elif z <= -1.5e+16: tmp = t_1 elif z <= -6.5e-7: tmp = y / a elif z <= 1.15e-10: tmp = x / t elif z <= 7.6e+81: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(Float64(-y) / t)) tmp = 0.0 if (z <= -3.8e+117) tmp = Float64(y / a); elseif (z <= -1.5e+16) tmp = t_1; elseif (z <= -6.5e-7) tmp = Float64(y / a); elseif (z <= 1.15e-10) tmp = Float64(x / t); elseif (z <= 7.6e+81) tmp = t_1; 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 <= -3.8e+117) tmp = y / a; elseif (z <= -1.5e+16) tmp = t_1; elseif (z <= -6.5e-7) tmp = y / a; elseif (z <= 1.15e-10) tmp = x / t; elseif (z <= 7.6e+81) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-y) / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.8e+117], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.5e+16], t$95$1, If[LessEqual[z, -6.5e-7], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.15e-10], N[(x / t), $MachinePrecision], If[LessEqual[z, 7.6e+81], t$95$1, N[(y / a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{-y}{t}\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{+117}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-10}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+81}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -3.8000000000000002e117 or -1.5e16 < z < -6.50000000000000024e-7 or 7.599999999999999e81 < z Initial program 61.4%
*-commutative61.4%
Simplified61.4%
Taylor expanded in z around inf 61.5%
if -3.8000000000000002e117 < z < -1.5e16 or 1.15000000000000004e-10 < z < 7.599999999999999e81Initial program 88.4%
*-commutative88.4%
Simplified88.4%
Taylor expanded in t around inf 50.6%
clear-num50.5%
inv-pow50.5%
Applied egg-rr50.5%
unpow-150.5%
Simplified50.5%
Taylor expanded in x around 0 37.2%
mul-1-neg37.2%
*-commutative37.2%
associate-/l*42.8%
associate-/r/42.9%
distribute-rgt-neg-in42.9%
Simplified42.9%
Taylor expanded in z around 0 37.2%
mul-1-neg37.2%
associate-*l/42.9%
Simplified42.9%
if -6.50000000000000024e-7 < z < 1.15000000000000004e-10Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 58.4%
Final simplification56.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8.6e+117)
(/ y a)
(if (<= z -1.7e+16)
(* (- y) (/ z t))
(if (<= z -2.9e-9)
(/ y a)
(if (<= z 5.5e-12)
(/ x t)
(if (<= z 2.05e+88) (* z (/ (- y) t)) (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.6e+117) {
tmp = y / a;
} else if (z <= -1.7e+16) {
tmp = -y * (z / t);
} else if (z <= -2.9e-9) {
tmp = y / a;
} else if (z <= 5.5e-12) {
tmp = x / t;
} else if (z <= 2.05e+88) {
tmp = 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 <= (-8.6d+117)) then
tmp = y / a
else if (z <= (-1.7d+16)) then
tmp = -y * (z / t)
else if (z <= (-2.9d-9)) then
tmp = y / a
else if (z <= 5.5d-12) then
tmp = x / t
else if (z <= 2.05d+88) then
tmp = 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 <= -8.6e+117) {
tmp = y / a;
} else if (z <= -1.7e+16) {
tmp = -y * (z / t);
} else if (z <= -2.9e-9) {
tmp = y / a;
} else if (z <= 5.5e-12) {
tmp = x / t;
} else if (z <= 2.05e+88) {
tmp = z * (-y / t);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.6e+117: tmp = y / a elif z <= -1.7e+16: tmp = -y * (z / t) elif z <= -2.9e-9: tmp = y / a elif z <= 5.5e-12: tmp = x / t elif z <= 2.05e+88: tmp = z * (-y / t) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.6e+117) tmp = Float64(y / a); elseif (z <= -1.7e+16) tmp = Float64(Float64(-y) * Float64(z / t)); elseif (z <= -2.9e-9) tmp = Float64(y / a); elseif (z <= 5.5e-12) tmp = Float64(x / t); elseif (z <= 2.05e+88) tmp = Float64(z * Float64(Float64(-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 <= -8.6e+117) tmp = y / a; elseif (z <= -1.7e+16) tmp = -y * (z / t); elseif (z <= -2.9e-9) tmp = y / a; elseif (z <= 5.5e-12) tmp = x / t; elseif (z <= 2.05e+88) tmp = z * (-y / t); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.6e+117], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.7e+16], N[((-y) * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.9e-9], N[(y / a), $MachinePrecision], If[LessEqual[z, 5.5e-12], N[(x / t), $MachinePrecision], If[LessEqual[z, 2.05e+88], N[(z * N[((-y) / t), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+117}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+16}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-9}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+88}:\\
\;\;\;\;z \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -8.59999999999999996e117 or -1.7e16 < z < -2.89999999999999991e-9 or 2.05000000000000014e88 < z Initial program 61.4%
*-commutative61.4%
Simplified61.4%
Taylor expanded in z around inf 61.5%
if -8.59999999999999996e117 < z < -1.7e16Initial program 83.1%
*-commutative83.1%
Simplified83.1%
Taylor expanded in t around inf 53.6%
clear-num53.5%
inv-pow53.5%
Applied egg-rr53.5%
unpow-153.5%
Simplified53.5%
Taylor expanded in x around 0 42.3%
mul-1-neg42.3%
*-commutative42.3%
associate-/l*46.5%
associate-/r/46.6%
distribute-rgt-neg-in46.6%
Simplified46.6%
if -2.89999999999999991e-9 < z < 5.5000000000000004e-12Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 58.4%
if 5.5000000000000004e-12 < z < 2.05000000000000014e88Initial program 92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in t around inf 48.1%
clear-num48.0%
inv-pow48.0%
Applied egg-rr48.0%
unpow-148.0%
Simplified48.0%
Taylor expanded in x around 0 32.9%
mul-1-neg32.9%
*-commutative32.9%
associate-/l*39.7%
associate-/r/39.7%
distribute-rgt-neg-in39.7%
Simplified39.7%
Taylor expanded in z around 0 32.9%
mul-1-neg32.9%
associate-*l/39.8%
Simplified39.8%
Final simplification56.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)) (t_2 (- (/ x t) (* z (/ y t)))))
(if (<= t -9e-31)
t_2
(if (<= t 1.3e-82)
t_1
(if (<= t 3.35e+24) (/ x (- t (* z a))) (if (<= t 4.2e+84) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double t_2 = (x / t) - (z * (y / t));
double tmp;
if (t <= -9e-31) {
tmp = t_2;
} else if (t <= 1.3e-82) {
tmp = t_1;
} else if (t <= 3.35e+24) {
tmp = x / (t - (z * a));
} else if (t <= 4.2e+84) {
tmp = 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 = (y - (x / z)) / a
t_2 = (x / t) - (z * (y / t))
if (t <= (-9d-31)) then
tmp = t_2
else if (t <= 1.3d-82) then
tmp = t_1
else if (t <= 3.35d+24) then
tmp = x / (t - (z * a))
else if (t <= 4.2d+84) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double t_2 = (x / t) - (z * (y / t));
double tmp;
if (t <= -9e-31) {
tmp = t_2;
} else if (t <= 1.3e-82) {
tmp = t_1;
} else if (t <= 3.35e+24) {
tmp = x / (t - (z * a));
} else if (t <= 4.2e+84) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a t_2 = (x / t) - (z * (y / t)) tmp = 0 if t <= -9e-31: tmp = t_2 elif t <= 1.3e-82: tmp = t_1 elif t <= 3.35e+24: tmp = x / (t - (z * a)) elif t <= 4.2e+84: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) t_2 = Float64(Float64(x / t) - Float64(z * Float64(y / t))) tmp = 0.0 if (t <= -9e-31) tmp = t_2; elseif (t <= 1.3e-82) tmp = t_1; elseif (t <= 3.35e+24) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (t <= 4.2e+84) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; t_2 = (x / t) - (z * (y / t)); tmp = 0.0; if (t <= -9e-31) tmp = t_2; elseif (t <= 1.3e-82) tmp = t_1; elseif (t <= 3.35e+24) tmp = x / (t - (z * a)); elseif (t <= 4.2e+84) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(x / t), $MachinePrecision] - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9e-31], t$95$2, If[LessEqual[t, 1.3e-82], t$95$1, If[LessEqual[t, 3.35e+24], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.2e+84], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
t_2 := \frac{x}{t} - z \cdot \frac{y}{t}\\
\mathbf{if}\;t \leq -9 \cdot 10^{-31}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.35 \cdot 10^{+24}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -9.0000000000000008e-31 or 4.20000000000000037e84 < t Initial program 85.8%
*-commutative85.8%
Simplified85.8%
Taylor expanded in z around 0 69.1%
Taylor expanded in y around inf 77.3%
associate-*r/77.3%
neg-mul-177.3%
Simplified77.3%
if -9.0000000000000008e-31 < t < 1.3e-82 or 3.35e24 < t < 4.20000000000000037e84Initial program 82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in x around 0 81.3%
Taylor expanded in a around inf 75.5%
mul-1-neg75.5%
unsub-neg75.5%
Simplified75.5%
if 1.3e-82 < t < 3.35e24Initial program 88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in x around inf 72.6%
*-commutative72.6%
Simplified72.6%
Final simplification76.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)) (t_2 (/ (- x (* y z)) t)))
(if (<= t -5.6e-30)
t_2
(if (<= t 1.76e-84)
t_1
(if (<= t 6e+23) (/ x (- t (* z a))) (if (<= t 8.5e+80) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double t_2 = (x - (y * z)) / t;
double tmp;
if (t <= -5.6e-30) {
tmp = t_2;
} else if (t <= 1.76e-84) {
tmp = t_1;
} else if (t <= 6e+23) {
tmp = x / (t - (z * a));
} else if (t <= 8.5e+80) {
tmp = 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 = (y - (x / z)) / a
t_2 = (x - (y * z)) / t
if (t <= (-5.6d-30)) then
tmp = t_2
else if (t <= 1.76d-84) then
tmp = t_1
else if (t <= 6d+23) then
tmp = x / (t - (z * a))
else if (t <= 8.5d+80) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double t_2 = (x - (y * z)) / t;
double tmp;
if (t <= -5.6e-30) {
tmp = t_2;
} else if (t <= 1.76e-84) {
tmp = t_1;
} else if (t <= 6e+23) {
tmp = x / (t - (z * a));
} else if (t <= 8.5e+80) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a t_2 = (x - (y * z)) / t tmp = 0 if t <= -5.6e-30: tmp = t_2 elif t <= 1.76e-84: tmp = t_1 elif t <= 6e+23: tmp = x / (t - (z * a)) elif t <= 8.5e+80: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) t_2 = Float64(Float64(x - Float64(y * z)) / t) tmp = 0.0 if (t <= -5.6e-30) tmp = t_2; elseif (t <= 1.76e-84) tmp = t_1; elseif (t <= 6e+23) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (t <= 8.5e+80) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; t_2 = (x - (y * z)) / t; tmp = 0.0; if (t <= -5.6e-30) tmp = t_2; elseif (t <= 1.76e-84) tmp = t_1; elseif (t <= 6e+23) tmp = x / (t - (z * a)); elseif (t <= 8.5e+80) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -5.6e-30], t$95$2, If[LessEqual[t, 1.76e-84], t$95$1, If[LessEqual[t, 6e+23], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e+80], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
t_2 := \frac{x - y \cdot z}{t}\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{-30}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.76 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -5.59999999999999977e-30 or 8.50000000000000007e80 < t Initial program 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in t around inf 72.4%
if -5.59999999999999977e-30 < t < 1.76e-84 or 6.0000000000000002e23 < t < 8.50000000000000007e80Initial program 82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in x around 0 81.5%
Taylor expanded in a around inf 74.8%
mul-1-neg74.8%
unsub-neg74.8%
Simplified74.8%
if 1.76e-84 < t < 6.0000000000000002e23Initial program 88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in x around inf 72.6%
*-commutative72.6%
Simplified72.6%
Final simplification73.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.4e+142) (not (<= z 5e+79))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.4e+142) || !(z <= 5e+79)) {
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 <= (-4.4d+142)) .or. (.not. (z <= 5d+79))) 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 <= -4.4e+142) || !(z <= 5e+79)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.4e+142) or not (z <= 5e+79): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.4e+142) || !(z <= 5e+79)) 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 <= -4.4e+142) || ~((z <= 5e+79))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.4e+142], N[Not[LessEqual[z, 5e+79]], $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 -4.4 \cdot 10^{+142} \lor \neg \left(z \leq 5 \cdot 10^{+79}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -4.39999999999999974e142 or 5e79 < z Initial program 56.4%
*-commutative56.4%
Simplified56.4%
Taylor expanded in z around inf 62.7%
if -4.39999999999999974e142 < z < 5e79Initial program 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in x around inf 67.6%
*-commutative67.6%
Simplified67.6%
Final simplification66.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e-7) (not (<= z 4.2e+80))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e-7) || !(z <= 4.2e+80)) {
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 <= (-1d-7)) .or. (.not. (z <= 4.2d+80))) 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 <= -1e-7) || !(z <= 4.2e+80)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1e-7) or not (z <= 4.2e+80): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e-7) || !(z <= 4.2e+80)) 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 <= -1e-7) || ~((z <= 4.2e+80))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e-7], N[Not[LessEqual[z, 4.2e+80]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-7} \lor \neg \left(z \leq 4.2 \cdot 10^{+80}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -9.9999999999999995e-8 or 4.20000000000000003e80 < z Initial program 65.3%
*-commutative65.3%
Simplified65.3%
Taylor expanded in z around inf 52.6%
if -9.9999999999999995e-8 < z < 4.20000000000000003e80Initial program 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in z around 0 52.2%
Final simplification52.4%
(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 84.5%
*-commutative84.5%
Simplified84.5%
Taylor expanded in z around 0 36.0%
Final simplification36.0%
(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 2024041
(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))))