
(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 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_1 -2e-297)
t_1
(if (<= t_1 0.0)
(* (/ 1.0 z) (/ (- (* y z) x) a))
(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 <= -2e-297) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (1.0 / z) * (((y * z) - x) / a);
} 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 <= -2e-297) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (1.0 / z) * (((y * z) - x) / a);
} 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 <= -2e-297: tmp = t_1 elif t_1 <= 0.0: tmp = (1.0 / z) * (((y * z) - x) / a) 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 <= -2e-297) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(1.0 / z) * Float64(Float64(Float64(y * z) - x) / a)); 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 <= -2e-297) tmp = t_1; elseif (t_1 <= 0.0) tmp = (1.0 / z) * (((y * z) - x) / a); 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, -2e-297], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / a), $MachinePrecision]), $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 -2 \cdot 10^{-297}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{1}{z} \cdot \frac{y \cdot z - x}{a}\\
\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))) < -2.00000000000000008e-297 or 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 94.1%
if -2.00000000000000008e-297 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0Initial program 51.9%
*-commutative51.9%
Simplified51.9%
Taylor expanded in t around 0 23.8%
*-commutative23.8%
associate-*r/23.8%
neg-mul-123.8%
neg-sub023.8%
sub-neg23.8%
distribute-rgt-neg-out23.8%
+-commutative23.8%
associate--r+23.8%
neg-sub023.8%
distribute-rgt-neg-out23.8%
remove-double-neg23.8%
Simplified23.8%
*-un-lft-identity23.8%
times-frac78.4%
Applied egg-rr78.4%
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 simplification92.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.1e-41) (not (<= t 2.5e+36))) (/ (- x (* y z)) t) (* (/ 1.0 z) (/ (- (* y z) x) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.1e-41) || !(t <= 2.5e+36)) {
tmp = (x - (y * z)) / t;
} else {
tmp = (1.0 / z) * (((y * z) - x) / 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.1d-41)) .or. (.not. (t <= 2.5d+36))) then
tmp = (x - (y * z)) / t
else
tmp = (1.0d0 / z) * (((y * z) - x) / 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.1e-41) || !(t <= 2.5e+36)) {
tmp = (x - (y * z)) / t;
} else {
tmp = (1.0 / z) * (((y * z) - x) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.1e-41) or not (t <= 2.5e+36): tmp = (x - (y * z)) / t else: tmp = (1.0 / z) * (((y * z) - x) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.1e-41) || !(t <= 2.5e+36)) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(Float64(y * z) - x) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.1e-41) || ~((t <= 2.5e+36))) tmp = (x - (y * z)) / t; else tmp = (1.0 / z) * (((y * z) - x) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.1e-41], N[Not[LessEqual[t, 2.5e+36]], $MachinePrecision]], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-41} \lor \neg \left(t \leq 2.5 \cdot 10^{+36}\right):\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{y \cdot z - x}{a}\\
\end{array}
\end{array}
if t < -2.10000000000000013e-41 or 2.49999999999999988e36 < t Initial program 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in t around inf 74.1%
if -2.10000000000000013e-41 < t < 2.49999999999999988e36Initial program 84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in t around 0 66.9%
*-commutative66.9%
associate-*r/66.9%
neg-mul-166.9%
neg-sub066.9%
sub-neg66.9%
distribute-rgt-neg-out66.9%
+-commutative66.9%
associate--r+66.9%
neg-sub066.9%
distribute-rgt-neg-out66.9%
remove-double-neg66.9%
Simplified66.9%
*-un-lft-identity66.9%
times-frac73.4%
Applied egg-rr73.4%
Final simplification73.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -0.76)
(/ y a)
(if (<= z -3.2e-55)
(/ x (- t (* z a)))
(if (<= z 5.8e+14) (/ (- x (* y z)) t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.76) {
tmp = y / a;
} else if (z <= -3.2e-55) {
tmp = x / (t - (z * a));
} else if (z <= 5.8e+14) {
tmp = (x - (y * z)) / 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 <= (-0.76d0)) then
tmp = y / a
else if (z <= (-3.2d-55)) then
tmp = x / (t - (z * a))
else if (z <= 5.8d+14) then
tmp = (x - (y * z)) / 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 <= -0.76) {
tmp = y / a;
} else if (z <= -3.2e-55) {
tmp = x / (t - (z * a));
} else if (z <= 5.8e+14) {
tmp = (x - (y * z)) / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -0.76: tmp = y / a elif z <= -3.2e-55: tmp = x / (t - (z * a)) elif z <= 5.8e+14: tmp = (x - (y * z)) / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.76) tmp = Float64(y / a); elseif (z <= -3.2e-55) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 5.8e+14) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -0.76) tmp = y / a; elseif (z <= -3.2e-55) tmp = x / (t - (z * a)); elseif (z <= 5.8e+14) tmp = (x - (y * z)) / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.76], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.2e-55], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e+14], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.76:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-55}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -0.76000000000000001 or 5.8e14 < z Initial program 70.8%
*-commutative70.8%
Simplified70.8%
Taylor expanded in z around inf 60.2%
if -0.76000000000000001 < z < -3.2000000000000001e-55Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 78.2%
*-commutative78.2%
Simplified78.2%
if -3.2000000000000001e-55 < z < 5.8e14Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 77.1%
Final simplification68.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3.6e-6) (not (<= y 7.5e+39))) (* z (/ y (- (* z a) t))) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3.6e-6) || !(y <= 7.5e+39)) {
tmp = z * (y / ((z * a) - 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 ((y <= (-3.6d-6)) .or. (.not. (y <= 7.5d+39))) then
tmp = z * (y / ((z * a) - 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 ((y <= -3.6e-6) || !(y <= 7.5e+39)) {
tmp = z * (y / ((z * a) - t));
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3.6e-6) or not (y <= 7.5e+39): tmp = z * (y / ((z * a) - t)) else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3.6e-6) || !(y <= 7.5e+39)) tmp = Float64(z * Float64(y / Float64(Float64(z * a) - 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 ((y <= -3.6e-6) || ~((y <= 7.5e+39))) tmp = z * (y / ((z * a) - t)); else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3.6e-6], N[Not[LessEqual[y, 7.5e+39]], $MachinePrecision]], N[(z * N[(y / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{-6} \lor \neg \left(y \leq 7.5 \cdot 10^{+39}\right):\\
\;\;\;\;z \cdot \frac{y}{z \cdot a - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if y < -3.59999999999999984e-6 or 7.5000000000000005e39 < y Initial program 77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in x around 0 57.1%
associate-*r/57.1%
associate-*r*57.1%
neg-mul-157.1%
*-commutative57.1%
Simplified57.1%
frac-2neg57.1%
distribute-lft-neg-out57.1%
remove-double-neg57.1%
div-inv57.1%
*-commutative57.1%
neg-sub057.1%
associate--r-57.1%
neg-sub057.1%
Applied egg-rr57.1%
associate-*l*65.7%
associate-*r/65.7%
*-rgt-identity65.7%
+-commutative65.7%
unsub-neg65.7%
Simplified65.7%
if -3.59999999999999984e-6 < y < 7.5000000000000005e39Initial program 94.3%
*-commutative94.3%
Simplified94.3%
Taylor expanded in x around inf 76.2%
*-commutative76.2%
Simplified76.2%
Final simplification70.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* z a))))
(if (<= y -0.000175)
(/ (- z) (/ t_1 y))
(if (<= y 3.1e+38) (/ x t_1) (* z (/ y (- (* z a) t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double tmp;
if (y <= -0.000175) {
tmp = -z / (t_1 / y);
} else if (y <= 3.1e+38) {
tmp = x / t_1;
} else {
tmp = z * (y / ((z * a) - t));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = t - (z * a)
if (y <= (-0.000175d0)) then
tmp = -z / (t_1 / y)
else if (y <= 3.1d+38) then
tmp = x / t_1
else
tmp = z * (y / ((z * a) - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double tmp;
if (y <= -0.000175) {
tmp = -z / (t_1 / y);
} else if (y <= 3.1e+38) {
tmp = x / t_1;
} else {
tmp = z * (y / ((z * a) - t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (z * a) tmp = 0 if y <= -0.000175: tmp = -z / (t_1 / y) elif y <= 3.1e+38: tmp = x / t_1 else: tmp = z * (y / ((z * a) - t)) return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) tmp = 0.0 if (y <= -0.000175) tmp = Float64(Float64(-z) / Float64(t_1 / y)); elseif (y <= 3.1e+38) tmp = Float64(x / t_1); else tmp = Float64(z * Float64(y / Float64(Float64(z * a) - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (z * a); tmp = 0.0; if (y <= -0.000175) tmp = -z / (t_1 / y); elseif (y <= 3.1e+38) tmp = x / t_1; else tmp = z * (y / ((z * a) - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.000175], N[((-z) / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+38], N[(x / t$95$1), $MachinePrecision], N[(z * N[(y / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;y \leq -0.000175:\\
\;\;\;\;\frac{-z}{\frac{t_1}{y}}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+38}:\\
\;\;\;\;\frac{x}{t_1}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z \cdot a - t}\\
\end{array}
\end{array}
if y < -1.74999999999999998e-4Initial program 81.2%
*-commutative81.2%
Simplified81.2%
Taylor expanded in x around 0 56.6%
associate-*r/56.6%
mul-1-neg56.6%
distribute-rgt-neg-out56.6%
*-commutative56.6%
*-commutative56.6%
associate-/l*63.6%
Simplified63.6%
if -1.74999999999999998e-4 < y < 3.10000000000000018e38Initial program 94.3%
*-commutative94.3%
Simplified94.3%
Taylor expanded in x around inf 76.2%
*-commutative76.2%
Simplified76.2%
if 3.10000000000000018e38 < y Initial program 73.2%
*-commutative73.2%
Simplified73.2%
Taylor expanded in x around 0 57.7%
associate-*r/57.7%
associate-*r*57.7%
neg-mul-157.7%
*-commutative57.7%
Simplified57.7%
frac-2neg57.7%
distribute-lft-neg-out57.7%
remove-double-neg57.7%
div-inv57.7%
*-commutative57.7%
neg-sub057.7%
associate--r-57.7%
neg-sub057.7%
Applied egg-rr57.7%
associate-*l*68.0%
associate-*r/67.9%
*-rgt-identity67.9%
+-commutative67.9%
unsub-neg67.9%
Simplified67.9%
Final simplification70.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.4e-8)
(/ y a)
(if (<= z -2.1e-100)
(/ (- x) (* z a))
(if (or (<= z -2.9e-105) (not (<= z 1.22e+14))) (/ y a) (/ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e-8) {
tmp = y / a;
} else if (z <= -2.1e-100) {
tmp = -x / (z * a);
} else if ((z <= -2.9e-105) || !(z <= 1.22e+14)) {
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 <= (-3.4d-8)) then
tmp = y / a
else if (z <= (-2.1d-100)) then
tmp = -x / (z * a)
else if ((z <= (-2.9d-105)) .or. (.not. (z <= 1.22d+14))) 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 <= -3.4e-8) {
tmp = y / a;
} else if (z <= -2.1e-100) {
tmp = -x / (z * a);
} else if ((z <= -2.9e-105) || !(z <= 1.22e+14)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.4e-8: tmp = y / a elif z <= -2.1e-100: tmp = -x / (z * a) elif (z <= -2.9e-105) or not (z <= 1.22e+14): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.4e-8) tmp = Float64(y / a); elseif (z <= -2.1e-100) tmp = Float64(Float64(-x) / Float64(z * a)); elseif ((z <= -2.9e-105) || !(z <= 1.22e+14)) 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 <= -3.4e-8) tmp = y / a; elseif (z <= -2.1e-100) tmp = -x / (z * a); elseif ((z <= -2.9e-105) || ~((z <= 1.22e+14))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.4e-8], N[(y / a), $MachinePrecision], If[LessEqual[z, -2.1e-100], N[((-x) / N[(z * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.9e-105], N[Not[LessEqual[z, 1.22e+14]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-8}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-100}:\\
\;\;\;\;\frac{-x}{z \cdot a}\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-105} \lor \neg \left(z \leq 1.22 \cdot 10^{+14}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -3.4e-8 or -2.10000000000000009e-100 < z < -2.90000000000000003e-105 or 1.22e14 < z Initial program 71.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in z around inf 61.0%
if -3.4e-8 < z < -2.10000000000000009e-100Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 51.5%
*-commutative51.5%
associate-*r/51.5%
neg-mul-151.5%
neg-sub051.5%
sub-neg51.5%
distribute-rgt-neg-out51.5%
+-commutative51.5%
associate--r+51.5%
neg-sub051.5%
distribute-rgt-neg-out51.5%
remove-double-neg51.5%
Simplified51.5%
Taylor expanded in y around 0 43.6%
mul-1-neg43.6%
Simplified43.6%
if -2.90000000000000003e-105 < z < 1.22e14Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 60.2%
Final simplification59.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -0.8) (not (<= z 2e+66))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.8) || !(z <= 2e+66)) {
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 <= (-0.8d0)) .or. (.not. (z <= 2d+66))) 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 <= -0.8) || !(z <= 2e+66)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -0.8) or not (z <= 2e+66): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -0.8) || !(z <= 2e+66)) 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 <= -0.8) || ~((z <= 2e+66))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -0.8], N[Not[LessEqual[z, 2e+66]], $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 -0.8 \lor \neg \left(z \leq 2 \cdot 10^{+66}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -0.80000000000000004 or 1.99999999999999989e66 < z Initial program 69.8%
*-commutative69.8%
Simplified69.8%
Taylor expanded in z around inf 62.8%
if -0.80000000000000004 < z < 1.99999999999999989e66Initial program 97.2%
*-commutative97.2%
Simplified97.2%
Taylor expanded in x around inf 69.2%
*-commutative69.2%
Simplified69.2%
Final simplification66.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.9e-105) (not (<= z 68000000000000.0))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.9e-105) || !(z <= 68000000000000.0)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-2.9d-105)) .or. (.not. (z <= 68000000000000.0d0))) then
tmp = y / a
else
tmp = x / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.9e-105) || !(z <= 68000000000000.0)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.9e-105) or not (z <= 68000000000000.0): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.9e-105) || !(z <= 68000000000000.0)) tmp = Float64(y / a); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.9e-105) || ~((z <= 68000000000000.0))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.9e-105], N[Not[LessEqual[z, 68000000000000.0]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-105} \lor \neg \left(z \leq 68000000000000\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -2.90000000000000003e-105 or 6.8e13 < z Initial program 74.4%
*-commutative74.4%
Simplified74.4%
Taylor expanded in z around inf 56.6%
if -2.90000000000000003e-105 < z < 6.8e13Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 60.2%
Final simplification58.2%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in z around 0 32.7%
Final simplification32.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2023301
(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))))