
(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 11 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 (<= (/ (- x (* y z)) t_1) INFINITY)
(fma y (/ z (fma z a (- 0.0 t))) (/ x t_1))
(/ y a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double tmp;
if (((x - (y * z)) / t_1) <= ((double) INFINITY)) {
tmp = fma(y, (z / fma(z, a, (0.0 - t))), (x / t_1));
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) tmp = 0.0 if (Float64(Float64(x - Float64(y * z)) / t_1) <= Inf) tmp = fma(y, Float64(z / fma(z, a, Float64(0.0 - t))), Float64(x / t_1)); else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], Infinity], N[(y * N[(z / N[(z * a + N[(0.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / t$95$1), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;\frac{x - y \cdot z}{t\_1} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{\mathsf{fma}\left(z, a, 0 - t\right)}, \frac{x}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 87.2%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified93.4%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 0.0%
Taylor expanded in z around inf
/-lowering-/.f64100.0
Simplified100.0%
Final simplification93.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_1 (- INFINITY))
(fma y (/ z (fma z a (- 0.0 t))) (/ x t))
(if (<= t_1 4e+305)
t_1
(if (<= t_1 INFINITY) (* z (/ y (- (fma z a 0.0) t))) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(y, (z / fma(z, a, (0.0 - t))), (x / t));
} else if (t_1 <= 4e+305) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = z * (y / (fma(z, a, 0.0) - t));
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(y, Float64(z / fma(z, a, Float64(0.0 - t))), Float64(x / t)); elseif (t_1 <= 4e+305) tmp = t_1; elseif (t_1 <= Inf) tmp = Float64(z * Float64(y / Float64(fma(z, a, 0.0) - t))); else tmp = Float64(y / a); end return 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(z / N[(z * a + N[(0.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+305], t$95$1, If[LessEqual[t$95$1, Infinity], N[(z * N[(y / N[(N[(z * a + 0.0), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{\mathsf{fma}\left(z, a, 0 - t\right)}, \frac{x}{t}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;z \cdot \frac{y}{\mathsf{fma}\left(z, a, 0\right) - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 37.5%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified99.5%
Taylor expanded in t around inf
/-lowering-/.f6493.3
Simplified93.3%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 3.9999999999999998e305Initial program 94.0%
if 3.9999999999999998e305 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 60.3%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified95.7%
Taylor expanded in y around inf
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6479.9
Simplified79.9%
associate-*r/N/A
associate-*l/N/A
*-commutativeN/A
+-rgt-identityN/A
*-lowering-*.f64N/A
+-rgt-identityN/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
--lowering--.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6487.6
Applied egg-rr87.6%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 0.0%
Taylor expanded in z around inf
/-lowering-/.f64100.0
Simplified100.0%
Final simplification93.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_1 (- INFINITY))
(/ (- y (/ x z)) a)
(if (<= t_1 4e+305)
t_1
(if (<= t_1 INFINITY) (* z (/ y (- (fma z a 0.0) t))) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y - (x / z)) / a;
} else if (t_1 <= 4e+305) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = z * (y / (fma(z, a, 0.0) - t));
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (t_1 <= 4e+305) tmp = t_1; elseif (t_1 <= Inf) tmp = Float64(z * Float64(y / Float64(fma(z, a, 0.0) - t))); else tmp = Float64(y / a); end return 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$1, 4e+305], t$95$1, If[LessEqual[t$95$1, Infinity], N[(z * N[(y / N[(N[(z * a + 0.0), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;z \cdot \frac{y}{\mathsf{fma}\left(z, a, 0\right) - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -inf.0Initial program 37.5%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified99.5%
Taylor expanded in a around inf
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6486.7
Simplified86.7%
if -inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 3.9999999999999998e305Initial program 94.0%
if 3.9999999999999998e305 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 60.3%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified95.7%
Taylor expanded in y around inf
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6479.9
Simplified79.9%
associate-*r/N/A
associate-*l/N/A
*-commutativeN/A
+-rgt-identityN/A
*-lowering-*.f64N/A
+-rgt-identityN/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
--lowering--.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6487.6
Applied egg-rr87.6%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 0.0%
Taylor expanded in z around inf
/-lowering-/.f64100.0
Simplified100.0%
Final simplification93.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e+47)
(/ y a)
(if (<= z 2.1e-168)
(/ x (- t (* z a)))
(if (<= z 1.95e+97) (/ (- x (* y z)) t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+47) {
tmp = y / a;
} else if (z <= 2.1e-168) {
tmp = x / (t - (z * a));
} else if (z <= 1.95e+97) {
tmp = (x - (y * z)) / 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 <= (-5d+47)) then
tmp = y / a
else if (z <= 2.1d-168) then
tmp = x / (t - (z * a))
else if (z <= 1.95d+97) then
tmp = (x - (y * z)) / 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 <= -5e+47) {
tmp = y / a;
} else if (z <= 2.1e-168) {
tmp = x / (t - (z * a));
} else if (z <= 1.95e+97) {
tmp = (x - (y * z)) / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5e+47: tmp = y / a elif z <= 2.1e-168: tmp = x / (t - (z * a)) elif z <= 1.95e+97: tmp = (x - (y * z)) / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+47) tmp = Float64(y / a); elseif (z <= 2.1e-168) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 1.95e+97) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5e+47) tmp = y / a; elseif (z <= 2.1e-168) tmp = x / (t - (z * a)); elseif (z <= 1.95e+97) tmp = (x - (y * z)) / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+47], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.1e-168], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.95e+97], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+47}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-168}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+97}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -5.00000000000000022e47 or 1.95e97 < z Initial program 61.7%
Taylor expanded in z around inf
/-lowering-/.f6468.5
Simplified68.5%
if -5.00000000000000022e47 < z < 2.09999999999999994e-168Initial program 99.0%
Taylor expanded in x around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6481.9
Simplified81.9%
if 2.09999999999999994e-168 < z < 1.95e97Initial program 91.8%
Taylor expanded in t around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6470.7
Simplified70.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.3e+40)
(/ y a)
(if (<= z 7.5e-87)
(/ x t)
(if (<= z 1.1e+65) (* y (/ z (- 0.0 t))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.3e+40) {
tmp = y / a;
} else if (z <= 7.5e-87) {
tmp = x / t;
} else if (z <= 1.1e+65) {
tmp = y * (z / (0.0 - 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 <= (-4.3d+40)) then
tmp = y / a
else if (z <= 7.5d-87) then
tmp = x / t
else if (z <= 1.1d+65) then
tmp = y * (z / (0.0d0 - 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 <= -4.3e+40) {
tmp = y / a;
} else if (z <= 7.5e-87) {
tmp = x / t;
} else if (z <= 1.1e+65) {
tmp = y * (z / (0.0 - t));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.3e+40: tmp = y / a elif z <= 7.5e-87: tmp = x / t elif z <= 1.1e+65: tmp = y * (z / (0.0 - t)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.3e+40) tmp = Float64(y / a); elseif (z <= 7.5e-87) tmp = Float64(x / t); elseif (z <= 1.1e+65) tmp = Float64(y * Float64(z / Float64(0.0 - t))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.3e+40) tmp = y / a; elseif (z <= 7.5e-87) tmp = x / t; elseif (z <= 1.1e+65) tmp = y * (z / (0.0 - t)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.3e+40], N[(y / a), $MachinePrecision], If[LessEqual[z, 7.5e-87], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.1e+65], N[(y * N[(z / N[(0.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+40}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-87}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+65}:\\
\;\;\;\;y \cdot \frac{z}{0 - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -4.3000000000000002e40 or 1.0999999999999999e65 < z Initial program 63.1%
Taylor expanded in z around inf
/-lowering-/.f6466.5
Simplified66.5%
if -4.3000000000000002e40 < z < 7.5000000000000002e-87Initial program 99.1%
Taylor expanded in z around 0
/-lowering-/.f6468.3
Simplified68.3%
if 7.5000000000000002e-87 < z < 1.0999999999999999e65Initial program 93.0%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified96.3%
Taylor expanded in y around inf
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6468.9
Simplified68.9%
Taylor expanded in a around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f6447.7
Simplified47.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- y (/ x z)) a))) (if (<= z -1.75e-16) t_1 (if (<= z 1.4e+14) (/ (- x (* y z)) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -1.75e-16) {
tmp = t_1;
} else if (z <= 1.4e+14) {
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 - (x / z)) / a
if (z <= (-1.75d-16)) then
tmp = t_1
else if (z <= 1.4d+14) 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 - (x / z)) / a;
double tmp;
if (z <= -1.75e-16) {
tmp = t_1;
} else if (z <= 1.4e+14) {
tmp = (x - (y * z)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -1.75e-16: tmp = t_1 elif z <= 1.4e+14: tmp = (x - (y * z)) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -1.75e-16) tmp = t_1; elseif (z <= 1.4e+14) 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 - (x / z)) / a; tmp = 0.0; if (z <= -1.75e-16) tmp = t_1; elseif (z <= 1.4e+14) 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[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -1.75e-16], t$95$1, If[LessEqual[z, 1.4e+14], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.75000000000000009e-16 or 1.4e14 < z Initial program 66.0%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified80.3%
Taylor expanded in a around inf
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6475.9
Simplified75.9%
if -1.75000000000000009e-16 < z < 1.4e14Initial program 99.9%
Taylor expanded in t around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6481.8
Simplified81.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e+48) (/ y a) (if (<= z 1.7e-83) (/ x (- t (* z a))) (* y (/ z (fma z a (- 0.0 t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+48) {
tmp = y / a;
} else if (z <= 1.7e-83) {
tmp = x / (t - (z * a));
} else {
tmp = y * (z / fma(z, a, (0.0 - t)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e+48) tmp = Float64(y / a); elseif (z <= 1.7e-83) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = Float64(y * Float64(z / fma(z, a, Float64(0.0 - t)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e+48], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.7e-83], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z / N[(z * a + N[(0.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+48}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-83}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{\mathsf{fma}\left(z, a, 0 - t\right)}\\
\end{array}
\end{array}
if z < -1.00000000000000004e48Initial program 59.2%
Taylor expanded in z around inf
/-lowering-/.f6470.7
Simplified70.7%
if -1.00000000000000004e48 < z < 1.6999999999999999e-83Initial program 99.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6481.9
Simplified81.9%
if 1.6999999999999999e-83 < z Initial program 75.9%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified88.3%
Taylor expanded in y around inf
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6468.3
Simplified68.3%
sub-negN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f6468.3
Applied egg-rr68.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -7e+47) (/ y a) (if (<= z 1.62e-83) (/ x (- t (* z a))) (* y (/ z (- (* z a) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e+47) {
tmp = y / a;
} else if (z <= 1.62e-83) {
tmp = x / (t - (z * a));
} else {
tmp = y * (z / ((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 <= (-7d+47)) then
tmp = y / a
else if (z <= 1.62d-83) then
tmp = x / (t - (z * a))
else
tmp = y * (z / ((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 <= -7e+47) {
tmp = y / a;
} else if (z <= 1.62e-83) {
tmp = x / (t - (z * a));
} else {
tmp = y * (z / ((z * a) - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7e+47: tmp = y / a elif z <= 1.62e-83: tmp = x / (t - (z * a)) else: tmp = y * (z / ((z * a) - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7e+47) tmp = Float64(y / a); elseif (z <= 1.62e-83) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = Float64(y * Float64(z / Float64(Float64(z * a) - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7e+47) tmp = y / a; elseif (z <= 1.62e-83) tmp = x / (t - (z * a)); else tmp = y * (z / ((z * a) - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7e+47], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.62e-83], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+47}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{-83}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot a - t}\\
\end{array}
\end{array}
if z < -7.00000000000000031e47Initial program 59.2%
Taylor expanded in z around inf
/-lowering-/.f6470.7
Simplified70.7%
if -7.00000000000000031e47 < z < 1.6199999999999999e-83Initial program 99.1%
Taylor expanded in x around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6481.9
Simplified81.9%
if 1.6199999999999999e-83 < z Initial program 75.9%
Taylor expanded in x around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
Simplified88.3%
Taylor expanded in y around inf
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6468.3
Simplified68.3%
Final simplification75.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.2e+47) (/ y a) (if (<= z 1.8e+121) (/ x (- t (* z a))) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.2e+47) {
tmp = y / a;
} else if (z <= 1.8e+121) {
tmp = x / (t - (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 <= (-5.2d+47)) then
tmp = y / a
else if (z <= 1.8d+121) then
tmp = x / (t - (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 <= -5.2e+47) {
tmp = y / a;
} else if (z <= 1.8e+121) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.2e+47: tmp = y / a elif z <= 1.8e+121: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.2e+47) tmp = Float64(y / a); elseif (z <= 1.8e+121) tmp = Float64(x / Float64(t - 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 <= -5.2e+47) tmp = y / a; elseif (z <= 1.8e+121) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.2e+47], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.8e+121], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+47}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+121}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -5.20000000000000007e47 or 1.79999999999999991e121 < z Initial program 60.1%
Taylor expanded in z around inf
/-lowering-/.f6470.2
Simplified70.2%
if -5.20000000000000007e47 < z < 1.79999999999999991e121Initial program 96.9%
Taylor expanded in x around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6471.3
Simplified71.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e+40) (/ y a) (if (<= z 1.55e+14) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+40) {
tmp = y / a;
} else if (z <= 1.55e+14) {
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 <= (-2.1d+40)) then
tmp = y / a
else if (z <= 1.55d+14) 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 <= -2.1e+40) {
tmp = y / a;
} else if (z <= 1.55e+14) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.1e+40: tmp = y / a elif z <= 1.55e+14: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e+40) tmp = Float64(y / a); elseif (z <= 1.55e+14) 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 <= -2.1e+40) tmp = y / a; elseif (z <= 1.55e+14) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+40], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.55e+14], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+40}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.1000000000000001e40 or 1.55e14 < z Initial program 64.0%
Taylor expanded in z around inf
/-lowering-/.f6463.8
Simplified63.8%
if -2.1000000000000001e40 < z < 1.55e14Initial program 99.2%
Taylor expanded in z around 0
/-lowering-/.f6462.5
Simplified62.5%
(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.1%
Taylor expanded in z around 0
/-lowering-/.f6439.6
Simplified39.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 2024195
(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))))