
(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 10 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 t_1) (/ y (/ t_1 z))))
(t_3 (/ (- x (* y z)) t_1)))
(if (<= t_3 -4e-320)
t_2
(if (<= t_3 0.0)
(/ (/ (- (* y z) x) a) z)
(if (<= t_3 INFINITY) t_2 (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = (x / t_1) - (y / (t_1 / z));
double t_3 = (x - (y * z)) / t_1;
double tmp;
if (t_3 <= -4e-320) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = (((y * z) - x) / a) / z;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = y / 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 / t_1) - (y / (t_1 / z));
double t_3 = (x - (y * z)) / t_1;
double tmp;
if (t_3 <= -4e-320) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = (((y * z) - x) / a) / z;
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (z * a) t_2 = (x / t_1) - (y / (t_1 / z)) t_3 = (x - (y * z)) / t_1 tmp = 0 if t_3 <= -4e-320: tmp = t_2 elif t_3 <= 0.0: tmp = (((y * z) - x) / a) / z elif t_3 <= math.inf: tmp = t_2 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(t_1 / z))) t_3 = Float64(Float64(x - Float64(y * z)) / t_1) tmp = 0.0 if (t_3 <= -4e-320) tmp = t_2; elseif (t_3 <= 0.0) tmp = Float64(Float64(Float64(Float64(y * z) - x) / a) / z); elseif (t_3 <= Inf) tmp = t_2; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (z * a); t_2 = (x / t_1) - (y / (t_1 / z)); t_3 = (x - (y * z)) / t_1; tmp = 0.0; if (t_3 <= -4e-320) tmp = t_2; elseif (t_3 <= 0.0) tmp = (((y * z) - x) / a) / z; elseif (t_3 <= Inf) tmp = t_2; else tmp = y / 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 / t$95$1), $MachinePrecision] - N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, -4e-320], t$95$2, If[LessEqual[t$95$3, 0.0], N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / a), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$2, N[(y / a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
t_2 := \frac{x}{t_1} - \frac{y}{\frac{t_1}{z}}\\
t_3 := \frac{x - y \cdot z}{t_1}\\
\mathbf{if}\;t_3 \leq -4 \cdot 10^{-320}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;\frac{\frac{y \cdot z - x}{a}}{z}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -3.99996e-320 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 92.4%
*-commutative92.4%
Simplified92.4%
clear-num91.4%
inv-pow91.4%
Applied egg-rr91.4%
Taylor expanded in x around inf 92.0%
+-commutative92.0%
mul-1-neg92.0%
unsub-neg92.0%
associate-/l*97.2%
Simplified97.2%
if -3.99996e-320 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0Initial program 53.7%
*-commutative53.7%
Simplified53.7%
clear-num53.7%
inv-pow53.7%
Applied egg-rr53.7%
Taylor expanded in t around 0 38.3%
mul-1-neg38.3%
associate-/r*84.3%
distribute-neg-frac84.3%
*-commutative84.3%
Simplified84.3%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification95.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_1 -4e-320)
t_1
(if (<= t_1 0.0)
(/ (/ (- (* y z) x) a) z)
(if (<= t_1 INFINITY) t_1 (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -4e-320) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (((y * z) - x) / a) / z;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -4e-320) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (((y * z) - x) / a) / z;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / (t - (z * a)) tmp = 0 if t_1 <= -4e-320: tmp = t_1 elif t_1 <= 0.0: tmp = (((y * z) - x) / a) / z elif t_1 <= math.inf: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) tmp = 0.0 if (t_1 <= -4e-320) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(Float64(Float64(y * z) - x) / a) / z); elseif (t_1 <= Inf) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (y * z)) / (t - (z * a)); tmp = 0.0; if (t_1 <= -4e-320) tmp = t_1; elseif (t_1 <= 0.0) tmp = (((y * z) - x) / a) / z; elseif (t_1 <= Inf) 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[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-320], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / a), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{-320}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{\frac{y \cdot z - x}{a}}{z}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -3.99996e-320 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 92.4%
if -3.99996e-320 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0Initial program 53.7%
*-commutative53.7%
Simplified53.7%
clear-num53.7%
inv-pow53.7%
Applied egg-rr53.7%
Taylor expanded in t around 0 38.3%
mul-1-neg38.3%
associate-/r*84.3%
distribute-neg-frac84.3%
*-commutative84.3%
Simplified84.3%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification91.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.7e+85)
(/ y a)
(if (<= z -5.7e+35)
(* z (/ (- y) t))
(if (<= z 3.8e-74)
(/ x t)
(if (<= z 3.7e-44)
(/ x (* z (- a)))
(if (<= z 2.35e-30) (/ x t) (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+85) {
tmp = y / a;
} else if (z <= -5.7e+35) {
tmp = z * (-y / t);
} else if (z <= 3.8e-74) {
tmp = x / t;
} else if (z <= 3.7e-44) {
tmp = x / (z * -a);
} else if (z <= 2.35e-30) {
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 <= (-2.7d+85)) then
tmp = y / a
else if (z <= (-5.7d+35)) then
tmp = z * (-y / t)
else if (z <= 3.8d-74) then
tmp = x / t
else if (z <= 3.7d-44) then
tmp = x / (z * -a)
else if (z <= 2.35d-30) 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 <= -2.7e+85) {
tmp = y / a;
} else if (z <= -5.7e+35) {
tmp = z * (-y / t);
} else if (z <= 3.8e-74) {
tmp = x / t;
} else if (z <= 3.7e-44) {
tmp = x / (z * -a);
} else if (z <= 2.35e-30) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.7e+85: tmp = y / a elif z <= -5.7e+35: tmp = z * (-y / t) elif z <= 3.8e-74: tmp = x / t elif z <= 3.7e-44: tmp = x / (z * -a) elif z <= 2.35e-30: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.7e+85) tmp = Float64(y / a); elseif (z <= -5.7e+35) tmp = Float64(z * Float64(Float64(-y) / t)); elseif (z <= 3.8e-74) tmp = Float64(x / t); elseif (z <= 3.7e-44) tmp = Float64(x / Float64(z * Float64(-a))); elseif (z <= 2.35e-30) 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 <= -2.7e+85) tmp = y / a; elseif (z <= -5.7e+35) tmp = z * (-y / t); elseif (z <= 3.8e-74) tmp = x / t; elseif (z <= 3.7e-44) tmp = x / (z * -a); elseif (z <= 2.35e-30) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.7e+85], N[(y / a), $MachinePrecision], If[LessEqual[z, -5.7e+35], N[(z * N[((-y) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e-74], N[(x / t), $MachinePrecision], If[LessEqual[z, 3.7e-44], N[(x / N[(z * (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.35e-30], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+85}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{+35}:\\
\;\;\;\;z \cdot \frac{-y}{t}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-44}:\\
\;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.69999999999999983e85 or 2.34999999999999985e-30 < z Initial program 67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 57.3%
if -2.69999999999999983e85 < z < -5.69999999999999993e35Initial program 78.5%
*-commutative78.5%
Simplified78.5%
Taylor expanded in x around 0 55.9%
associate-*r/55.9%
*-commutative55.9%
neg-mul-155.9%
distribute-rgt-neg-in55.9%
Simplified55.9%
Taylor expanded in z around 0 51.0%
mul-1-neg51.0%
associate-*l/65.4%
*-commutative65.4%
distribute-rgt-neg-in65.4%
distribute-neg-frac65.4%
Simplified65.4%
if -5.69999999999999993e35 < z < 3.7999999999999996e-74 or 3.7e-44 < z < 2.34999999999999985e-30Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 61.6%
if 3.7999999999999996e-74 < z < 3.7e-44Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around 0 85.7%
associate-*r*85.7%
neg-mul-185.7%
*-commutative85.7%
Simplified85.7%
Final simplification60.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.65e+85)
(/ y a)
(if (<= z -3.35e+34)
(* z (/ (- y) t))
(if (<= z 4.1e-30) (/ x (- t (* z a))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e+85) {
tmp = y / a;
} else if (z <= -3.35e+34) {
tmp = z * (-y / t);
} else if (z <= 4.1e-30) {
tmp = x / (t - (z * a));
} 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 <= (-2.65d+85)) then
tmp = y / a
else if (z <= (-3.35d+34)) then
tmp = z * (-y / t)
else if (z <= 4.1d-30) then
tmp = x / (t - (z * a))
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 <= -2.65e+85) {
tmp = y / a;
} else if (z <= -3.35e+34) {
tmp = z * (-y / t);
} else if (z <= 4.1e-30) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.65e+85: tmp = y / a elif z <= -3.35e+34: tmp = z * (-y / t) elif z <= 4.1e-30: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.65e+85) tmp = Float64(y / a); elseif (z <= -3.35e+34) tmp = Float64(z * Float64(Float64(-y) / t)); elseif (z <= 4.1e-30) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.65e+85) tmp = y / a; elseif (z <= -3.35e+34) tmp = z * (-y / t); elseif (z <= 4.1e-30) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.65e+85], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.35e+34], N[(z * N[((-y) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.1e-30], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+85}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.35 \cdot 10^{+34}:\\
\;\;\;\;z \cdot \frac{-y}{t}\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.65e85 or 4.1000000000000003e-30 < z Initial program 67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 57.3%
if -2.65e85 < z < -3.3500000000000001e34Initial program 78.5%
*-commutative78.5%
Simplified78.5%
Taylor expanded in x around 0 55.9%
associate-*r/55.9%
*-commutative55.9%
neg-mul-155.9%
distribute-rgt-neg-in55.9%
Simplified55.9%
Taylor expanded in z around 0 51.0%
mul-1-neg51.0%
associate-*l/65.4%
*-commutative65.4%
distribute-rgt-neg-in65.4%
distribute-neg-frac65.4%
Simplified65.4%
if -3.3500000000000001e34 < z < 4.1000000000000003e-30Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 76.8%
*-commutative76.8%
Simplified76.8%
Final simplification67.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.12e+78) (not (<= a 8e-7))) (- (/ y a) (/ x (* z a))) (/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.12e+78) || !(a <= 8e-7)) {
tmp = (y / a) - (x / (z * a));
} else {
tmp = (x - (y * z)) / 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 ((a <= (-1.12d+78)) .or. (.not. (a <= 8d-7))) then
tmp = (y / a) - (x / (z * a))
else
tmp = (x - (y * z)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.12e+78) || !(a <= 8e-7)) {
tmp = (y / a) - (x / (z * a));
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.12e+78) or not (a <= 8e-7): tmp = (y / a) - (x / (z * a)) else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.12e+78) || !(a <= 8e-7)) tmp = Float64(Float64(y / a) - Float64(x / Float64(z * a))); else tmp = Float64(Float64(x - Float64(y * z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.12e+78) || ~((a <= 8e-7))) tmp = (y / a) - (x / (z * a)); else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.12e+78], N[Not[LessEqual[a, 8e-7]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] - N[(x / N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.12 \cdot 10^{+78} \lor \neg \left(a \leq 8 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{y}{a} - \frac{x}{z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if a < -1.12e78 or 7.9999999999999996e-7 < a Initial program 73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in t around 0 57.1%
associate-*r*38.7%
neg-mul-138.7%
*-commutative38.7%
Simplified57.1%
Taylor expanded in x around 0 75.8%
+-commutative75.8%
mul-1-neg75.8%
unsub-neg75.8%
*-commutative75.8%
Simplified75.8%
if -1.12e78 < a < 7.9999999999999996e-7Initial program 93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in t around inf 76.6%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.32e+76) (/ y a) (if (<= a 7e+17) (/ (- x (* y z)) t) (/ x (- t (* z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.32e+76) {
tmp = y / a;
} else if (a <= 7e+17) {
tmp = (x - (y * z)) / t;
} 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 (a <= (-1.32d+76)) then
tmp = y / a
else if (a <= 7d+17) then
tmp = (x - (y * z)) / t
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 (a <= -1.32e+76) {
tmp = y / a;
} else if (a <= 7e+17) {
tmp = (x - (y * z)) / t;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.32e+76: tmp = y / a elif a <= 7e+17: tmp = (x - (y * z)) / t else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.32e+76) tmp = Float64(y / a); elseif (a <= 7e+17) tmp = Float64(Float64(x - Float64(y * z)) / t); 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 (a <= -1.32e+76) tmp = y / a; elseif (a <= 7e+17) tmp = (x - (y * z)) / t; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.32e+76], N[(y / a), $MachinePrecision], If[LessEqual[a, 7e+17], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.32 \cdot 10^{+76}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;a \leq 7 \cdot 10^{+17}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if a < -1.31999999999999999e76Initial program 72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in z around inf 57.6%
if -1.31999999999999999e76 < a < 7e17Initial program 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in t around inf 75.2%
if 7e17 < a Initial program 77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in x around inf 52.8%
*-commutative52.8%
Simplified52.8%
Final simplification66.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.6e+106) (/ y a) (if (<= z -5.8e+33) (* (- y) (/ z t)) (if (<= z 2.6e-30) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.6e+106) {
tmp = y / a;
} else if (z <= -5.8e+33) {
tmp = -y * (z / t);
} else if (z <= 2.6e-30) {
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 <= (-2.6d+106)) then
tmp = y / a
else if (z <= (-5.8d+33)) then
tmp = -y * (z / t)
else if (z <= 2.6d-30) 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 <= -2.6e+106) {
tmp = y / a;
} else if (z <= -5.8e+33) {
tmp = -y * (z / t);
} else if (z <= 2.6e-30) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.6e+106: tmp = y / a elif z <= -5.8e+33: tmp = -y * (z / t) elif z <= 2.6e-30: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.6e+106) tmp = Float64(y / a); elseif (z <= -5.8e+33) tmp = Float64(Float64(-y) * Float64(z / t)); elseif (z <= 2.6e-30) 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 <= -2.6e+106) tmp = y / a; elseif (z <= -5.8e+33) tmp = -y * (z / t); elseif (z <= 2.6e-30) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.6e+106], N[(y / a), $MachinePrecision], If[LessEqual[z, -5.8e+33], N[((-y) * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e-30], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+106}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{+33}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.6000000000000002e106 or 2.59999999999999987e-30 < z Initial program 67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in z around inf 57.4%
if -2.6000000000000002e106 < z < -5.80000000000000049e33Initial program 80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in x around 0 55.3%
associate-*r/55.3%
*-commutative55.3%
neg-mul-155.3%
distribute-rgt-neg-in55.3%
Simplified55.3%
Taylor expanded in y around 0 55.3%
associate-*r/55.3%
*-rgt-identity55.3%
*-commutative55.3%
associate-*r/55.4%
mul-1-neg55.4%
distribute-rgt-neg-out55.4%
associate-*l*69.7%
distribute-lft-neg-out69.7%
associate-*r/69.8%
*-rgt-identity69.8%
*-commutative69.8%
Simplified69.8%
Taylor expanded in z around 0 63.9%
if -5.80000000000000049e33 < z < 2.59999999999999987e-30Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 59.2%
Final simplification58.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.05e+88) (/ y a) (if (<= z -3.4e+31) (* z (/ (- y) t)) (if (<= z 4.4e-30) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+88) {
tmp = y / a;
} else if (z <= -3.4e+31) {
tmp = z * (-y / t);
} else if (z <= 4.4e-30) {
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 <= (-1.05d+88)) then
tmp = y / a
else if (z <= (-3.4d+31)) then
tmp = z * (-y / t)
else if (z <= 4.4d-30) 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 <= -1.05e+88) {
tmp = y / a;
} else if (z <= -3.4e+31) {
tmp = z * (-y / t);
} else if (z <= 4.4e-30) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.05e+88: tmp = y / a elif z <= -3.4e+31: tmp = z * (-y / t) elif z <= 4.4e-30: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+88) tmp = Float64(y / a); elseif (z <= -3.4e+31) tmp = Float64(z * Float64(Float64(-y) / t)); elseif (z <= 4.4e-30) 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 <= -1.05e+88) tmp = y / a; elseif (z <= -3.4e+31) tmp = z * (-y / t); elseif (z <= 4.4e-30) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+88], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.4e+31], N[(z * N[((-y) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e-30], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+88}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{+31}:\\
\;\;\;\;z \cdot \frac{-y}{t}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.05e88 or 4.39999999999999967e-30 < z Initial program 67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 57.3%
if -1.05e88 < z < -3.3999999999999998e31Initial program 78.5%
*-commutative78.5%
Simplified78.5%
Taylor expanded in x around 0 55.9%
associate-*r/55.9%
*-commutative55.9%
neg-mul-155.9%
distribute-rgt-neg-in55.9%
Simplified55.9%
Taylor expanded in z around 0 51.0%
mul-1-neg51.0%
associate-*l/65.4%
*-commutative65.4%
distribute-rgt-neg-in65.4%
distribute-neg-frac65.4%
Simplified65.4%
if -3.3999999999999998e31 < z < 4.39999999999999967e-30Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 59.2%
Final simplification58.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.9e+85) (/ y a) (if (<= z 2.9e-30) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.9e+85) {
tmp = y / a;
} else if (z <= 2.9e-30) {
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 <= (-1.9d+85)) then
tmp = y / a
else if (z <= 2.9d-30) 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 <= -1.9e+85) {
tmp = y / a;
} else if (z <= 2.9e-30) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.9e+85: tmp = y / a elif z <= 2.9e-30: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.9e+85) tmp = Float64(y / a); elseif (z <= 2.9e-30) 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 <= -1.9e+85) tmp = y / a; elseif (z <= 2.9e-30) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.9e+85], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.9e-30], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+85}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.89999999999999996e85 or 2.89999999999999989e-30 < z Initial program 67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 57.3%
if -1.89999999999999996e85 < z < 2.89999999999999989e-30Initial program 97.2%
*-commutative97.2%
Simplified97.2%
Taylor expanded in z around 0 54.9%
Final simplification55.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 84.5%
*-commutative84.5%
Simplified84.5%
Taylor expanded in z around 0 36.5%
Final simplification36.5%
(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 2023279
(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))))