
(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 (if (or (<= z -1.12e+182) (not (<= z 4.5e+182))) (/ (- y) (- (/ t z) a)) (/ (- x (* z y)) (fma (- z) a t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.12e+182) || !(z <= 4.5e+182)) {
tmp = -y / ((t / z) - a);
} else {
tmp = (x - (z * y)) / fma(-z, a, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.12e+182) || !(z <= 4.5e+182)) tmp = Float64(Float64(-y) / Float64(Float64(t / z) - a)); else tmp = Float64(Float64(x - Float64(z * y)) / fma(Float64(-z), a, t)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.12e+182], N[Not[LessEqual[z, 4.5e+182]], $MachinePrecision]], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[((-z) * a + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+182} \lor \neg \left(z \leq 4.5 \cdot 10^{+182}\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{\mathsf{fma}\left(-z, a, t\right)}\\
\end{array}
\end{array}
if z < -1.11999999999999994e182 or 4.50000000000000029e182 < z Initial program 49.5%
*-commutative49.5%
Simplified49.5%
clear-num49.5%
inv-pow49.5%
sub-neg49.5%
+-commutative49.5%
*-commutative49.5%
distribute-rgt-neg-in49.5%
fma-def49.5%
Applied egg-rr49.5%
Taylor expanded in a around 0 43.4%
+-commutative43.4%
mul-1-neg43.4%
unsub-neg43.4%
associate-/l*55.2%
Simplified55.2%
Taylor expanded in y around -inf 91.6%
associate-*r/91.6%
mul-1-neg91.6%
Simplified91.6%
if -1.11999999999999994e182 < z < 4.50000000000000029e182Initial program 95.5%
*-commutative95.5%
Simplified95.5%
sub-neg95.5%
+-commutative95.5%
distribute-lft-neg-in95.5%
fma-def95.6%
Applied egg-rr95.6%
Final simplification94.8%
(FPCore (x y z t a)
:precision binary64
(if (or (<= y -3.65e+115)
(and (not (<= y -6.2e+71)) (or (<= y -1.95e+31) (not (<= y 9.5e-9)))))
(/ (- y) (- (/ t z) a))
(/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3.65e+115) || (!(y <= -6.2e+71) && ((y <= -1.95e+31) || !(y <= 9.5e-9)))) {
tmp = -y / ((t / z) - 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 ((y <= (-3.65d+115)) .or. (.not. (y <= (-6.2d+71))) .and. (y <= (-1.95d+31)) .or. (.not. (y <= 9.5d-9))) then
tmp = -y / ((t / z) - 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 ((y <= -3.65e+115) || (!(y <= -6.2e+71) && ((y <= -1.95e+31) || !(y <= 9.5e-9)))) {
tmp = -y / ((t / z) - a);
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3.65e+115) or (not (y <= -6.2e+71) and ((y <= -1.95e+31) or not (y <= 9.5e-9))): tmp = -y / ((t / z) - a) else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3.65e+115) || (!(y <= -6.2e+71) && ((y <= -1.95e+31) || !(y <= 9.5e-9)))) tmp = Float64(Float64(-y) / Float64(Float64(t / z) - 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 ((y <= -3.65e+115) || (~((y <= -6.2e+71)) && ((y <= -1.95e+31) || ~((y <= 9.5e-9))))) tmp = -y / ((t / z) - a); else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3.65e+115], And[N[Not[LessEqual[y, -6.2e+71]], $MachinePrecision], Or[LessEqual[y, -1.95e+31], N[Not[LessEqual[y, 9.5e-9]], $MachinePrecision]]]], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.65 \cdot 10^{+115} \lor \neg \left(y \leq -6.2 \cdot 10^{+71}\right) \land \left(y \leq -1.95 \cdot 10^{+31} \lor \neg \left(y \leq 9.5 \cdot 10^{-9}\right)\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if y < -3.64999999999999984e115 or -6.20000000000000036e71 < y < -1.95e31 or 9.5000000000000007e-9 < y Initial program 74.6%
*-commutative74.6%
Simplified74.6%
clear-num74.6%
inv-pow74.6%
sub-neg74.6%
+-commutative74.6%
*-commutative74.6%
distribute-rgt-neg-in74.6%
fma-def74.6%
Applied egg-rr74.6%
Taylor expanded in a around 0 70.3%
+-commutative70.3%
mul-1-neg70.3%
unsub-neg70.3%
associate-/l*73.7%
Simplified73.7%
Taylor expanded in y around -inf 72.1%
associate-*r/72.1%
mul-1-neg72.1%
Simplified72.1%
if -3.64999999999999984e115 < y < -6.20000000000000036e71 or -1.95e31 < y < 9.5000000000000007e-9Initial program 96.9%
*-commutative96.9%
Simplified96.9%
Taylor expanded in x around inf 83.3%
*-commutative83.3%
Simplified83.3%
Final simplification78.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* z a)))))
(if (<= z -1.02e+182)
(/ y a)
(if (<= z -1e-73)
t_1
(if (<= z -1.5e-111)
(/ (- x (* z y)) t)
(if (<= z 1e+80) t_1 (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (z <= -1.02e+182) {
tmp = y / a;
} else if (z <= -1e-73) {
tmp = t_1;
} else if (z <= -1.5e-111) {
tmp = (x - (z * y)) / t;
} else if (z <= 1e+80) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x / (t - (z * a))
if (z <= (-1.02d+182)) then
tmp = y / a
else if (z <= (-1d-73)) then
tmp = t_1
else if (z <= (-1.5d-111)) then
tmp = (x - (z * y)) / t
else if (z <= 1d+80) then
tmp = t_1
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 t_1 = x / (t - (z * a));
double tmp;
if (z <= -1.02e+182) {
tmp = y / a;
} else if (z <= -1e-73) {
tmp = t_1;
} else if (z <= -1.5e-111) {
tmp = (x - (z * y)) / t;
} else if (z <= 1e+80) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x / (t - (z * a)) tmp = 0 if z <= -1.02e+182: tmp = y / a elif z <= -1e-73: tmp = t_1 elif z <= -1.5e-111: tmp = (x - (z * y)) / t elif z <= 1e+80: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(z * a))) tmp = 0.0 if (z <= -1.02e+182) tmp = Float64(y / a); elseif (z <= -1e-73) tmp = t_1; elseif (z <= -1.5e-111) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 1e+80) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x / (t - (z * a)); tmp = 0.0; if (z <= -1.02e+182) tmp = y / a; elseif (z <= -1e-73) tmp = t_1; elseif (z <= -1.5e-111) tmp = (x - (z * y)) / t; elseif (z <= 1e+80) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.02e+182], N[(y / a), $MachinePrecision], If[LessEqual[z, -1e-73], t$95$1, If[LessEqual[z, -1.5e-111], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1e+80], t$95$1, N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{+182}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-111}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.02e182 or 1e80 < z Initial program 60.4%
*-commutative60.4%
Simplified60.4%
Taylor expanded in z around inf 73.9%
if -1.02e182 < z < -9.99999999999999997e-74 or -1.50000000000000004e-111 < z < 1e80Initial program 96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around inf 72.3%
*-commutative72.3%
Simplified72.3%
if -9.99999999999999997e-74 < z < -1.50000000000000004e-111Initial program 99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in t around inf 87.3%
Final simplification73.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.6e+75)
(/ y a)
(if (<= z 1.05e-95)
(/ x t)
(if (<= z 1.05e+80) (/ (- x) (* z a)) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.6e+75) {
tmp = y / a;
} else if (z <= 1.05e-95) {
tmp = x / t;
} else if (z <= 1.05e+80) {
tmp = -x / (z * a);
} 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 <= (-6.6d+75)) then
tmp = y / a
else if (z <= 1.05d-95) then
tmp = x / t
else if (z <= 1.05d+80) then
tmp = -x / (z * a)
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 <= -6.6e+75) {
tmp = y / a;
} else if (z <= 1.05e-95) {
tmp = x / t;
} else if (z <= 1.05e+80) {
tmp = -x / (z * a);
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.6e+75: tmp = y / a elif z <= 1.05e-95: tmp = x / t elif z <= 1.05e+80: tmp = -x / (z * a) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.6e+75) tmp = Float64(y / a); elseif (z <= 1.05e-95) tmp = Float64(x / t); elseif (z <= 1.05e+80) tmp = Float64(Float64(-x) / Float64(z * a)); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.6e+75) tmp = y / a; elseif (z <= 1.05e-95) tmp = x / t; elseif (z <= 1.05e+80) tmp = -x / (z * a); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.6e+75], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.05e-95], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.05e+80], N[((-x) / N[(z * a), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+75}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-95}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+80}:\\
\;\;\;\;\frac{-x}{z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -6.59999999999999996e75 or 1.05000000000000001e80 < z Initial program 67.5%
*-commutative67.5%
Simplified67.5%
Taylor expanded in z around inf 65.9%
if -6.59999999999999996e75 < z < 1.05e-95Initial program 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in z around 0 56.6%
if 1.05e-95 < z < 1.05000000000000001e80Initial program 96.3%
*-commutative96.3%
Simplified96.3%
clear-num96.0%
inv-pow96.0%
sub-neg96.0%
+-commutative96.0%
*-commutative96.0%
distribute-rgt-neg-in96.0%
fma-def96.1%
Applied egg-rr96.1%
Taylor expanded in a around 0 92.3%
+-commutative92.3%
mul-1-neg92.3%
unsub-neg92.3%
associate-/l*88.7%
Simplified88.7%
Taylor expanded in y around 0 64.2%
*-commutative64.2%
Simplified64.2%
Taylor expanded in t around 0 45.4%
associate-*r/45.4%
neg-mul-145.4%
*-commutative45.4%
Simplified45.4%
Final simplification58.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.3e+182) (not (<= z 4.5e+182))) (/ (- y) (- (/ t z) a)) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+182) || !(z <= 4.5e+182)) {
tmp = -y / ((t / z) - a);
} else {
tmp = (x - (z * y)) / (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 <= (-3.3d+182)) .or. (.not. (z <= 4.5d+182))) then
tmp = -y / ((t / z) - a)
else
tmp = (x - (z * y)) / (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 <= -3.3e+182) || !(z <= 4.5e+182)) {
tmp = -y / ((t / z) - a);
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.3e+182) or not (z <= 4.5e+182): tmp = -y / ((t / z) - a) else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.3e+182) || !(z <= 4.5e+182)) tmp = Float64(Float64(-y) / Float64(Float64(t / z) - a)); else tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.3e+182) || ~((z <= 4.5e+182))) tmp = -y / ((t / z) - a); else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.3e+182], N[Not[LessEqual[z, 4.5e+182]], $MachinePrecision]], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+182} \lor \neg \left(z \leq 4.5 \cdot 10^{+182}\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -3.3000000000000001e182 or 4.50000000000000029e182 < z Initial program 49.5%
*-commutative49.5%
Simplified49.5%
clear-num49.5%
inv-pow49.5%
sub-neg49.5%
+-commutative49.5%
*-commutative49.5%
distribute-rgt-neg-in49.5%
fma-def49.5%
Applied egg-rr49.5%
Taylor expanded in a around 0 43.4%
+-commutative43.4%
mul-1-neg43.4%
unsub-neg43.4%
associate-/l*55.2%
Simplified55.2%
Taylor expanded in y around -inf 91.6%
associate-*r/91.6%
mul-1-neg91.6%
Simplified91.6%
if -3.3000000000000001e182 < z < 4.50000000000000029e182Initial program 95.5%
Final simplification94.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.02e+182) (not (<= z 7e+79))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.02e+182) || !(z <= 7e+79)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.02d+182)) .or. (.not. (z <= 7d+79))) then
tmp = y / a
else
tmp = x / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.02e+182) || !(z <= 7e+79)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.02e+182) or not (z <= 7e+79): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.02e+182) || !(z <= 7e+79)) tmp = Float64(y / a); else tmp = Float64(x / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.02e+182) || ~((z <= 7e+79))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.02e+182], N[Not[LessEqual[z, 7e+79]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+182} \lor \neg \left(z \leq 7 \cdot 10^{+79}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.02e182 or 6.99999999999999961e79 < z Initial program 60.4%
*-commutative60.4%
Simplified60.4%
Taylor expanded in z around inf 73.9%
if -1.02e182 < z < 6.99999999999999961e79Initial program 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in x around inf 70.7%
*-commutative70.7%
Simplified70.7%
Final simplification71.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.6e+75) (not (<= z 8e+79))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.6e+75) || !(z <= 8e+79)) {
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 <= (-6.6d+75)) .or. (.not. (z <= 8d+79))) 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 <= -6.6e+75) || !(z <= 8e+79)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.6e+75) or not (z <= 8e+79): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.6e+75) || !(z <= 8e+79)) 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 <= -6.6e+75) || ~((z <= 8e+79))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.6e+75], N[Not[LessEqual[z, 8e+79]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+75} \lor \neg \left(z \leq 8 \cdot 10^{+79}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -6.59999999999999996e75 or 7.99999999999999974e79 < z Initial program 67.5%
*-commutative67.5%
Simplified67.5%
Taylor expanded in z around inf 65.9%
if -6.59999999999999996e75 < z < 7.99999999999999974e79Initial program 98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in z around 0 51.9%
Final simplification57.1%
(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 86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in z around 0 38.7%
Final simplification38.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2024020
(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))))