
(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 (- (* z a) t))
(t_2 (- (/ y (/ t_1 z)) (/ x t_1)))
(t_3 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_3 -5e-296)
t_2
(if (<= t_3 0.0)
(/ y (- a (/ t z)))
(if (<= t_3 INFINITY) t_2 (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * a) - t;
double t_2 = (y / (t_1 / z)) - (x / t_1);
double t_3 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_3 <= -5e-296) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = y / (a - (t / 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 = (z * a) - t;
double t_2 = (y / (t_1 / z)) - (x / t_1);
double t_3 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_3 <= -5e-296) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = y / (a - (t / 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 = (z * a) - t t_2 = (y / (t_1 / z)) - (x / t_1) t_3 = (x - (y * z)) / (t - (z * a)) tmp = 0 if t_3 <= -5e-296: tmp = t_2 elif t_3 <= 0.0: tmp = y / (a - (t / 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(Float64(z * a) - t) t_2 = Float64(Float64(y / Float64(t_1 / z)) - Float64(x / t_1)) t_3 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) tmp = 0.0 if (t_3 <= -5e-296) tmp = t_2; elseif (t_3 <= 0.0) tmp = Float64(y / Float64(a - Float64(t / 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 = (z * a) - t; t_2 = (y / (t_1 / z)) - (x / t_1); t_3 = (x - (y * z)) / (t - (z * a)); tmp = 0.0; if (t_3 <= -5e-296) tmp = t_2; elseif (t_3 <= 0.0) tmp = y / (a - (t / 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[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision] - N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-296], t$95$2, If[LessEqual[t$95$3, 0.0], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$2, N[(y / a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot a - t\\
t_2 := \frac{y}{\frac{t_1}{z}} - \frac{x}{t_1}\\
t_3 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t_3 \leq -5 \cdot 10^{-296}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;\frac{y}{a - \frac{t}{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))) < -5.0000000000000003e-296 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 92.5%
sub-neg92.5%
+-commutative92.5%
neg-sub092.5%
associate-+l-92.5%
sub0-neg92.5%
neg-mul-192.5%
sub-neg92.5%
+-commutative92.5%
neg-sub092.5%
associate-+l-92.5%
sub0-neg92.5%
neg-mul-192.5%
times-frac92.5%
metadata-eval92.5%
*-lft-identity92.5%
*-commutative92.5%
Simplified92.5%
div-sub92.0%
associate-/l*98.9%
Applied egg-rr98.9%
if -5.0000000000000003e-296 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0Initial program 61.7%
sub-neg61.7%
+-commutative61.7%
neg-sub061.7%
associate-+l-61.7%
sub0-neg61.7%
neg-mul-161.7%
sub-neg61.7%
+-commutative61.7%
neg-sub061.7%
associate-+l-61.7%
sub0-neg61.7%
neg-mul-161.7%
times-frac61.7%
metadata-eval61.7%
*-lft-identity61.7%
*-commutative61.7%
Simplified61.7%
clear-num61.7%
inv-pow61.7%
Applied egg-rr61.7%
div-sub56.3%
*-commutative56.3%
*-commutative56.3%
Applied egg-rr56.3%
Taylor expanded in y around inf 84.7%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 0.0%
sub-neg0.0%
+-commutative0.0%
neg-sub00.0%
associate-+l-0.0%
sub0-neg0.0%
neg-mul-10.0%
sub-neg0.0%
+-commutative0.0%
neg-sub00.0%
associate-+l-0.0%
sub0-neg0.0%
neg-mul-10.0%
times-frac0.0%
metadata-eval0.0%
*-lft-identity0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification96.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.1e+14)
(/ y a)
(if (<= z -3.25e-52)
(/ (- x) (* z a))
(if (<= z -6.7e-71)
(/ y a)
(if (<= z 9.5e-166)
(/ x t)
(if (<= z 1.25e+52) (* y (/ (- z) t)) (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+14) {
tmp = y / a;
} else if (z <= -3.25e-52) {
tmp = -x / (z * a);
} else if (z <= -6.7e-71) {
tmp = y / a;
} else if (z <= 9.5e-166) {
tmp = x / t;
} else if (z <= 1.25e+52) {
tmp = 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 <= (-2.1d+14)) then
tmp = y / a
else if (z <= (-3.25d-52)) then
tmp = -x / (z * a)
else if (z <= (-6.7d-71)) then
tmp = y / a
else if (z <= 9.5d-166) then
tmp = x / t
else if (z <= 1.25d+52) then
tmp = 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 <= -2.1e+14) {
tmp = y / a;
} else if (z <= -3.25e-52) {
tmp = -x / (z * a);
} else if (z <= -6.7e-71) {
tmp = y / a;
} else if (z <= 9.5e-166) {
tmp = x / t;
} else if (z <= 1.25e+52) {
tmp = y * (-z / t);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.1e+14: tmp = y / a elif z <= -3.25e-52: tmp = -x / (z * a) elif z <= -6.7e-71: tmp = y / a elif z <= 9.5e-166: tmp = x / t elif z <= 1.25e+52: tmp = y * (-z / t) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e+14) tmp = Float64(y / a); elseif (z <= -3.25e-52) tmp = Float64(Float64(-x) / Float64(z * a)); elseif (z <= -6.7e-71) tmp = Float64(y / a); elseif (z <= 9.5e-166) tmp = Float64(x / t); elseif (z <= 1.25e+52) tmp = Float64(y * Float64(Float64(-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 <= -2.1e+14) tmp = y / a; elseif (z <= -3.25e-52) tmp = -x / (z * a); elseif (z <= -6.7e-71) tmp = y / a; elseif (z <= 9.5e-166) tmp = x / t; elseif (z <= 1.25e+52) tmp = y * (-z / t); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+14], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.25e-52], N[((-x) / N[(z * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -6.7e-71], N[(y / a), $MachinePrecision], If[LessEqual[z, 9.5e-166], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.25e+52], N[(y * N[((-z) / t), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+14}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.25 \cdot 10^{-52}:\\
\;\;\;\;\frac{-x}{z \cdot a}\\
\mathbf{elif}\;z \leq -6.7 \cdot 10^{-71}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-166}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+52}:\\
\;\;\;\;y \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.1e14 or -3.25e-52 < z < -6.6999999999999998e-71 or 1.25e52 < z Initial program 68.3%
sub-neg68.3%
+-commutative68.3%
neg-sub068.3%
associate-+l-68.3%
sub0-neg68.3%
neg-mul-168.3%
sub-neg68.3%
+-commutative68.3%
neg-sub068.3%
associate-+l-68.3%
sub0-neg68.3%
neg-mul-168.3%
times-frac68.3%
metadata-eval68.3%
*-lft-identity68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in z around inf 59.9%
if -2.1e14 < z < -3.25e-52Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
times-frac99.7%
metadata-eval99.7%
*-lft-identity99.7%
*-commutative99.7%
Simplified99.7%
div-sub99.7%
associate-/l*99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 71.8%
associate-*r/71.8%
neg-mul-171.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in z around inf 60.3%
if -6.6999999999999998e-71 < z < 9.50000000000000046e-166Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 66.2%
if 9.50000000000000046e-166 < z < 1.25e52Initial program 94.9%
sub-neg94.9%
+-commutative94.9%
neg-sub094.9%
associate-+l-94.9%
sub0-neg94.9%
neg-mul-194.9%
sub-neg94.9%
+-commutative94.9%
neg-sub094.9%
associate-+l-94.9%
sub0-neg94.9%
neg-mul-194.9%
times-frac94.9%
metadata-eval94.9%
*-lft-identity94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in y around inf 53.1%
*-commutative53.1%
associate-*r/57.9%
*-commutative57.9%
Simplified57.9%
Taylor expanded in z around 0 48.4%
associate-*r/48.4%
neg-mul-148.4%
Simplified48.4%
Final simplification60.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.15e+148) (not (<= z 1.4e+79))) (/ y (- a (/ t z))) (/ (- x (* y z)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e+148) || !(z <= 1.4e+79)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / (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.15d+148)) .or. (.not. (z <= 1.4d+79))) then
tmp = y / (a - (t / z))
else
tmp = (x - (y * z)) / (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.15e+148) || !(z <= 1.4e+79)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e+148) or not (z <= 1.4e+79): tmp = y / (a - (t / z)) else: tmp = (x - (y * z)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.15e+148) || !(z <= 1.4e+79)) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.15e+148) || ~((z <= 1.4e+79))) tmp = y / (a - (t / z)); else tmp = (x - (y * z)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e+148], N[Not[LessEqual[z, 1.4e+79]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+148} \lor \neg \left(z \leq 1.4 \cdot 10^{+79}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.15e148 or 1.4000000000000001e79 < z Initial program 56.4%
sub-neg56.4%
+-commutative56.4%
neg-sub056.4%
associate-+l-56.4%
sub0-neg56.4%
neg-mul-156.4%
sub-neg56.4%
+-commutative56.4%
neg-sub056.4%
associate-+l-56.4%
sub0-neg56.4%
neg-mul-156.4%
times-frac56.4%
metadata-eval56.4%
*-lft-identity56.4%
*-commutative56.4%
Simplified56.4%
clear-num56.3%
inv-pow56.3%
Applied egg-rr56.3%
div-sub54.8%
*-commutative54.8%
*-commutative54.8%
Applied egg-rr54.8%
Taylor expanded in y around inf 87.9%
if -1.15e148 < z < 1.4000000000000001e79Initial program 94.7%
Final simplification92.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.8e-68) (/ y a) (if (<= z 9.5e-166) (/ x t) (if (<= z 4.2e+54) (* y (/ (- z) t)) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.8e-68) {
tmp = y / a;
} else if (z <= 9.5e-166) {
tmp = x / t;
} else if (z <= 4.2e+54) {
tmp = 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 <= (-4.8d-68)) then
tmp = y / a
else if (z <= 9.5d-166) then
tmp = x / t
else if (z <= 4.2d+54) then
tmp = 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 <= -4.8e-68) {
tmp = y / a;
} else if (z <= 9.5e-166) {
tmp = x / t;
} else if (z <= 4.2e+54) {
tmp = y * (-z / t);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.8e-68: tmp = y / a elif z <= 9.5e-166: tmp = x / t elif z <= 4.2e+54: tmp = y * (-z / t) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.8e-68) tmp = Float64(y / a); elseif (z <= 9.5e-166) tmp = Float64(x / t); elseif (z <= 4.2e+54) tmp = Float64(y * Float64(Float64(-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 <= -4.8e-68) tmp = y / a; elseif (z <= 9.5e-166) tmp = x / t; elseif (z <= 4.2e+54) tmp = y * (-z / t); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.8e-68], N[(y / a), $MachinePrecision], If[LessEqual[z, 9.5e-166], N[(x / t), $MachinePrecision], If[LessEqual[z, 4.2e+54], N[(y * N[((-z) / t), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-68}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-166}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+54}:\\
\;\;\;\;y \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -4.79999999999999982e-68 or 4.19999999999999972e54 < z Initial program 72.2%
sub-neg72.2%
+-commutative72.2%
neg-sub072.2%
associate-+l-72.2%
sub0-neg72.2%
neg-mul-172.2%
sub-neg72.2%
+-commutative72.2%
neg-sub072.2%
associate-+l-72.2%
sub0-neg72.2%
neg-mul-172.2%
times-frac72.2%
metadata-eval72.2%
*-lft-identity72.2%
*-commutative72.2%
Simplified72.2%
Taylor expanded in z around inf 56.5%
if -4.79999999999999982e-68 < z < 9.50000000000000046e-166Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 66.2%
if 9.50000000000000046e-166 < z < 4.19999999999999972e54Initial program 94.9%
sub-neg94.9%
+-commutative94.9%
neg-sub094.9%
associate-+l-94.9%
sub0-neg94.9%
neg-mul-194.9%
sub-neg94.9%
+-commutative94.9%
neg-sub094.9%
associate-+l-94.9%
sub0-neg94.9%
neg-mul-194.9%
times-frac94.9%
metadata-eval94.9%
*-lft-identity94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in y around inf 53.1%
*-commutative53.1%
associate-*r/57.9%
*-commutative57.9%
Simplified57.9%
Taylor expanded in z around 0 48.4%
associate-*r/48.4%
neg-mul-148.4%
Simplified48.4%
Final simplification58.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.25e-38) (not (<= y 1.12e+27))) (/ y (- a (/ t z))) (/ (- x) (- (* z a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.25e-38) || !(y <= 1.12e+27)) {
tmp = y / (a - (t / z));
} else {
tmp = -x / ((z * a) - t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-1.25d-38)) .or. (.not. (y <= 1.12d+27))) then
tmp = y / (a - (t / z))
else
tmp = -x / ((z * a) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.25e-38) || !(y <= 1.12e+27)) {
tmp = y / (a - (t / z));
} else {
tmp = -x / ((z * a) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.25e-38) or not (y <= 1.12e+27): tmp = y / (a - (t / z)) else: tmp = -x / ((z * a) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.25e-38) || !(y <= 1.12e+27)) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(Float64(-x) / Float64(Float64(z * a) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.25e-38) || ~((y <= 1.12e+27))) tmp = y / (a - (t / z)); else tmp = -x / ((z * a) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.25e-38], N[Not[LessEqual[y, 1.12e+27]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-x) / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{-38} \lor \neg \left(y \leq 1.12 \cdot 10^{+27}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z \cdot a - t}\\
\end{array}
\end{array}
if y < -1.25000000000000008e-38 or 1.12e27 < y Initial program 75.6%
sub-neg75.6%
+-commutative75.6%
neg-sub075.6%
associate-+l-75.6%
sub0-neg75.6%
neg-mul-175.6%
sub-neg75.6%
+-commutative75.6%
neg-sub075.6%
associate-+l-75.6%
sub0-neg75.6%
neg-mul-175.6%
times-frac75.6%
metadata-eval75.6%
*-lft-identity75.6%
*-commutative75.6%
Simplified75.6%
clear-num75.4%
inv-pow75.4%
Applied egg-rr75.4%
div-sub73.2%
*-commutative73.2%
*-commutative73.2%
Applied egg-rr73.2%
Taylor expanded in y around inf 79.7%
if -1.25000000000000008e-38 < y < 1.12e27Initial program 93.7%
sub-neg93.7%
+-commutative93.7%
neg-sub093.7%
associate-+l-93.7%
sub0-neg93.7%
neg-mul-193.7%
sub-neg93.7%
+-commutative93.7%
neg-sub093.7%
associate-+l-93.7%
sub0-neg93.7%
neg-mul-193.7%
times-frac93.7%
metadata-eval93.7%
*-lft-identity93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in y around 0 81.4%
associate-*r/81.4%
neg-mul-181.4%
Simplified81.4%
Final simplification80.5%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.7e+73) (/ (/ (- x) a) z) (if (<= x 7.5e+100) (/ y (- a (/ t z))) (/ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.7e+73) {
tmp = (-x / a) / z;
} else if (x <= 7.5e+100) {
tmp = y / (a - (t / z));
} 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 (x <= (-1.7d+73)) then
tmp = (-x / a) / z
else if (x <= 7.5d+100) then
tmp = y / (a - (t / z))
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 (x <= -1.7e+73) {
tmp = (-x / a) / z;
} else if (x <= 7.5e+100) {
tmp = y / (a - (t / z));
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.7e+73: tmp = (-x / a) / z elif x <= 7.5e+100: tmp = y / (a - (t / z)) else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.7e+73) tmp = Float64(Float64(Float64(-x) / a) / z); elseif (x <= 7.5e+100) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.7e+73) tmp = (-x / a) / z; elseif (x <= 7.5e+100) tmp = y / (a - (t / z)); else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.7e+73], N[(N[((-x) / a), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[x, 7.5e+100], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+73}:\\
\;\;\;\;\frac{\frac{-x}{a}}{z}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+100}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if x < -1.7000000000000001e73Initial program 81.7%
sub-neg81.7%
+-commutative81.7%
neg-sub081.7%
associate-+l-81.7%
sub0-neg81.7%
neg-mul-181.7%
sub-neg81.7%
+-commutative81.7%
neg-sub081.7%
associate-+l-81.7%
sub0-neg81.7%
neg-mul-181.7%
times-frac81.7%
metadata-eval81.7%
*-lft-identity81.7%
*-commutative81.7%
Simplified81.7%
div-sub81.7%
associate-/l*83.7%
Applied egg-rr83.7%
Taylor expanded in y around 0 67.3%
associate-*r/67.3%
neg-mul-167.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in z around inf 42.6%
mul-1-neg42.6%
associate-/r*54.6%
distribute-frac-neg54.6%
distribute-neg-frac54.6%
Simplified54.6%
if -1.7000000000000001e73 < x < 7.49999999999999983e100Initial program 84.0%
sub-neg84.0%
+-commutative84.0%
neg-sub084.0%
associate-+l-84.0%
sub0-neg84.0%
neg-mul-184.0%
sub-neg84.0%
+-commutative84.0%
neg-sub084.0%
associate-+l-84.0%
sub0-neg84.0%
neg-mul-184.0%
times-frac84.0%
metadata-eval84.0%
*-lft-identity84.0%
*-commutative84.0%
Simplified84.0%
clear-num83.8%
inv-pow83.8%
Applied egg-rr83.8%
div-sub82.0%
*-commutative82.0%
*-commutative82.0%
Applied egg-rr82.0%
Taylor expanded in y around inf 76.9%
if 7.49999999999999983e100 < x Initial program 86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
neg-mul-186.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
neg-mul-186.7%
times-frac86.7%
metadata-eval86.7%
*-lft-identity86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in z around 0 62.5%
Final simplification70.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -2.2e+71) (/ (- y (/ x z)) a) (if (<= x 1.25e+100) (/ y (- a (/ t z))) (/ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.2e+71) {
tmp = (y - (x / z)) / a;
} else if (x <= 1.25e+100) {
tmp = y / (a - (t / z));
} 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 (x <= (-2.2d+71)) then
tmp = (y - (x / z)) / a
else if (x <= 1.25d+100) then
tmp = y / (a - (t / z))
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 (x <= -2.2e+71) {
tmp = (y - (x / z)) / a;
} else if (x <= 1.25e+100) {
tmp = y / (a - (t / z));
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.2e+71: tmp = (y - (x / z)) / a elif x <= 1.25e+100: tmp = y / (a - (t / z)) else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.2e+71) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (x <= 1.25e+100) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.2e+71) tmp = (y - (x / z)) / a; elseif (x <= 1.25e+100) tmp = y / (a - (t / z)); else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.2e+71], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[x, 1.25e+100], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+71}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+100}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if x < -2.19999999999999995e71Initial program 81.7%
sub-neg81.7%
+-commutative81.7%
neg-sub081.7%
associate-+l-81.7%
sub0-neg81.7%
neg-mul-181.7%
sub-neg81.7%
+-commutative81.7%
neg-sub081.7%
associate-+l-81.7%
sub0-neg81.7%
neg-mul-181.7%
times-frac81.7%
metadata-eval81.7%
*-lft-identity81.7%
*-commutative81.7%
Simplified81.7%
div-sub81.7%
associate-/l*83.7%
Applied egg-rr83.7%
Taylor expanded in a around inf 68.8%
if -2.19999999999999995e71 < x < 1.25e100Initial program 84.0%
sub-neg84.0%
+-commutative84.0%
neg-sub084.0%
associate-+l-84.0%
sub0-neg84.0%
neg-mul-184.0%
sub-neg84.0%
+-commutative84.0%
neg-sub084.0%
associate-+l-84.0%
sub0-neg84.0%
neg-mul-184.0%
times-frac84.0%
metadata-eval84.0%
*-lft-identity84.0%
*-commutative84.0%
Simplified84.0%
clear-num83.8%
inv-pow83.8%
Applied egg-rr83.8%
div-sub82.0%
*-commutative82.0%
*-commutative82.0%
Applied egg-rr82.0%
Taylor expanded in y around inf 76.9%
if 1.25e100 < x Initial program 86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
neg-mul-186.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
neg-mul-186.7%
times-frac86.7%
metadata-eval86.7%
*-lft-identity86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in z around 0 62.5%
Final simplification73.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -7e-69) (/ y a) (if (<= z 9e+34) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e-69) {
tmp = y / a;
} else if (z <= 9e+34) {
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 <= (-7d-69)) then
tmp = y / a
else if (z <= 9d+34) 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 <= -7e-69) {
tmp = y / a;
} else if (z <= 9e+34) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7e-69: tmp = y / a elif z <= 9e+34: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7e-69) tmp = Float64(y / a); elseif (z <= 9e+34) 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 <= -7e-69) tmp = y / a; elseif (z <= 9e+34) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7e-69], N[(y / a), $MachinePrecision], If[LessEqual[z, 9e+34], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-69}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+34}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -7.0000000000000003e-69 or 9.0000000000000001e34 < z Initial program 72.7%
sub-neg72.7%
+-commutative72.7%
neg-sub072.7%
associate-+l-72.7%
sub0-neg72.7%
neg-mul-172.7%
sub-neg72.7%
+-commutative72.7%
neg-sub072.7%
associate-+l-72.7%
sub0-neg72.7%
neg-mul-172.7%
times-frac72.7%
metadata-eval72.7%
*-lft-identity72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in z around inf 55.7%
if -7.0000000000000003e-69 < z < 9.0000000000000001e34Initial program 98.2%
sub-neg98.2%
+-commutative98.2%
neg-sub098.2%
associate-+l-98.2%
sub0-neg98.2%
neg-mul-198.2%
sub-neg98.2%
+-commutative98.2%
neg-sub098.2%
associate-+l-98.2%
sub0-neg98.2%
neg-mul-198.2%
times-frac98.2%
metadata-eval98.2%
*-lft-identity98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in z around 0 54.3%
Final simplification55.0%
(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.1%
sub-neg84.1%
+-commutative84.1%
neg-sub084.1%
associate-+l-84.1%
sub0-neg84.1%
neg-mul-184.1%
sub-neg84.1%
+-commutative84.1%
neg-sub084.1%
associate-+l-84.1%
sub0-neg84.1%
neg-mul-184.1%
times-frac84.1%
metadata-eval84.1%
*-lft-identity84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in z around 0 31.9%
Final simplification31.9%
(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 2023193
(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))))