
(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 6 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 -6.8e+156) (not (<= z 3e+77))) (/ (- y (/ x z)) a) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.8e+156) || !(z <= 3e+77)) {
tmp = (y - (x / 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 <= (-6.8d+156)) .or. (.not. (z <= 3d+77))) then
tmp = (y - (x / 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 <= -6.8e+156) || !(z <= 3e+77)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.8e+156) or not (z <= 3e+77): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.8e+156) || !(z <= 3e+77)) tmp = Float64(Float64(y - Float64(x / 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 <= -6.8e+156) || ~((z <= 3e+77))) tmp = (y - (x / 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, -6.8e+156], N[Not[LessEqual[z, 3e+77]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $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 -6.8 \cdot 10^{+156} \lor \neg \left(z \leq 3 \cdot 10^{+77}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -6.8000000000000002e156 or 2.9999999999999998e77 < z Initial program 55.1%
sub-neg55.1%
+-commutative55.1%
neg-sub055.1%
associate-+l-55.1%
sub0-neg55.1%
neg-mul-155.1%
sub-neg55.1%
+-commutative55.1%
neg-sub055.1%
associate-+l-55.1%
sub0-neg55.1%
neg-mul-155.1%
times-frac55.1%
metadata-eval55.1%
*-lft-identity55.1%
*-commutative55.1%
Simplified55.1%
Taylor expanded in a around inf 44.6%
*-commutative44.6%
Simplified44.6%
Taylor expanded in z around 0 79.2%
+-commutative79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in a around 0 88.2%
if -6.8000000000000002e156 < z < 2.9999999999999998e77Initial program 92.9%
Final simplification91.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2e-8) (not (<= z 1.36e-43))) (/ y (- a (/ t z))) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2e-8) || !(z <= 1.36e-43)) {
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 <= (-2d-8)) .or. (.not. (z <= 1.36d-43))) 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 <= -2e-8) || !(z <= 1.36e-43)) {
tmp = y / (a - (t / z));
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2e-8) or not (z <= 1.36e-43): tmp = y / (a - (t / z)) else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2e-8) || !(z <= 1.36e-43)) 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 <= -2e-8) || ~((z <= 1.36e-43))) tmp = y / (a - (t / z)); else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2e-8], N[Not[LessEqual[z, 1.36e-43]], $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 \cdot 10^{-8} \lor \neg \left(z \leq 1.36 \cdot 10^{-43}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -2e-8 or 1.36000000000000007e-43 < z Initial program 68.6%
sub-neg68.6%
+-commutative68.6%
neg-sub068.6%
associate-+l-68.6%
sub0-neg68.6%
neg-mul-168.6%
sub-neg68.6%
+-commutative68.6%
neg-sub068.6%
associate-+l-68.6%
sub0-neg68.6%
neg-mul-168.6%
times-frac68.6%
metadata-eval68.6%
*-lft-identity68.6%
*-commutative68.6%
Simplified68.6%
clear-num68.5%
inv-pow68.5%
Applied egg-rr68.5%
Taylor expanded in a around 0 67.0%
+-commutative67.0%
mul-1-neg67.0%
unsub-neg67.0%
Simplified67.0%
Taylor expanded in y around inf 74.1%
if -2e-8 < z < 1.36000000000000007e-43Initial 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 64.4%
Final simplification70.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -360000.0) (not (<= z 7e-44))) (/ y (- a (/ t z))) (/ (- x (* z y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -360000.0) || !(z <= 7e-44)) {
tmp = y / (a - (t / z));
} 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 <= (-360000.0d0)) .or. (.not. (z <= 7d-44))) then
tmp = y / (a - (t / z))
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 <= -360000.0) || !(z <= 7e-44)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -360000.0) or not (z <= 7e-44): tmp = y / (a - (t / z)) else: tmp = (x - (z * y)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -360000.0) || !(z <= 7e-44)) tmp = Float64(y / Float64(a - Float64(t / z))); 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 <= -360000.0) || ~((z <= 7e-44))) tmp = y / (a - (t / z)); else tmp = (x - (z * y)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -360000.0], N[Not[LessEqual[z, 7e-44]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -360000 \lor \neg \left(z \leq 7 \cdot 10^{-44}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\end{array}
\end{array}
if z < -3.6e5 or 6.9999999999999995e-44 < z Initial program 67.7%
sub-neg67.7%
+-commutative67.7%
neg-sub067.7%
associate-+l-67.7%
sub0-neg67.7%
neg-mul-167.7%
sub-neg67.7%
+-commutative67.7%
neg-sub067.7%
associate-+l-67.7%
sub0-neg67.7%
neg-mul-167.7%
times-frac67.7%
metadata-eval67.7%
*-lft-identity67.7%
*-commutative67.7%
Simplified67.7%
clear-num67.7%
inv-pow67.7%
Applied egg-rr67.7%
Taylor expanded in a around 0 66.0%
+-commutative66.0%
mul-1-neg66.0%
unsub-neg66.0%
Simplified66.0%
Taylor expanded in y around inf 74.1%
if -3.6e5 < z < 6.9999999999999995e-44Initial 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 78.1%
associate-*r/78.1%
neg-mul-178.1%
neg-sub078.1%
sub-neg78.1%
+-commutative78.1%
associate--r+78.1%
neg-sub078.1%
remove-double-neg78.1%
*-commutative78.1%
Simplified78.1%
Final simplification75.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.5e+14) (/ (- y (/ x z)) a) (if (<= z 2.2e-44) (/ (- x (* z y)) t) (/ y (- a (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.5e+14) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.2e-44) {
tmp = (x - (z * y)) / t;
} else {
tmp = y / (a - (t / 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) :: tmp
if (z <= (-4.5d+14)) then
tmp = (y - (x / z)) / a
else if (z <= 2.2d-44) then
tmp = (x - (z * y)) / t
else
tmp = y / (a - (t / z))
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.5e+14) {
tmp = (y - (x / z)) / a;
} else if (z <= 2.2e-44) {
tmp = (x - (z * y)) / t;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.5e+14: tmp = (y - (x / z)) / a elif z <= 2.2e-44: tmp = (x - (z * y)) / t else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.5e+14) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 2.2e-44) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.5e+14) tmp = (y - (x / z)) / a; elseif (z <= 2.2e-44) tmp = (x - (z * y)) / t; else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.5e+14], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 2.2e-44], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+14}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-44}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -4.5e14Initial program 65.2%
sub-neg65.2%
+-commutative65.2%
neg-sub065.2%
associate-+l-65.2%
sub0-neg65.2%
neg-mul-165.2%
sub-neg65.2%
+-commutative65.2%
neg-sub065.2%
associate-+l-65.2%
sub0-neg65.2%
neg-mul-165.2%
times-frac65.2%
metadata-eval65.2%
*-lft-identity65.2%
*-commutative65.2%
Simplified65.2%
Taylor expanded in a around inf 46.6%
*-commutative46.6%
Simplified46.6%
Taylor expanded in z around 0 68.9%
+-commutative68.9%
mul-1-neg68.9%
unsub-neg68.9%
Simplified68.9%
Taylor expanded in a around 0 76.6%
if -4.5e14 < z < 2.20000000000000012e-44Initial 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 77.7%
associate-*r/77.7%
neg-mul-177.7%
neg-sub077.7%
sub-neg77.7%
+-commutative77.7%
associate--r+77.7%
neg-sub077.7%
remove-double-neg77.7%
*-commutative77.7%
Simplified77.7%
if 2.20000000000000012e-44 < z Initial program 68.8%
sub-neg68.8%
+-commutative68.8%
neg-sub068.8%
associate-+l-68.8%
sub0-neg68.8%
neg-mul-168.8%
sub-neg68.8%
+-commutative68.8%
neg-sub068.8%
associate-+l-68.8%
sub0-neg68.8%
neg-mul-168.8%
times-frac68.8%
metadata-eval68.8%
*-lft-identity68.8%
*-commutative68.8%
Simplified68.8%
clear-num68.9%
inv-pow68.9%
Applied egg-rr68.9%
Taylor expanded in a around 0 66.0%
+-commutative66.0%
mul-1-neg66.0%
unsub-neg66.0%
Simplified66.0%
Taylor expanded in y around inf 78.0%
Final simplification77.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.0255) (/ y a) (if (<= z 2.4e+17) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.0255) {
tmp = y / a;
} else if (z <= 2.4e+17) {
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 <= (-0.0255d0)) then
tmp = y / a
else if (z <= 2.4d+17) 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 <= -0.0255) {
tmp = y / a;
} else if (z <= 2.4e+17) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -0.0255: tmp = y / a elif z <= 2.4e+17: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.0255) tmp = Float64(y / a); elseif (z <= 2.4e+17) 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 <= -0.0255) tmp = y / a; elseif (z <= 2.4e+17) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.0255], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.4e+17], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0255:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+17}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -0.0254999999999999984 or 2.4e17 < z Initial program 65.3%
sub-neg65.3%
+-commutative65.3%
neg-sub065.3%
associate-+l-65.3%
sub0-neg65.3%
neg-mul-165.3%
sub-neg65.3%
+-commutative65.3%
neg-sub065.3%
associate-+l-65.3%
sub0-neg65.3%
neg-mul-165.3%
times-frac65.3%
metadata-eval65.3%
*-lft-identity65.3%
*-commutative65.3%
Simplified65.3%
Taylor expanded in z around inf 59.3%
if -0.0254999999999999984 < z < 2.4e17Initial 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 59.9%
Final simplification59.6%
(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 82.0%
sub-neg82.0%
+-commutative82.0%
neg-sub082.0%
associate-+l-82.0%
sub0-neg82.0%
neg-mul-182.0%
sub-neg82.0%
+-commutative82.0%
neg-sub082.0%
associate-+l-82.0%
sub0-neg82.0%
neg-mul-182.0%
times-frac82.0%
metadata-eval82.0%
*-lft-identity82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in z around 0 34.8%
Final simplification34.8%
(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 2023200
(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))))