
(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
(let* ((t_1 (/ (- x (* y z)) (- t (* z a)))) (t_2 (- (* y z) x)))
(if (<= t_1 -1e-309)
t_1
(if (<= t_1 1e+259)
(pow (- (* a (/ z t_2)) (/ t t_2)) -1.0)
(* y (- (/ 1.0 a) (/ x (* a (* y z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double t_2 = (y * z) - x;
double tmp;
if (t_1 <= -1e-309) {
tmp = t_1;
} else if (t_1 <= 1e+259) {
tmp = pow(((a * (z / t_2)) - (t / t_2)), -1.0);
} else {
tmp = y * ((1.0 / a) - (x / (a * (y * 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) :: t_2
real(8) :: tmp
t_1 = (x - (y * z)) / (t - (z * a))
t_2 = (y * z) - x
if (t_1 <= (-1d-309)) then
tmp = t_1
else if (t_1 <= 1d+259) then
tmp = ((a * (z / t_2)) - (t / t_2)) ** (-1.0d0)
else
tmp = y * ((1.0d0 / a) - (x / (a * (y * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double t_2 = (y * z) - x;
double tmp;
if (t_1 <= -1e-309) {
tmp = t_1;
} else if (t_1 <= 1e+259) {
tmp = Math.pow(((a * (z / t_2)) - (t / t_2)), -1.0);
} else {
tmp = y * ((1.0 / a) - (x / (a * (y * z))));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / (t - (z * a)) t_2 = (y * z) - x tmp = 0 if t_1 <= -1e-309: tmp = t_1 elif t_1 <= 1e+259: tmp = math.pow(((a * (z / t_2)) - (t / t_2)), -1.0) else: tmp = y * ((1.0 / a) - (x / (a * (y * z)))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) t_2 = Float64(Float64(y * z) - x) tmp = 0.0 if (t_1 <= -1e-309) tmp = t_1; elseif (t_1 <= 1e+259) tmp = Float64(Float64(a * Float64(z / t_2)) - Float64(t / t_2)) ^ -1.0; else tmp = Float64(y * Float64(Float64(1.0 / a) - Float64(x / Float64(a * Float64(y * z))))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (y * z)) / (t - (z * a)); t_2 = (y * z) - x; tmp = 0.0; if (t_1 <= -1e-309) tmp = t_1; elseif (t_1 <= 1e+259) tmp = ((a * (z / t_2)) - (t / t_2)) ^ -1.0; else tmp = y * ((1.0 / a) - (x / (a * (y * z)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-309], t$95$1, If[LessEqual[t$95$1, 1e+259], N[Power[N[(N[(a * N[(z / t$95$2), $MachinePrecision]), $MachinePrecision] - N[(t / t$95$2), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], N[(y * N[(N[(1.0 / a), $MachinePrecision] - N[(x / N[(a * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\
t_2 := y \cdot z - x\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-309}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 10^{+259}:\\
\;\;\;\;{\left(a \cdot \frac{z}{t\_2} - \frac{t}{t\_2}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{1}{a} - \frac{x}{a \cdot \left(y \cdot z\right)}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.000000000000002e-309Initial program 96.2%
if -1.000000000000002e-309 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 9.999999999999999e258Initial program 84.4%
*-commutative84.4%
Simplified84.4%
clear-num83.0%
inv-pow83.0%
sub-neg83.0%
+-commutative83.0%
*-commutative83.0%
distribute-rgt-neg-in83.0%
fma-define83.0%
Applied egg-rr83.0%
Taylor expanded in a around 0 82.2%
+-commutative82.2%
mul-1-neg82.2%
unsub-neg82.2%
associate-/l*97.6%
Simplified97.6%
if 9.999999999999999e258 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 45.7%
*-commutative45.7%
Simplified45.7%
Taylor expanded in y around inf 45.7%
Taylor expanded in t around 0 35.4%
associate-*r/35.4%
associate-*r*35.4%
neg-mul-135.4%
*-commutative35.4%
Simplified35.4%
Taylor expanded in y around inf 86.2%
+-commutative86.2%
mul-1-neg86.2%
unsub-neg86.2%
*-commutative86.2%
*-commutative86.2%
Simplified86.2%
Final simplification95.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.15e+140) (not (<= z 7.8e+175))) (/ y (- a (/ t z))) (/ (- x (* y z)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e+140) || !(z <= 7.8e+175)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.15d+140)) .or. (.not. (z <= 7.8d+175))) then
tmp = y / (a - (t / z))
else
tmp = (x - (y * z)) / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e+140) || !(z <= 7.8e+175)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e+140) or not (z <= 7.8e+175): tmp = y / (a - (t / z)) else: tmp = (x - (y * z)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.15e+140) || !(z <= 7.8e+175)) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.15e+140) || ~((z <= 7.8e+175))) tmp = y / (a - (t / z)); else tmp = (x - (y * z)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e+140], N[Not[LessEqual[z, 7.8e+175]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+140} \lor \neg \left(z \leq 7.8 \cdot 10^{+175}\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.14999999999999995e140 or 7.79999999999999944e175 < z Initial program 50.1%
*-commutative50.1%
Simplified50.1%
clear-num50.1%
inv-pow50.1%
sub-neg50.1%
+-commutative50.1%
*-commutative50.1%
distribute-rgt-neg-in50.1%
fma-define50.1%
Applied egg-rr50.1%
Taylor expanded in a around 0 42.7%
+-commutative42.7%
mul-1-neg42.7%
unsub-neg42.7%
associate-/l*66.8%
Simplified66.8%
Taylor expanded in y around -inf 89.0%
associate-*r/89.0%
mul-1-neg89.0%
Simplified89.0%
frac-2neg89.0%
div-inv88.8%
remove-double-neg88.8%
sub-neg88.8%
distribute-neg-in88.8%
remove-double-neg88.8%
Applied egg-rr88.8%
associate-*r/89.0%
*-rgt-identity89.0%
distribute-frac-neg89.0%
+-commutative89.0%
distribute-frac-neg89.0%
unsub-neg89.0%
Simplified89.0%
if -1.14999999999999995e140 < z < 7.79999999999999944e175Initial program 94.6%
Final simplification93.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.5e+79) (not (<= z 1.55e+27))) (/ y (- a (/ t z))) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+79) || !(z <= 1.55e+27)) {
tmp = y / (a - (t / z));
} 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 <= (-9.5d+79)) .or. (.not. (z <= 1.55d+27))) then
tmp = y / (a - (t / z))
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 <= -9.5e+79) || !(z <= 1.55e+27)) {
tmp = y / (a - (t / z));
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.5e+79) or not (z <= 1.55e+27): tmp = y / (a - (t / z)) else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+79) || !(z <= 1.55e+27)) tmp = Float64(y / Float64(a - Float64(t / z))); 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 <= -9.5e+79) || ~((z <= 1.55e+27))) tmp = y / (a - (t / z)); else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.5e+79], N[Not[LessEqual[z, 1.55e+27]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+79} \lor \neg \left(z \leq 1.55 \cdot 10^{+27}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -9.49999999999999994e79 or 1.54999999999999998e27 < z Initial program 62.6%
*-commutative62.6%
Simplified62.6%
clear-num61.9%
inv-pow61.9%
sub-neg61.9%
+-commutative61.9%
*-commutative61.9%
distribute-rgt-neg-in61.9%
fma-define61.9%
Applied egg-rr61.9%
Taylor expanded in a around 0 57.9%
+-commutative57.9%
mul-1-neg57.9%
unsub-neg57.9%
associate-/l*76.4%
Simplified76.4%
Taylor expanded in y around -inf 80.0%
associate-*r/80.0%
mul-1-neg80.0%
Simplified80.0%
frac-2neg80.0%
div-inv79.8%
remove-double-neg79.8%
sub-neg79.8%
distribute-neg-in79.8%
remove-double-neg79.8%
Applied egg-rr79.8%
associate-*r/80.0%
*-rgt-identity80.0%
distribute-frac-neg80.0%
+-commutative80.0%
distribute-frac-neg80.0%
unsub-neg80.0%
Simplified80.0%
if -9.49999999999999994e79 < z < 1.54999999999999998e27Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 78.9%
*-commutative78.9%
Simplified78.9%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+80) (not (<= z 5.5e+50))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+80) || !(z <= 5.5e+50)) {
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.35d+80)) .or. (.not. (z <= 5.5d+50))) 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.35e+80) || !(z <= 5.5e+50)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e+80) or not (z <= 5.5e+50): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e+80) || !(z <= 5.5e+50)) 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.35e+80) || ~((z <= 5.5e+50))) 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.35e+80], N[Not[LessEqual[z, 5.5e+50]], $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.35 \cdot 10^{+80} \lor \neg \left(z \leq 5.5 \cdot 10^{+50}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.34999999999999991e80 or 5.4999999999999998e50 < z Initial program 60.7%
*-commutative60.7%
Simplified60.7%
Taylor expanded in z around inf 68.3%
if -1.34999999999999991e80 < z < 5.4999999999999998e50Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 77.8%
*-commutative77.8%
Simplified77.8%
Final simplification74.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.2) (not (<= z 3.05e-19))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.2) || !(z <= 3.05e-19)) {
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 <= (-9.2d0)) .or. (.not. (z <= 3.05d-19))) 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 <= -9.2) || !(z <= 3.05e-19)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.2) or not (z <= 3.05e-19): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.2) || !(z <= 3.05e-19)) 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 <= -9.2) || ~((z <= 3.05e-19))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.2], N[Not[LessEqual[z, 3.05e-19]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \lor \neg \left(z \leq 3.05 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -9.1999999999999993 or 3.0500000000000001e-19 < z Initial program 69.3%
*-commutative69.3%
Simplified69.3%
Taylor expanded in z around inf 61.8%
if -9.1999999999999993 < z < 3.0500000000000001e-19Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 64.7%
Final simplification63.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 84.9%
*-commutative84.9%
Simplified84.9%
Taylor expanded in z around 0 39.6%
(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 2024135
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))
(/ (- x (* y z)) (- t (* a z))))