
(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 (- x (* y z))) (t_2 (- t (* z a))) (t_3 (/ t_1 t_2)))
(if (<= t_3 (- INFINITY))
(* y (+ (/ z (- (* z a) t)) (/ x (* y t_2))))
(if (<= t_3 -5e-324)
t_3
(if (<= t_3 0.0)
(/ (/ t_1 z) (- (/ t z) a))
(if (<= t_3 INFINITY) t_3 (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * z);
double t_2 = t - (z * a);
double t_3 = t_1 / t_2;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = y * ((z / ((z * a) - t)) + (x / (y * t_2)));
} else if (t_3 <= -5e-324) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = (t_1 / z) / ((t / z) - a);
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_3;
} 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);
double t_2 = t - (z * a);
double t_3 = t_1 / t_2;
double tmp;
if (t_3 <= -Double.POSITIVE_INFINITY) {
tmp = y * ((z / ((z * a) - t)) + (x / (y * t_2)));
} else if (t_3 <= -5e-324) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = (t_1 / z) / ((t / z) - a);
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_3;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * z) t_2 = t - (z * a) t_3 = t_1 / t_2 tmp = 0 if t_3 <= -math.inf: tmp = y * ((z / ((z * a) - t)) + (x / (y * t_2))) elif t_3 <= -5e-324: tmp = t_3 elif t_3 <= 0.0: tmp = (t_1 / z) / ((t / z) - a) elif t_3 <= math.inf: tmp = t_3 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * z)) t_2 = Float64(t - Float64(z * a)) t_3 = Float64(t_1 / t_2) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(y * Float64(Float64(z / Float64(Float64(z * a) - t)) + Float64(x / Float64(y * t_2)))); elseif (t_3 <= -5e-324) tmp = t_3; elseif (t_3 <= 0.0) tmp = Float64(Float64(t_1 / z) / Float64(Float64(t / z) - a)); elseif (t_3 <= Inf) tmp = t_3; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * z); t_2 = t - (z * a); t_3 = t_1 / t_2; tmp = 0.0; if (t_3 <= -Inf) tmp = y * ((z / ((z * a) - t)) + (x / (y * t_2))); elseif (t_3 <= -5e-324) tmp = t_3; elseif (t_3 <= 0.0) tmp = (t_1 / z) / ((t / z) - a); elseif (t_3 <= Inf) tmp = t_3; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(y * N[(N[(z / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -5e-324], t$95$3, If[LessEqual[t$95$3, 0.0], N[(N[(t$95$1 / z), $MachinePrecision] / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$3, N[(y / a), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot z\\
t_2 := t - z \cdot a\\
t_3 := \frac{t\_1}{t\_2}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{z}{z \cdot a - t} + \frac{x}{y \cdot t\_2}\right)\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-324}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{\frac{t\_1}{z}}{\frac{t}{z} - a}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 62.4%
*-commutative62.4%
Simplified62.4%
Taylor expanded in y around inf 99.9%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -4.94066e-324 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 98.2%
if -4.94066e-324 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0Initial program 62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in z around inf 62.6%
div-sub62.6%
Applied egg-rr62.6%
div-sub62.6%
associate-/r*100.0%
Simplified100.0%
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 simplification98.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.9e+150)
(/ y a)
(if (<= z -3.45e+28)
(* y (/ (- z) t))
(if (<= z 4.1e-141)
(/ x t)
(if (<= z 1.35e-46) (/ x (* a (- z))) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.9e+150) {
tmp = y / a;
} else if (z <= -3.45e+28) {
tmp = y * (-z / t);
} else if (z <= 4.1e-141) {
tmp = x / t;
} else if (z <= 1.35e-46) {
tmp = x / (a * -z);
} 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+150)) then
tmp = y / a
else if (z <= (-3.45d+28)) then
tmp = y * (-z / t)
else if (z <= 4.1d-141) then
tmp = x / t
else if (z <= 1.35d-46) then
tmp = x / (a * -z)
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+150) {
tmp = y / a;
} else if (z <= -3.45e+28) {
tmp = y * (-z / t);
} else if (z <= 4.1e-141) {
tmp = x / t;
} else if (z <= 1.35e-46) {
tmp = x / (a * -z);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.9e+150: tmp = y / a elif z <= -3.45e+28: tmp = y * (-z / t) elif z <= 4.1e-141: tmp = x / t elif z <= 1.35e-46: tmp = x / (a * -z) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.9e+150) tmp = Float64(y / a); elseif (z <= -3.45e+28) tmp = Float64(y * Float64(Float64(-z) / t)); elseif (z <= 4.1e-141) tmp = Float64(x / t); elseif (z <= 1.35e-46) tmp = Float64(x / Float64(a * Float64(-z))); 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+150) tmp = y / a; elseif (z <= -3.45e+28) tmp = y * (-z / t); elseif (z <= 4.1e-141) tmp = x / t; elseif (z <= 1.35e-46) tmp = x / (a * -z); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.9e+150], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.45e+28], N[(y * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.1e-141], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.35e-46], N[(x / N[(a * (-z)), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+150}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.45 \cdot 10^{+28}:\\
\;\;\;\;y \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-141}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-46}:\\
\;\;\;\;\frac{x}{a \cdot \left(-z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.89999999999999995e150 or 1.35e-46 < z Initial program 71.0%
*-commutative71.0%
Simplified71.0%
Taylor expanded in z around inf 60.4%
if -1.89999999999999995e150 < z < -3.45e28Initial program 85.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in t around inf 61.9%
*-commutative61.9%
Simplified61.9%
Taylor expanded in x around -inf 57.0%
associate-*r*57.0%
neg-mul-157.0%
associate-/l*56.5%
*-commutative56.5%
Simplified56.5%
Taylor expanded in x around 0 48.3%
mul-1-neg48.3%
associate-/l*53.2%
distribute-rgt-neg-in53.2%
distribute-neg-frac253.2%
Simplified53.2%
if -3.45e28 < z < 4.10000000000000002e-141Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 57.7%
if 4.10000000000000002e-141 < z < 1.35e-46Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 63.9%
Taylor expanded in t around 0 46.3%
associate-*r/46.3%
mul-1-neg46.3%
*-commutative46.3%
Simplified46.3%
Final simplification57.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ y (- a (/ t z)))))
(if (<= z -3.1e+60)
t_1
(if (<= z -2.2e-122)
(/ (- x (* y z)) t)
(if (<= z 2.2e-54) (/ x (- t (* z a))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a - (t / z));
double tmp;
if (z <= -3.1e+60) {
tmp = t_1;
} else if (z <= -2.2e-122) {
tmp = (x - (y * z)) / t;
} else if (z <= 2.2e-54) {
tmp = x / (t - (z * a));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y / (a - (t / z))
if (z <= (-3.1d+60)) then
tmp = t_1
else if (z <= (-2.2d-122)) then
tmp = (x - (y * z)) / t
else if (z <= 2.2d-54) then
tmp = x / (t - (z * a))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a - (t / z));
double tmp;
if (z <= -3.1e+60) {
tmp = t_1;
} else if (z <= -2.2e-122) {
tmp = (x - (y * z)) / t;
} else if (z <= 2.2e-54) {
tmp = x / (t - (z * a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y / (a - (t / z)) tmp = 0 if z <= -3.1e+60: tmp = t_1 elif z <= -2.2e-122: tmp = (x - (y * z)) / t elif z <= 2.2e-54: tmp = x / (t - (z * a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y / Float64(a - Float64(t / z))) tmp = 0.0 if (z <= -3.1e+60) tmp = t_1; elseif (z <= -2.2e-122) tmp = Float64(Float64(x - Float64(y * z)) / t); elseif (z <= 2.2e-54) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y / (a - (t / z)); tmp = 0.0; if (z <= -3.1e+60) tmp = t_1; elseif (z <= -2.2e-122) tmp = (x - (y * z)) / t; elseif (z <= 2.2e-54) tmp = x / (t - (z * a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.1e+60], t$95$1, If[LessEqual[z, -2.2e-122], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 2.2e-54], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-122}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.1000000000000001e60 or 2.2e-54 < z Initial program 73.1%
*-commutative73.1%
Simplified73.1%
Taylor expanded in z around inf 73.1%
Taylor expanded in x around 0 78.7%
associate-*r/78.7%
neg-mul-178.7%
Simplified78.7%
if -3.1000000000000001e60 < z < -2.2e-122Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 79.0%
*-commutative79.0%
Simplified79.0%
if -2.2e-122 < z < 2.2e-54Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 76.5%
Final simplification77.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -7e+176) (/ (- y (/ x z)) a) (if (<= z 3.9e+114) (/ (- x (* y z)) (- t (* z a))) (/ y (- a (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e+176) {
tmp = (y - (x / z)) / a;
} else if (z <= 3.9e+114) {
tmp = (x - (y * z)) / (t - (z * a));
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-7d+176)) then
tmp = (y - (x / z)) / a
else if (z <= 3.9d+114) then
tmp = (x - (y * z)) / (t - (z * a))
else
tmp = y / (a - (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e+176) {
tmp = (y - (x / z)) / a;
} else if (z <= 3.9e+114) {
tmp = (x - (y * z)) / (t - (z * a));
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7e+176: tmp = (y - (x / z)) / a elif z <= 3.9e+114: tmp = (x - (y * z)) / (t - (z * a)) else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7e+176) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 3.9e+114) tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7e+176) tmp = (y - (x / z)) / a; elseif (z <= 3.9e+114) tmp = (x - (y * z)) / (t - (z * a)); else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7e+176], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 3.9e+114], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+176}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+114}:\\
\;\;\;\;\frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -7.00000000000000005e176Initial program 44.3%
*-commutative44.3%
Simplified44.3%
Taylor expanded in z around inf 44.3%
div-sub44.3%
Applied egg-rr44.3%
div-sub44.3%
associate-/r*72.5%
Simplified72.5%
Taylor expanded in t around 0 42.9%
mul-1-neg42.9%
sub-neg42.9%
remove-double-neg42.9%
distribute-neg-in42.9%
+-commutative42.9%
sub-neg42.9%
*-commutative42.9%
distribute-frac-neg42.9%
remove-double-neg42.9%
associate-/r*71.0%
div-sub71.0%
associate-/l*98.6%
*-inverses98.6%
*-rgt-identity98.6%
Simplified98.6%
if -7.00000000000000005e176 < z < 3.9000000000000001e114Initial program 97.8%
if 3.9000000000000001e114 < z Initial program 61.4%
*-commutative61.4%
Simplified61.4%
Taylor expanded in z around inf 61.4%
Taylor expanded in x around 0 80.0%
associate-*r/80.0%
neg-mul-180.0%
Simplified80.0%
Final simplification94.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.9e+150)
(/ y a)
(if (<= z -3.3e+29)
(* y (/ (- z) t))
(if (<= z 4.1e-141) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.9e+150) {
tmp = y / a;
} else if (z <= -3.3e+29) {
tmp = y * (-z / t);
} else if (z <= 4.1e-141) {
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+150)) then
tmp = y / a
else if (z <= (-3.3d+29)) then
tmp = y * (-z / t)
else if (z <= 4.1d-141) 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+150) {
tmp = y / a;
} else if (z <= -3.3e+29) {
tmp = y * (-z / t);
} else if (z <= 4.1e-141) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.9e+150: tmp = y / a elif z <= -3.3e+29: tmp = y * (-z / t) elif z <= 4.1e-141: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.9e+150) tmp = Float64(y / a); elseif (z <= -3.3e+29) tmp = Float64(y * Float64(Float64(-z) / t)); elseif (z <= 4.1e-141) 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+150) tmp = y / a; elseif (z <= -3.3e+29) tmp = y * (-z / t); elseif (z <= 4.1e-141) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.9e+150], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.3e+29], N[(y * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.1e-141], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+150}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-141}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.89999999999999995e150 or 4.10000000000000002e-141 < z Initial program 76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in z around inf 53.9%
if -1.89999999999999995e150 < z < -3.29999999999999984e29Initial program 85.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in t around inf 61.9%
*-commutative61.9%
Simplified61.9%
Taylor expanded in x around -inf 57.0%
associate-*r*57.0%
neg-mul-157.0%
associate-/l*56.5%
*-commutative56.5%
Simplified56.5%
Taylor expanded in x around 0 48.3%
mul-1-neg48.3%
associate-/l*53.2%
distribute-rgt-neg-in53.2%
distribute-neg-frac253.2%
Simplified53.2%
if -3.29999999999999984e29 < z < 4.10000000000000002e-141Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 57.7%
Final simplification55.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.5e+19) (not (<= t 5.2e+127))) (/ (- x (* y z)) t) (/ (- y (/ x z)) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.5e+19) || !(t <= 5.2e+127)) {
tmp = (x - (y * z)) / t;
} else {
tmp = (y - (x / 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 ((t <= (-2.5d+19)) .or. (.not. (t <= 5.2d+127))) then
tmp = (x - (y * z)) / t
else
tmp = (y - (x / 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 ((t <= -2.5e+19) || !(t <= 5.2e+127)) {
tmp = (x - (y * z)) / t;
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.5e+19) or not (t <= 5.2e+127): tmp = (x - (y * z)) / t else: tmp = (y - (x / z)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.5e+19) || !(t <= 5.2e+127)) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(Float64(y - Float64(x / z)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.5e+19) || ~((t <= 5.2e+127))) tmp = (x - (y * z)) / t; else tmp = (y - (x / z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.5e+19], N[Not[LessEqual[t, 5.2e+127]], $MachinePrecision]], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{+19} \lor \neg \left(t \leq 5.2 \cdot 10^{+127}\right):\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if t < -2.5e19 or 5.2000000000000004e127 < t Initial program 84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in t around inf 79.2%
*-commutative79.2%
Simplified79.2%
if -2.5e19 < t < 5.2000000000000004e127Initial program 88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in z around inf 87.5%
div-sub86.2%
Applied egg-rr86.2%
div-sub87.5%
associate-/r*85.3%
Simplified85.3%
Taylor expanded in t around 0 63.5%
mul-1-neg63.5%
sub-neg63.5%
remove-double-neg63.5%
distribute-neg-in63.5%
+-commutative63.5%
sub-neg63.5%
*-commutative63.5%
distribute-frac-neg63.5%
remove-double-neg63.5%
associate-/r*64.4%
div-sub64.4%
associate-/l*70.5%
*-inverses70.5%
*-rgt-identity70.5%
Simplified70.5%
Final simplification73.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.8e+118) (not (<= z 5.5e+67))) (/ y a) (/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.8e+118) || !(z <= 5.5e+67)) {
tmp = y / 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 ((z <= (-4.8d+118)) .or. (.not. (z <= 5.5d+67))) then
tmp = y / 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 ((z <= -4.8e+118) || !(z <= 5.5e+67)) {
tmp = y / a;
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.8e+118) or not (z <= 5.5e+67): tmp = y / a else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.8e+118) || !(z <= 5.5e+67)) tmp = Float64(y / 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 ((z <= -4.8e+118) || ~((z <= 5.5e+67))) tmp = y / a; else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.8e+118], N[Not[LessEqual[z, 5.5e+67]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+118} \lor \neg \left(z \leq 5.5 \cdot 10^{+67}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if z < -4.8e118 or 5.49999999999999968e67 < z Initial program 64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in z around inf 65.6%
if -4.8e118 < z < 5.49999999999999968e67Initial program 98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in t around inf 70.3%
*-commutative70.3%
Simplified70.3%
Final simplification68.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.72e+69) (not (<= z 4.8e-25))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.72e+69) || !(z <= 4.8e-25)) {
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 <= (-1.72d+69)) .or. (.not. (z <= 4.8d-25))) 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 <= -1.72e+69) || !(z <= 4.8e-25)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.72e+69) or not (z <= 4.8e-25): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.72e+69) || !(z <= 4.8e-25)) 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 <= -1.72e+69) || ~((z <= 4.8e-25))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.72e+69], N[Not[LessEqual[z, 4.8e-25]], $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 -1.72 \cdot 10^{+69} \lor \neg \left(z \leq 4.8 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.72e69 or 4.80000000000000018e-25 < z Initial program 71.3%
*-commutative71.3%
Simplified71.3%
Taylor expanded in z around inf 58.9%
if -1.72e69 < z < 4.80000000000000018e-25Initial program 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 67.2%
Final simplification63.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.5e+27) (not (<= z 4.1e-141))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.5e+27) || !(z <= 4.1e-141)) {
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 <= (-5.5d+27)) .or. (.not. (z <= 4.1d-141))) 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 <= -5.5e+27) || !(z <= 4.1e-141)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.5e+27) or not (z <= 4.1e-141): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.5e+27) || !(z <= 4.1e-141)) 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 <= -5.5e+27) || ~((z <= 4.1e-141))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.5e+27], N[Not[LessEqual[z, 4.1e-141]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+27} \lor \neg \left(z \leq 4.1 \cdot 10^{-141}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -5.49999999999999966e27 or 4.10000000000000002e-141 < z Initial program 78.2%
*-commutative78.2%
Simplified78.2%
Taylor expanded in z around inf 50.8%
if -5.49999999999999966e27 < z < 4.10000000000000002e-141Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 58.2%
Final simplification53.8%
(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 87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in z around 0 33.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 2024148
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))
(/ (- x (* y z)) (- t (* a z))))