
(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 (/ z t_1)) (/ x t_1)))
(t_3 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_3 -1e-303)
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 * (z / t_1)) - (x / t_1);
double t_3 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_3 <= -1e-303) {
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 * (z / t_1)) - (x / t_1);
double t_3 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_3 <= -1e-303) {
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 * (z / t_1)) - (x / t_1) t_3 = (x - (y * z)) / (t - (z * a)) tmp = 0 if t_3 <= -1e-303: 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(z / t_1)) - Float64(x / t_1)) t_3 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) tmp = 0.0 if (t_3 <= -1e-303) 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 * (z / t_1)) - (x / t_1); t_3 = (x - (y * z)) / (t - (z * a)); tmp = 0.0; if (t_3 <= -1e-303) 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[(z / t$95$1), $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, -1e-303], 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 := y \cdot \frac{z}{t_1} - \frac{x}{t_1}\\
t_3 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t_3 \leq -1 \cdot 10^{-303}:\\
\;\;\;\;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))) < -9.99999999999999931e-304 or -0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 92.8%
sub-neg92.8%
+-commutative92.8%
neg-sub092.8%
associate-+l-92.8%
sub0-neg92.8%
neg-mul-192.8%
sub-neg92.8%
+-commutative92.8%
neg-sub092.8%
associate-+l-92.8%
sub0-neg92.8%
neg-mul-192.8%
times-frac92.8%
metadata-eval92.8%
*-lft-identity92.8%
*-commutative92.8%
Simplified92.8%
div-sub92.8%
associate-/l*98.3%
Applied egg-rr98.3%
associate-/l*92.8%
*-commutative92.8%
associate-*l/98.9%
Applied egg-rr98.9%
if -9.99999999999999931e-304 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -0.0Initial program 67.3%
sub-neg67.3%
+-commutative67.3%
neg-sub067.3%
associate-+l-67.3%
sub0-neg67.3%
neg-mul-167.3%
sub-neg67.3%
+-commutative67.3%
neg-sub067.3%
associate-+l-67.3%
sub0-neg67.3%
neg-mul-167.3%
times-frac67.3%
metadata-eval67.3%
*-lft-identity67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
associate-*r/67.3%
*-commutative67.3%
Simplified67.3%
clear-num67.3%
*-commutative67.3%
div-inv67.3%
Applied egg-rr67.3%
Taylor expanded in z around 0 92.8%
neg-mul-192.8%
unsub-neg92.8%
Simplified92.8%
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 simplification98.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.72e+84) (not (<= z 1.15e+120))) (/ 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.72e+84) || !(z <= 1.15e+120)) {
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.72d+84)) .or. (.not. (z <= 1.15d+120))) 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.72e+84) || !(z <= 1.15e+120)) {
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.72e+84) or not (z <= 1.15e+120): 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.72e+84) || !(z <= 1.15e+120)) 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.72e+84) || ~((z <= 1.15e+120))) 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.72e+84], N[Not[LessEqual[z, 1.15e+120]], $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.72 \cdot 10^{+84} \lor \neg \left(z \leq 1.15 \cdot 10^{+120}\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.72e84 or 1.14999999999999996e120 < z Initial program 55.3%
sub-neg55.3%
+-commutative55.3%
neg-sub055.3%
associate-+l-55.3%
sub0-neg55.3%
neg-mul-155.3%
sub-neg55.3%
+-commutative55.3%
neg-sub055.3%
associate-+l-55.3%
sub0-neg55.3%
neg-mul-155.3%
times-frac55.3%
metadata-eval55.3%
*-lft-identity55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in y around inf 48.4%
*-commutative48.4%
associate-*r/62.6%
*-commutative62.6%
Simplified62.6%
clear-num62.6%
*-commutative62.6%
div-inv62.7%
Applied egg-rr62.7%
Taylor expanded in z around 0 90.1%
neg-mul-190.1%
unsub-neg90.1%
Simplified90.1%
if -1.72e84 < z < 1.14999999999999996e120Initial program 98.6%
Final simplification95.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ y (- a (/ t z)))))
(if (<= z -1.08e+56)
t_1
(if (<= z -1.16e-36)
(/ (- y (/ x z)) a)
(if (<= z 1.75e+80) (/ (- x (* y z)) t) 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 <= -1.08e+56) {
tmp = t_1;
} else if (z <= -1.16e-36) {
tmp = (y - (x / z)) / a;
} else if (z <= 1.75e+80) {
tmp = (x - (y * z)) / t;
} 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 <= (-1.08d+56)) then
tmp = t_1
else if (z <= (-1.16d-36)) then
tmp = (y - (x / z)) / a
else if (z <= 1.75d+80) then
tmp = (x - (y * z)) / t
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 <= -1.08e+56) {
tmp = t_1;
} else if (z <= -1.16e-36) {
tmp = (y - (x / z)) / a;
} else if (z <= 1.75e+80) {
tmp = (x - (y * z)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y / (a - (t / z)) tmp = 0 if z <= -1.08e+56: tmp = t_1 elif z <= -1.16e-36: tmp = (y - (x / z)) / a elif z <= 1.75e+80: tmp = (x - (y * z)) / t 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 <= -1.08e+56) tmp = t_1; elseif (z <= -1.16e-36) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 1.75e+80) tmp = Float64(Float64(x - Float64(y * z)) / t); 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 <= -1.08e+56) tmp = t_1; elseif (z <= -1.16e-36) tmp = (y - (x / z)) / a; elseif (z <= 1.75e+80) tmp = (x - (y * z)) / t; 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, -1.08e+56], t$95$1, If[LessEqual[z, -1.16e-36], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 1.75e+80], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -1.08 \cdot 10^{+56}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-36}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+80}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.07999999999999991e56 or 1.74999999999999997e80 < z Initial program 62.8%
sub-neg62.8%
+-commutative62.8%
neg-sub062.8%
associate-+l-62.8%
sub0-neg62.8%
neg-mul-162.8%
sub-neg62.8%
+-commutative62.8%
neg-sub062.8%
associate-+l-62.8%
sub0-neg62.8%
neg-mul-162.8%
times-frac62.8%
metadata-eval62.8%
*-lft-identity62.8%
*-commutative62.8%
Simplified62.8%
Taylor expanded in y around inf 51.2%
*-commutative51.2%
associate-*r/63.7%
*-commutative63.7%
Simplified63.7%
clear-num63.6%
*-commutative63.6%
div-inv63.7%
Applied egg-rr63.7%
Taylor expanded in z around 0 85.9%
neg-mul-185.9%
unsub-neg85.9%
Simplified85.9%
if -1.07999999999999991e56 < z < -1.16000000000000002e-36Initial 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.5%
associate-/l*99.5%
Applied egg-rr99.5%
Taylor expanded in a around inf 84.8%
if -1.16000000000000002e-36 < z < 1.74999999999999997e80Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around 0 74.1%
associate-*r/74.1%
neg-mul-174.1%
neg-sub074.1%
sub-neg74.1%
+-commutative74.1%
associate--r+74.1%
neg-sub074.1%
remove-double-neg74.1%
*-commutative74.1%
Simplified74.1%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.4e+56) (not (<= z 0.025))) (/ y (- a (/ t z))) (/ (- x) (- (* z a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e+56) || !(z <= 0.025)) {
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 ((z <= (-1.4d+56)) .or. (.not. (z <= 0.025d0))) 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 ((z <= -1.4e+56) || !(z <= 0.025)) {
tmp = y / (a - (t / z));
} else {
tmp = -x / ((z * a) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.4e+56) or not (z <= 0.025): tmp = y / (a - (t / z)) else: tmp = -x / ((z * a) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.4e+56) || !(z <= 0.025)) 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 ((z <= -1.4e+56) || ~((z <= 0.025))) 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[z, -1.4e+56], N[Not[LessEqual[z, 0.025]], $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}\;z \leq -1.4 \cdot 10^{+56} \lor \neg \left(z \leq 0.025\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z \cdot a - t}\\
\end{array}
\end{array}
if z < -1.40000000000000004e56 or 0.025000000000000001 < z Initial program 68.2%
sub-neg68.2%
+-commutative68.2%
neg-sub068.2%
associate-+l-68.2%
sub0-neg68.2%
neg-mul-168.2%
sub-neg68.2%
+-commutative68.2%
neg-sub068.2%
associate-+l-68.2%
sub0-neg68.2%
neg-mul-168.2%
times-frac68.2%
metadata-eval68.2%
*-lft-identity68.2%
*-commutative68.2%
Simplified68.2%
Taylor expanded in y around inf 52.5%
*-commutative52.5%
associate-*r/63.1%
*-commutative63.1%
Simplified63.1%
clear-num63.0%
*-commutative63.0%
div-inv63.1%
Applied egg-rr63.1%
Taylor expanded in z around 0 82.1%
neg-mul-182.1%
unsub-neg82.1%
Simplified82.1%
if -1.40000000000000004e56 < z < 0.025000000000000001Initial program 99.0%
sub-neg99.0%
+-commutative99.0%
neg-sub099.0%
associate-+l-99.0%
sub0-neg99.0%
neg-mul-199.0%
sub-neg99.0%
+-commutative99.0%
neg-sub099.0%
associate-+l-99.0%
sub0-neg99.0%
neg-mul-199.0%
times-frac99.0%
metadata-eval99.0%
*-lft-identity99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in y around 0 78.5%
neg-mul-178.5%
Simplified78.5%
Final simplification80.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.2e-120) (not (<= z 1.45e-75))) (/ y (- a (/ t z))) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.2e-120) || !(z <= 1.45e-75)) {
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 ((z <= (-2.2d-120)) .or. (.not. (z <= 1.45d-75))) 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 ((z <= -2.2e-120) || !(z <= 1.45e-75)) {
tmp = y / (a - (t / z));
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.2e-120) or not (z <= 1.45e-75): tmp = y / (a - (t / z)) else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.2e-120) || !(z <= 1.45e-75)) 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 ((z <= -2.2e-120) || ~((z <= 1.45e-75))) tmp = y / (a - (t / z)); else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.2e-120], N[Not[LessEqual[z, 1.45e-75]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-120} \lor \neg \left(z \leq 1.45 \cdot 10^{-75}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -2.20000000000000012e-120 or 1.4500000000000001e-75 < z 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%
Taylor expanded in y around inf 49.3%
*-commutative49.3%
associate-*r/57.6%
*-commutative57.6%
Simplified57.6%
clear-num57.1%
*-commutative57.1%
div-inv57.2%
Applied egg-rr57.2%
Taylor expanded in z around 0 71.4%
neg-mul-171.4%
unsub-neg71.4%
Simplified71.4%
if -2.20000000000000012e-120 < z < 1.4500000000000001e-75Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 72.5%
Final simplification71.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.05e-33) (not (<= z 1.75e+80))) (/ y (- a (/ t z))) (/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.05e-33) || !(z <= 1.75e+80)) {
tmp = y / (a - (t / z));
} 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 <= (-1.05d-33)) .or. (.not. (z <= 1.75d+80))) then
tmp = y / (a - (t / z))
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 <= -1.05e-33) || !(z <= 1.75e+80)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.05e-33) or not (z <= 1.75e+80): tmp = y / (a - (t / z)) else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.05e-33) || !(z <= 1.75e+80)) tmp = Float64(y / Float64(a - Float64(t / z))); 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 <= -1.05e-33) || ~((z <= 1.75e+80))) tmp = y / (a - (t / z)); else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.05e-33], N[Not[LessEqual[z, 1.75e+80]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-33} \lor \neg \left(z \leq 1.75 \cdot 10^{+80}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if z < -1.05e-33 or 1.74999999999999997e80 < z Initial program 65.9%
sub-neg65.9%
+-commutative65.9%
neg-sub065.9%
associate-+l-65.9%
sub0-neg65.9%
neg-mul-165.9%
sub-neg65.9%
+-commutative65.9%
neg-sub065.9%
associate-+l-65.9%
sub0-neg65.9%
neg-mul-165.9%
times-frac65.9%
metadata-eval65.9%
*-lft-identity65.9%
*-commutative65.9%
Simplified65.9%
Taylor expanded in y around inf 48.6%
*-commutative48.6%
associate-*r/60.4%
*-commutative60.4%
Simplified60.4%
clear-num60.4%
*-commutative60.4%
div-inv60.5%
Applied egg-rr60.5%
Taylor expanded in z around 0 80.4%
neg-mul-180.4%
unsub-neg80.4%
Simplified80.4%
if -1.05e-33 < z < 1.74999999999999997e80Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around 0 74.1%
associate-*r/74.1%
neg-mul-174.1%
neg-sub074.1%
sub-neg74.1%
+-commutative74.1%
associate--r+74.1%
neg-sub074.1%
remove-double-neg74.1%
*-commutative74.1%
Simplified74.1%
Final simplification77.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5.9e+110)
(/ y a)
(if (<= z -3.7e+45)
(* (- y) (/ z t))
(if (<= z 1.75e+80) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.9e+110) {
tmp = y / a;
} else if (z <= -3.7e+45) {
tmp = -y * (z / t);
} else if (z <= 1.75e+80) {
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 <= (-5.9d+110)) then
tmp = y / a
else if (z <= (-3.7d+45)) then
tmp = -y * (z / t)
else if (z <= 1.75d+80) 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 <= -5.9e+110) {
tmp = y / a;
} else if (z <= -3.7e+45) {
tmp = -y * (z / t);
} else if (z <= 1.75e+80) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.9e+110: tmp = y / a elif z <= -3.7e+45: tmp = -y * (z / t) elif z <= 1.75e+80: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.9e+110) tmp = Float64(y / a); elseif (z <= -3.7e+45) tmp = Float64(Float64(-y) * Float64(z / t)); elseif (z <= 1.75e+80) 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 <= -5.9e+110) tmp = y / a; elseif (z <= -3.7e+45) tmp = -y * (z / t); elseif (z <= 1.75e+80) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.9e+110], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.7e+45], N[((-y) * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e+80], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.9 \cdot 10^{+110}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{+45}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+80}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -5.8999999999999997e110 or 1.74999999999999997e80 < z Initial program 60.3%
sub-neg60.3%
+-commutative60.3%
neg-sub060.3%
associate-+l-60.3%
sub0-neg60.3%
neg-mul-160.3%
sub-neg60.3%
+-commutative60.3%
neg-sub060.3%
associate-+l-60.3%
sub0-neg60.3%
neg-mul-160.3%
times-frac60.3%
metadata-eval60.3%
*-lft-identity60.3%
*-commutative60.3%
Simplified60.3%
Taylor expanded in z around inf 73.9%
if -5.8999999999999997e110 < z < -3.69999999999999977e45Initial program 84.7%
sub-neg84.7%
+-commutative84.7%
neg-sub084.7%
associate-+l-84.7%
sub0-neg84.7%
neg-mul-184.7%
sub-neg84.7%
+-commutative84.7%
neg-sub084.7%
associate-+l-84.7%
sub0-neg84.7%
neg-mul-184.7%
times-frac84.7%
metadata-eval84.7%
*-lft-identity84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in y around inf 62.2%
*-commutative62.2%
associate-*r/70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in z around 0 62.3%
associate-*r/62.3%
neg-mul-162.3%
Simplified62.3%
if -3.69999999999999977e45 < z < 1.74999999999999997e80Initial program 99.1%
sub-neg99.1%
+-commutative99.1%
neg-sub099.1%
associate-+l-99.1%
sub0-neg99.1%
neg-mul-199.1%
sub-neg99.1%
+-commutative99.1%
neg-sub099.1%
associate-+l-99.1%
sub0-neg99.1%
neg-mul-199.1%
times-frac99.1%
metadata-eval99.1%
*-lft-identity99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in z around 0 55.8%
Final simplification63.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -8.6e+82) (/ y a) (if (<= z 8.5e+80) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.6e+82) {
tmp = y / a;
} else if (z <= 8.5e+80) {
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 <= (-8.6d+82)) then
tmp = y / a
else if (z <= 8.5d+80) 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 <= -8.6e+82) {
tmp = y / a;
} else if (z <= 8.5e+80) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.6e+82: tmp = y / a elif z <= 8.5e+80: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.6e+82) tmp = Float64(y / a); elseif (z <= 8.5e+80) 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 <= -8.6e+82) tmp = y / a; elseif (z <= 8.5e+80) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.6e+82], N[(y / a), $MachinePrecision], If[LessEqual[z, 8.5e+80], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+82}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+80}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -8.60000000000000029e82 or 8.50000000000000007e80 < z Initial program 61.3%
sub-neg61.3%
+-commutative61.3%
neg-sub061.3%
associate-+l-61.3%
sub0-neg61.3%
neg-mul-161.3%
sub-neg61.3%
+-commutative61.3%
neg-sub061.3%
associate-+l-61.3%
sub0-neg61.3%
neg-mul-161.3%
times-frac61.3%
metadata-eval61.3%
*-lft-identity61.3%
*-commutative61.3%
Simplified61.3%
Taylor expanded in z around inf 71.5%
if -8.60000000000000029e82 < z < 8.50000000000000007e80Initial program 98.5%
sub-neg98.5%
+-commutative98.5%
neg-sub098.5%
associate-+l-98.5%
sub0-neg98.5%
neg-mul-198.5%
sub-neg98.5%
+-commutative98.5%
neg-sub098.5%
associate-+l-98.5%
sub0-neg98.5%
neg-mul-198.5%
times-frac98.5%
metadata-eval98.5%
*-lft-identity98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in z around 0 54.1%
Final simplification61.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 83.4%
sub-neg83.4%
+-commutative83.4%
neg-sub083.4%
associate-+l-83.4%
sub0-neg83.4%
neg-mul-183.4%
sub-neg83.4%
+-commutative83.4%
neg-sub083.4%
associate-+l-83.4%
sub0-neg83.4%
neg-mul-183.4%
times-frac83.4%
metadata-eval83.4%
*-lft-identity83.4%
*-commutative83.4%
Simplified83.4%
Taylor expanded in z around 0 36.5%
Final simplification36.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2023213
(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))))