
(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 9 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)))
(t_2 (fma (/ z (fma a z (- t))) y (/ x t_1)))
(t_3 (/ (- x (* z y)) t_1)))
(if (<= t_3 -2e-314)
t_2
(if (<= t_3 0.0)
(/ (/ (fma y z (- x)) a) z)
(if (<= t_3 INFINITY) t_2 (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double t_2 = fma((z / fma(a, z, -t)), y, (x / t_1));
double t_3 = (x - (z * y)) / t_1;
double tmp;
if (t_3 <= -2e-314) {
tmp = t_2;
} else if (t_3 <= 0.0) {
tmp = (fma(y, z, -x) / a) / z;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) t_2 = fma(Float64(z / fma(a, z, Float64(-t))), y, Float64(x / t_1)) t_3 = Float64(Float64(x - Float64(z * y)) / t_1) tmp = 0.0 if (t_3 <= -2e-314) tmp = t_2; elseif (t_3 <= 0.0) tmp = Float64(Float64(fma(y, z, Float64(-x)) / a) / z); elseif (t_3 <= Inf) tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(z / N[(a * z + (-t)), $MachinePrecision]), $MachinePrecision] * y + N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-314], t$95$2, If[LessEqual[t$95$3, 0.0], N[(N[(N[(y * z + (-x)), $MachinePrecision] / a), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$2, N[(y / a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
t_2 := \mathsf{fma}\left(\frac{z}{\mathsf{fma}\left(a, z, -t\right)}, y, \frac{x}{t\_1}\right)\\
t_3 := \frac{x - z \cdot y}{t\_1}\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-314}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(y, z, -x\right)}{a}}{z}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -1.9999999999e-314 or 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < +inf.0Initial program 94.3%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites98.3%
if -1.9999999999e-314 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0Initial program 51.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
frac-2negN/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6451.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.0
Applied rewrites51.0%
Taylor expanded in t around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6481.7
Applied rewrites81.7%
if +inf.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 0.0%
Taylor expanded in z around inf
lower-/.f64100.0
Applied rewrites100.0%
Final simplification95.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1
(-
(/ y a)
(/
(fma
t
(- (/ (fma (/ (/ (- y) a) a) t (/ x a)) (* z a)) (/ (/ y a) a))
(/ x a))
z))))
(if (<= a -6e+85)
t_1
(if (<= a 7.2e+139)
(fma (/ z (fma a z (- t))) y (/ x (- t (* z a))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) - (fma(t, ((fma(((-y / a) / a), t, (x / a)) / (z * a)) - ((y / a) / a)), (x / a)) / z);
double tmp;
if (a <= -6e+85) {
tmp = t_1;
} else if (a <= 7.2e+139) {
tmp = fma((z / fma(a, z, -t)), y, (x / (t - (z * a))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) - Float64(fma(t, Float64(Float64(fma(Float64(Float64(Float64(-y) / a) / a), t, Float64(x / a)) / Float64(z * a)) - Float64(Float64(y / a) / a)), Float64(x / a)) / z)) tmp = 0.0 if (a <= -6e+85) tmp = t_1; elseif (a <= 7.2e+139) tmp = fma(Float64(z / fma(a, z, Float64(-t))), y, Float64(x / Float64(t - Float64(z * a)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] - N[(N[(t * N[(N[(N[(N[(N[((-y) / a), $MachinePrecision] / a), $MachinePrecision] * t + N[(x / a), $MachinePrecision]), $MachinePrecision] / N[(z * a), $MachinePrecision]), $MachinePrecision] - N[(N[(y / a), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(x / a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6e+85], t$95$1, If[LessEqual[a, 7.2e+139], N[(N[(z / N[(a * z + (-t)), $MachinePrecision]), $MachinePrecision] * y + N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} - \frac{\mathsf{fma}\left(t, \frac{\mathsf{fma}\left(\frac{\frac{-y}{a}}{a}, t, \frac{x}{a}\right)}{z \cdot a} - \frac{\frac{y}{a}}{a}, \frac{x}{a}\right)}{z}\\
\mathbf{if}\;a \leq -6 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\mathsf{fma}\left(a, z, -t\right)}, y, \frac{x}{t - z \cdot a}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6.0000000000000001e85 or 7.19999999999999971e139 < a Initial program 61.8%
Taylor expanded in z around -inf
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites91.5%
if -6.0000000000000001e85 < a < 7.19999999999999971e139Initial program 92.1%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites96.7%
Final simplification95.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -6e+36)
t_1
(if (<= z -1.55e-191)
(/ x (- t (* z a)))
(if (<= z 5e+26) (/ (- x (* z y)) 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 <= -6e+36) {
tmp = t_1;
} else if (z <= -1.55e-191) {
tmp = x / (t - (z * a));
} else if (z <= 5e+26) {
tmp = (x - (z * y)) / 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 <= (-6d+36)) then
tmp = t_1
else if (z <= (-1.55d-191)) then
tmp = x / (t - (z * a))
else if (z <= 5d+26) then
tmp = (x - (z * y)) / 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 <= -6e+36) {
tmp = t_1;
} else if (z <= -1.55e-191) {
tmp = x / (t - (z * a));
} else if (z <= 5e+26) {
tmp = (x - (z * y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -6e+36: tmp = t_1 elif z <= -1.55e-191: tmp = x / (t - (z * a)) elif z <= 5e+26: tmp = (x - (z * y)) / 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 <= -6e+36) tmp = t_1; elseif (z <= -1.55e-191) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 5e+26) tmp = Float64(Float64(x - Float64(z * y)) / 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 <= -6e+36) tmp = t_1; elseif (z <= -1.55e-191) tmp = x / (t - (z * a)); elseif (z <= 5e+26) tmp = (x - (z * y)) / 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, -6e+36], t$95$1, If[LessEqual[z, -1.55e-191], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+26], N[(N[(x - N[(z * y), $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 -6 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-191}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+26}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6e36 or 5.0000000000000001e26 < z Initial program 63.2%
Taylor expanded in t around 0
associate-*r/N/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
div-subN/A
sub-negN/A
distribute-lft-inN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
neg-mul-1N/A
remove-double-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6477.2
Applied rewrites77.2%
if -6e36 < z < -1.5500000000000001e-191Initial program 99.9%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6478.5
Applied rewrites78.5%
if -1.5500000000000001e-191 < z < 5.0000000000000001e26Initial program 99.8%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6478.6
Applied rewrites78.6%
Final simplification78.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -4.8e+108)
t_1
(if (<= z 3.25e+134) (/ (- x (* z y)) (- t (* z a))) 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 <= -4.8e+108) {
tmp = t_1;
} else if (z <= 3.25e+134) {
tmp = (x - (z * y)) / (t - (z * a));
} 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 <= (-4.8d+108)) then
tmp = t_1
else if (z <= 3.25d+134) then
tmp = (x - (z * y)) / (t - (z * a))
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 <= -4.8e+108) {
tmp = t_1;
} else if (z <= 3.25e+134) {
tmp = (x - (z * y)) / (t - (z * a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -4.8e+108: tmp = t_1 elif z <= 3.25e+134: tmp = (x - (z * y)) / (t - (z * a)) 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 <= -4.8e+108) tmp = t_1; elseif (z <= 3.25e+134) tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); 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 <= -4.8e+108) tmp = t_1; elseif (z <= 3.25e+134) tmp = (x - (z * y)) / (t - (z * a)); 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, -4.8e+108], t$95$1, If[LessEqual[z, 3.25e+134], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.25 \cdot 10^{+134}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.80000000000000037e108 or 3.25e134 < z Initial program 52.2%
Taylor expanded in t around 0
associate-*r/N/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
div-subN/A
sub-negN/A
distribute-lft-inN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
neg-mul-1N/A
remove-double-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
if -4.80000000000000037e108 < z < 3.25e134Initial program 96.2%
Final simplification92.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.85e+98)
(/ y a)
(if (<= z -1.55e-191)
(/ x (- t (* z a)))
(if (<= z 1.15e+57) (/ (- x (* z y)) t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.85e+98) {
tmp = y / a;
} else if (z <= -1.55e-191) {
tmp = x / (t - (z * a));
} else if (z <= 1.15e+57) {
tmp = (x - (z * y)) / 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 <= (-1.85d+98)) then
tmp = y / a
else if (z <= (-1.55d-191)) then
tmp = x / (t - (z * a))
else if (z <= 1.15d+57) then
tmp = (x - (z * y)) / 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 <= -1.85e+98) {
tmp = y / a;
} else if (z <= -1.55e-191) {
tmp = x / (t - (z * a));
} else if (z <= 1.15e+57) {
tmp = (x - (z * y)) / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.85e+98: tmp = y / a elif z <= -1.55e-191: tmp = x / (t - (z * a)) elif z <= 1.15e+57: tmp = (x - (z * y)) / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.85e+98) tmp = Float64(y / a); elseif (z <= -1.55e-191) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 1.15e+57) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.85e+98) tmp = y / a; elseif (z <= -1.55e-191) tmp = x / (t - (z * a)); elseif (z <= 1.15e+57) tmp = (x - (z * y)) / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.85e+98], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.55e-191], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e+57], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+98}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-191}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+57}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.8499999999999999e98 or 1.1499999999999999e57 < z Initial program 55.8%
Taylor expanded in z around inf
lower-/.f6464.2
Applied rewrites64.2%
if -1.8499999999999999e98 < z < -1.5500000000000001e-191Initial program 99.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6473.5
Applied rewrites73.5%
if -1.5500000000000001e-191 < z < 1.1499999999999999e57Initial program 99.9%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
Final simplification71.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ x (- t (* z a))))) (if (<= x -9.6e-86) t_1 (if (<= x 2.6e+31) (* (/ z (- (* z a) t)) y) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (x <= -9.6e-86) {
tmp = t_1;
} else if (x <= 2.6e+31) {
tmp = (z / ((z * a) - t)) * y;
} 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 = x / (t - (z * a))
if (x <= (-9.6d-86)) then
tmp = t_1
else if (x <= 2.6d+31) then
tmp = (z / ((z * a) - t)) * y
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 = x / (t - (z * a));
double tmp;
if (x <= -9.6e-86) {
tmp = t_1;
} else if (x <= 2.6e+31) {
tmp = (z / ((z * a) - t)) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x / (t - (z * a)) tmp = 0 if x <= -9.6e-86: tmp = t_1 elif x <= 2.6e+31: tmp = (z / ((z * a) - t)) * y else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(z * a))) tmp = 0.0 if (x <= -9.6e-86) tmp = t_1; elseif (x <= 2.6e+31) tmp = Float64(Float64(z / Float64(Float64(z * a) - t)) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x / (t - (z * a)); tmp = 0.0; if (x <= -9.6e-86) tmp = t_1; elseif (x <= 2.6e+31) tmp = (z / ((z * a) - t)) * y; else tmp = t_1; 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[x, -9.6e-86], t$95$1, If[LessEqual[x, 2.6e+31], N[(N[(z / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;x \leq -9.6 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+31}:\\
\;\;\;\;\frac{z}{z \cdot a - t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.60000000000000053e-86 or 2.6e31 < x Initial program 85.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6473.6
Applied rewrites73.6%
if -9.60000000000000053e-86 < x < 2.6e31Initial program 82.0%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l/N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites86.0%
Taylor expanded in x around 0
Applied rewrites68.9%
Final simplification71.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.85e+98) (/ y a) (if (<= z 2.8e+149) (/ x (- t (* z a))) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.85e+98) {
tmp = y / a;
} else if (z <= 2.8e+149) {
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 <= (-1.85d+98)) then
tmp = y / a
else if (z <= 2.8d+149) 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 <= -1.85e+98) {
tmp = y / a;
} else if (z <= 2.8e+149) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.85e+98: tmp = y / a elif z <= 2.8e+149: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.85e+98) tmp = Float64(y / a); elseif (z <= 2.8e+149) 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 <= -1.85e+98) tmp = y / a; elseif (z <= 2.8e+149) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.85e+98], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.8e+149], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+98}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+149}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.8499999999999999e98 or 2.7999999999999999e149 < z Initial program 51.4%
Taylor expanded in z around inf
lower-/.f6472.1
Applied rewrites72.1%
if -1.8499999999999999e98 < z < 2.7999999999999999e149Initial program 95.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f6468.2
Applied rewrites68.2%
Final simplification69.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.8e+61) (/ y a) (if (<= z 1.06e-22) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e+61) {
tmp = y / a;
} else if (z <= 1.06e-22) {
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.8d+61)) then
tmp = y / a
else if (z <= 1.06d-22) 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.8e+61) {
tmp = y / a;
} else if (z <= 1.06e-22) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e+61: tmp = y / a elif z <= 1.06e-22: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e+61) tmp = Float64(y / a); elseif (z <= 1.06e-22) 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.8e+61) tmp = y / a; elseif (z <= 1.06e-22) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e+61], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.06e-22], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+61}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-22}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.8000000000000001e61 or 1.06000000000000008e-22 < z Initial program 65.7%
Taylor expanded in z around inf
lower-/.f6459.2
Applied rewrites59.2%
if -2.8000000000000001e61 < z < 1.06000000000000008e-22Initial program 99.8%
Taylor expanded in z around 0
lower-/.f6459.3
Applied rewrites59.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 83.8%
Taylor expanded in z around 0
lower-/.f6438.6
Applied rewrites38.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 2024297
(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))))