
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* z a))))
(if (<= z 3.7e+102)
(/ (fma (- z) y x) t_1)
(if (or (<= z 1.75e+198) (not (<= z 1e+267)))
(/ (- y (/ x z)) a)
(/ y (/ t_1 (- z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double tmp;
if (z <= 3.7e+102) {
tmp = fma(-z, y, x) / t_1;
} else if ((z <= 1.75e+198) || !(z <= 1e+267)) {
tmp = (y - (x / z)) / a;
} else {
tmp = y / (t_1 / -z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) tmp = 0.0 if (z <= 3.7e+102) tmp = Float64(fma(Float64(-z), y, x) / t_1); elseif ((z <= 1.75e+198) || !(z <= 1e+267)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(y / Float64(t_1 / Float64(-z))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 3.7e+102], N[(N[((-z) * y + x), $MachinePrecision] / t$95$1), $MachinePrecision], If[Or[LessEqual[z, 1.75e+198], N[Not[LessEqual[z, 1e+267]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(y / N[(t$95$1 / (-z)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;z \leq 3.7 \cdot 10^{+102}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, y, x\right)}{t\_1}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+198} \lor \neg \left(z \leq 10^{+267}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t\_1}{-z}}\\
\end{array}
\end{array}
if z < 3.70000000000000023e102Initial program 93.2%
*-commutative93.2%
Simplified93.2%
sub-neg93.2%
+-commutative93.2%
*-commutative93.2%
distribute-lft-neg-in93.2%
fma-def93.2%
Applied egg-rr93.2%
if 3.70000000000000023e102 < z < 1.75000000000000006e198 or 9.9999999999999997e266 < z Initial program 55.1%
*-commutative55.1%
Simplified55.1%
Taylor expanded in z around inf 71.2%
+-commutative71.2%
associate--l+71.2%
associate-/r*79.2%
associate-*r/79.2%
associate-/r*79.2%
associate-*r/79.2%
div-sub79.2%
distribute-lft-out--79.2%
associate-*r/79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified82.1%
Taylor expanded in a around inf 96.5%
if 1.75000000000000006e198 < z < 9.9999999999999997e266Initial program 76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in x around 0 68.1%
associate-*r/68.1%
mul-1-neg68.1%
distribute-rgt-neg-out68.1%
associate-/l*91.4%
*-commutative91.4%
Simplified91.4%
Final simplification93.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* z a)))
(t_2 (/ (- y (/ x z)) a))
(t_3 (/ y (/ t_1 (- z)))))
(if (<= z -1e-104)
t_2
(if (<= z 6.7e-128)
(/ (- x (* z y)) t)
(if (<= z 9.8e-62)
t_3
(if (<= z 2.5e-28)
(/ x t_1)
(if (or (<= z 1.3e+196) (not (<= z 1e+267))) t_2 t_3)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = (y - (x / z)) / a;
double t_3 = y / (t_1 / -z);
double tmp;
if (z <= -1e-104) {
tmp = t_2;
} else if (z <= 6.7e-128) {
tmp = (x - (z * y)) / t;
} else if (z <= 9.8e-62) {
tmp = t_3;
} else if (z <= 2.5e-28) {
tmp = x / t_1;
} else if ((z <= 1.3e+196) || !(z <= 1e+267)) {
tmp = t_2;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = t - (z * a)
t_2 = (y - (x / z)) / a
t_3 = y / (t_1 / -z)
if (z <= (-1d-104)) then
tmp = t_2
else if (z <= 6.7d-128) then
tmp = (x - (z * y)) / t
else if (z <= 9.8d-62) then
tmp = t_3
else if (z <= 2.5d-28) then
tmp = x / t_1
else if ((z <= 1.3d+196) .or. (.not. (z <= 1d+267))) then
tmp = t_2
else
tmp = t_3
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 t_2 = (y - (x / z)) / a;
double t_3 = y / (t_1 / -z);
double tmp;
if (z <= -1e-104) {
tmp = t_2;
} else if (z <= 6.7e-128) {
tmp = (x - (z * y)) / t;
} else if (z <= 9.8e-62) {
tmp = t_3;
} else if (z <= 2.5e-28) {
tmp = x / t_1;
} else if ((z <= 1.3e+196) || !(z <= 1e+267)) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (z * a) t_2 = (y - (x / z)) / a t_3 = y / (t_1 / -z) tmp = 0 if z <= -1e-104: tmp = t_2 elif z <= 6.7e-128: tmp = (x - (z * y)) / t elif z <= 9.8e-62: tmp = t_3 elif z <= 2.5e-28: tmp = x / t_1 elif (z <= 1.3e+196) or not (z <= 1e+267): tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) t_2 = Float64(Float64(y - Float64(x / z)) / a) t_3 = Float64(y / Float64(t_1 / Float64(-z))) tmp = 0.0 if (z <= -1e-104) tmp = t_2; elseif (z <= 6.7e-128) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 9.8e-62) tmp = t_3; elseif (z <= 2.5e-28) tmp = Float64(x / t_1); elseif ((z <= 1.3e+196) || !(z <= 1e+267)) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (z * a); t_2 = (y - (x / z)) / a; t_3 = y / (t_1 / -z); tmp = 0.0; if (z <= -1e-104) tmp = t_2; elseif (z <= 6.7e-128) tmp = (x - (z * y)) / t; elseif (z <= 9.8e-62) tmp = t_3; elseif (z <= 2.5e-28) tmp = x / t_1; elseif ((z <= 1.3e+196) || ~((z <= 1e+267))) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$3 = N[(y / N[(t$95$1 / (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e-104], t$95$2, If[LessEqual[z, 6.7e-128], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 9.8e-62], t$95$3, If[LessEqual[z, 2.5e-28], N[(x / t$95$1), $MachinePrecision], If[Or[LessEqual[z, 1.3e+196], N[Not[LessEqual[z, 1e+267]], $MachinePrecision]], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
t_2 := \frac{y - \frac{x}{z}}{a}\\
t_3 := \frac{y}{\frac{t\_1}{-z}}\\
\mathbf{if}\;z \leq -1 \cdot 10^{-104}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 6.7 \cdot 10^{-128}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-62}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-28}:\\
\;\;\;\;\frac{x}{t\_1}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+196} \lor \neg \left(z \leq 10^{+267}\right):\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if z < -9.99999999999999927e-105 or 2.5000000000000001e-28 < z < 1.30000000000000006e196 or 9.9999999999999997e266 < z Initial program 77.6%
*-commutative77.6%
Simplified77.6%
Taylor expanded in z around inf 59.6%
+-commutative59.6%
associate--l+59.6%
associate-/r*61.7%
associate-*r/61.7%
associate-/r*59.9%
associate-*r/59.9%
div-sub59.9%
distribute-lft-out--59.9%
associate-*r/59.9%
mul-1-neg59.9%
unsub-neg59.9%
Simplified66.7%
Taylor expanded in a around inf 80.8%
if -9.99999999999999927e-105 < z < 6.70000000000000027e-128Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 80.2%
if 6.70000000000000027e-128 < z < 9.8000000000000007e-62 or 1.30000000000000006e196 < z < 9.9999999999999997e266Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in x around 0 71.7%
associate-*r/71.7%
mul-1-neg71.7%
distribute-rgt-neg-out71.7%
associate-/l*81.0%
*-commutative81.0%
Simplified81.0%
if 9.8000000000000007e-62 < z < 2.5000000000000001e-28Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 81.1%
*-commutative81.1%
Simplified81.1%
Final simplification80.6%
(FPCore (x y z t a)
:precision binary64
(if (or (<= z -2e-105)
(not (or (<= z 6.5e-128) (and (not (<= z 4e-116)) (<= z 3.1e-28)))))
(/ (- y (/ x z)) a)
(/ (- x (* z y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2e-105) || !((z <= 6.5e-128) || (!(z <= 4e-116) && (z <= 3.1e-28)))) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / 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 <= (-2d-105)) .or. (.not. (z <= 6.5d-128) .or. (.not. (z <= 4d-116)) .and. (z <= 3.1d-28))) then
tmp = (y - (x / z)) / a
else
tmp = (x - (z * y)) / 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 <= -2e-105) || !((z <= 6.5e-128) || (!(z <= 4e-116) && (z <= 3.1e-28)))) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2e-105) or not ((z <= 6.5e-128) or (not (z <= 4e-116) and (z <= 3.1e-28))): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2e-105) || !((z <= 6.5e-128) || (!(z <= 4e-116) && (z <= 3.1e-28)))) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(x - Float64(z * y)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2e-105) || ~(((z <= 6.5e-128) || (~((z <= 4e-116)) && (z <= 3.1e-28))))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2e-105], N[Not[Or[LessEqual[z, 6.5e-128], And[N[Not[LessEqual[z, 4e-116]], $MachinePrecision], LessEqual[z, 3.1e-28]]]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-105} \lor \neg \left(z \leq 6.5 \cdot 10^{-128} \lor \neg \left(z \leq 4 \cdot 10^{-116}\right) \land z \leq 3.1 \cdot 10^{-28}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\end{array}
\end{array}
if z < -1.99999999999999993e-105 or 6.49999999999999977e-128 < z < 4e-116 or 3.09999999999999992e-28 < z Initial program 78.2%
*-commutative78.2%
Simplified78.2%
Taylor expanded in z around inf 59.5%
+-commutative59.5%
associate--l+59.5%
associate-/r*61.3%
associate-*r/61.3%
associate-/r*59.1%
associate-*r/59.1%
div-sub59.1%
distribute-lft-out--59.1%
associate-*r/59.1%
mul-1-neg59.1%
unsub-neg59.1%
Simplified65.1%
Taylor expanded in a around inf 79.0%
if -1.99999999999999993e-105 < z < 6.49999999999999977e-128 or 4e-116 < z < 3.09999999999999992e-28Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 78.2%
Final simplification78.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* z a))))
(if (<= z 2.8e+100)
(/ (- x (* z y)) t_1)
(if (or (<= z 3.3e+195) (not (<= z 1e+267)))
(/ (- y (/ x z)) a)
(/ y (/ t_1 (- z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double tmp;
if (z <= 2.8e+100) {
tmp = (x - (z * y)) / t_1;
} else if ((z <= 3.3e+195) || !(z <= 1e+267)) {
tmp = (y - (x / z)) / a;
} else {
tmp = y / (t_1 / -z);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = t - (z * a)
if (z <= 2.8d+100) then
tmp = (x - (z * y)) / t_1
else if ((z <= 3.3d+195) .or. (.not. (z <= 1d+267))) then
tmp = (y - (x / z)) / a
else
tmp = y / (t_1 / -z)
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 (z <= 2.8e+100) {
tmp = (x - (z * y)) / t_1;
} else if ((z <= 3.3e+195) || !(z <= 1e+267)) {
tmp = (y - (x / z)) / a;
} else {
tmp = y / (t_1 / -z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (z * a) tmp = 0 if z <= 2.8e+100: tmp = (x - (z * y)) / t_1 elif (z <= 3.3e+195) or not (z <= 1e+267): tmp = (y - (x / z)) / a else: tmp = y / (t_1 / -z) return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) tmp = 0.0 if (z <= 2.8e+100) tmp = Float64(Float64(x - Float64(z * y)) / t_1); elseif ((z <= 3.3e+195) || !(z <= 1e+267)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(y / Float64(t_1 / Float64(-z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (z * a); tmp = 0.0; if (z <= 2.8e+100) tmp = (x - (z * y)) / t_1; elseif ((z <= 3.3e+195) || ~((z <= 1e+267))) tmp = (y - (x / z)) / a; else tmp = y / (t_1 / -z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2.8e+100], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[Or[LessEqual[z, 3.3e+195], N[Not[LessEqual[z, 1e+267]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(y / N[(t$95$1 / (-z)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;z \leq 2.8 \cdot 10^{+100}:\\
\;\;\;\;\frac{x - z \cdot y}{t\_1}\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+195} \lor \neg \left(z \leq 10^{+267}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t\_1}{-z}}\\
\end{array}
\end{array}
if z < 2.7999999999999998e100Initial program 93.2%
if 2.7999999999999998e100 < z < 3.3e195 or 9.9999999999999997e266 < z Initial program 55.1%
*-commutative55.1%
Simplified55.1%
Taylor expanded in z around inf 71.2%
+-commutative71.2%
associate--l+71.2%
associate-/r*79.2%
associate-*r/79.2%
associate-/r*79.2%
associate-*r/79.2%
div-sub79.2%
distribute-lft-out--79.2%
associate-*r/79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified82.1%
Taylor expanded in a around inf 96.5%
if 3.3e195 < z < 9.9999999999999997e266Initial program 76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in x around 0 68.1%
associate-*r/68.1%
mul-1-neg68.1%
distribute-rgt-neg-out68.1%
associate-/l*91.4%
*-commutative91.4%
Simplified91.4%
Final simplification93.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.8e+28) (not (<= z 1e-30))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.8e+28) || !(z <= 1e-30)) {
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 <= (-7.8d+28)) .or. (.not. (z <= 1d-30))) 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 <= -7.8e+28) || !(z <= 1e-30)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.8e+28) or not (z <= 1e-30): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.8e+28) || !(z <= 1e-30)) 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 <= -7.8e+28) || ~((z <= 1e-30))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.8e+28], N[Not[LessEqual[z, 1e-30]], $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 -7.8 \cdot 10^{+28} \lor \neg \left(z \leq 10^{-30}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -7.7999999999999997e28 or 1e-30 < z Initial program 73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in z around inf 63.4%
if -7.7999999999999997e28 < z < 1e-30Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 64.0%
*-commutative64.0%
Simplified64.0%
Final simplification63.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.95e+28) (not (<= z 3.3e-29))) (/ y a) (/ (- x (* z y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.95e+28) || !(z <= 3.3e-29)) {
tmp = y / a;
} else {
tmp = (x - (z * y)) / 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.95d+28)) .or. (.not. (z <= 3.3d-29))) then
tmp = y / a
else
tmp = (x - (z * y)) / 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.95e+28) || !(z <= 3.3e-29)) {
tmp = y / a;
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.95e+28) or not (z <= 3.3e-29): tmp = y / a else: tmp = (x - (z * y)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.95e+28) || !(z <= 3.3e-29)) tmp = Float64(y / a); else tmp = Float64(Float64(x - Float64(z * y)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.95e+28) || ~((z <= 3.3e-29))) tmp = y / a; else tmp = (x - (z * y)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.95e+28], N[Not[LessEqual[z, 3.3e-29]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+28} \lor \neg \left(z \leq 3.3 \cdot 10^{-29}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\end{array}
\end{array}
if z < -1.9499999999999999e28 or 3.30000000000000028e-29 < z Initial program 73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in z around inf 63.4%
if -1.9499999999999999e28 < z < 3.30000000000000028e-29Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 69.3%
Final simplification66.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e-104) (not (<= z 6.7e-128))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e-104) || !(z <= 6.7e-128)) {
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 <= (-1d-104)) .or. (.not. (z <= 6.7d-128))) 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 <= -1e-104) || !(z <= 6.7e-128)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1e-104) or not (z <= 6.7e-128): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e-104) || !(z <= 6.7e-128)) 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 <= -1e-104) || ~((z <= 6.7e-128))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e-104], N[Not[LessEqual[z, 6.7e-128]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-104} \lor \neg \left(z \leq 6.7 \cdot 10^{-128}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -9.99999999999999927e-105 or 6.70000000000000027e-128 < z Initial program 80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in z around inf 56.2%
if -9.99999999999999927e-105 < z < 6.70000000000000027e-128Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 59.4%
Final simplification57.3%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in z around 0 29.5%
Final simplification29.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 2024034
(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))))