
(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 10 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 (or (<= z -5.2e+80) (not (<= z 1.05e+98)))
(/ (- y) (- (/ t z) a))
(- (/ x t_1) (/ (* z y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (z * a);
double tmp;
if ((z <= -5.2e+80) || !(z <= 1.05e+98)) {
tmp = -y / ((t / z) - a);
} else {
tmp = (x / t_1) - ((z * y) / 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 = t - (z * a)
if ((z <= (-5.2d+80)) .or. (.not. (z <= 1.05d+98))) then
tmp = -y / ((t / z) - a)
else
tmp = (x / t_1) - ((z * y) / 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 = t - (z * a);
double tmp;
if ((z <= -5.2e+80) || !(z <= 1.05e+98)) {
tmp = -y / ((t / z) - a);
} else {
tmp = (x / t_1) - ((z * y) / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (z * a) tmp = 0 if (z <= -5.2e+80) or not (z <= 1.05e+98): tmp = -y / ((t / z) - a) else: tmp = (x / t_1) - ((z * y) / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(z * a)) tmp = 0.0 if ((z <= -5.2e+80) || !(z <= 1.05e+98)) tmp = Float64(Float64(-y) / Float64(Float64(t / z) - a)); else tmp = Float64(Float64(x / t_1) - Float64(Float64(z * y) / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (z * a); tmp = 0.0; if ((z <= -5.2e+80) || ~((z <= 1.05e+98))) tmp = -y / ((t / z) - a); else tmp = (x / t_1) - ((z * y) / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -5.2e+80], N[Not[LessEqual[z, 1.05e+98]], $MachinePrecision]], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(N[(x / t$95$1), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - z \cdot a\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+80} \lor \neg \left(z \leq 1.05 \cdot 10^{+98}\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t\_1} - \frac{z \cdot y}{t\_1}\\
\end{array}
\end{array}
if z < -5.19999999999999963e80 or 1.05000000000000002e98 < z Initial program 61.1%
*-commutative61.1%
Simplified61.1%
Taylor expanded in x around 0 52.7%
mul-1-neg52.7%
associate-/l*66.7%
associate-/r/63.1%
cancel-sign-sub-inv63.1%
+-commutative63.1%
distribute-lft-neg-in63.1%
distribute-rgt-neg-in63.1%
fma-udef63.2%
associate-/r/66.7%
fma-udef66.7%
distribute-rgt-neg-in66.7%
distribute-lft-neg-in66.7%
+-commutative66.7%
cancel-sign-sub-inv66.7%
*-commutative66.7%
Simplified66.7%
Taylor expanded in t around 0 86.0%
neg-mul-186.0%
+-commutative86.0%
unsub-neg86.0%
Simplified86.0%
if -5.19999999999999963e80 < z < 1.05000000000000002e98Initial program 97.0%
*-commutative97.0%
Simplified97.0%
Taylor expanded in x around 0 97.0%
Final simplification93.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* z a)))))
(if (<= z -1.7e+26)
(/ y a)
(if (<= z -4.6e-24)
t_1
(if (<= z -2e-152)
(/ (* z (- y)) t)
(if (<= z 1.25e+45) t_1 (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (z <= -1.7e+26) {
tmp = y / a;
} else if (z <= -4.6e-24) {
tmp = t_1;
} else if (z <= -2e-152) {
tmp = (z * -y) / t;
} else if (z <= 1.25e+45) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x / (t - (z * a))
if (z <= (-1.7d+26)) then
tmp = y / a
else if (z <= (-4.6d-24)) then
tmp = t_1
else if (z <= (-2d-152)) then
tmp = (z * -y) / t
else if (z <= 1.25d+45) then
tmp = t_1
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (z <= -1.7e+26) {
tmp = y / a;
} else if (z <= -4.6e-24) {
tmp = t_1;
} else if (z <= -2e-152) {
tmp = (z * -y) / t;
} else if (z <= 1.25e+45) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x / (t - (z * a)) tmp = 0 if z <= -1.7e+26: tmp = y / a elif z <= -4.6e-24: tmp = t_1 elif z <= -2e-152: tmp = (z * -y) / t elif z <= 1.25e+45: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(z * a))) tmp = 0.0 if (z <= -1.7e+26) tmp = Float64(y / a); elseif (z <= -4.6e-24) tmp = t_1; elseif (z <= -2e-152) tmp = Float64(Float64(z * Float64(-y)) / t); elseif (z <= 1.25e+45) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x / (t - (z * a)); tmp = 0.0; if (z <= -1.7e+26) tmp = y / a; elseif (z <= -4.6e-24) tmp = t_1; elseif (z <= -2e-152) tmp = (z * -y) / t; elseif (z <= 1.25e+45) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+26], N[(y / a), $MachinePrecision], If[LessEqual[z, -4.6e-24], t$95$1, If[LessEqual[z, -2e-152], N[(N[(z * (-y)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.25e+45], t$95$1, N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+26}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-152}:\\
\;\;\;\;\frac{z \cdot \left(-y\right)}{t}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.7000000000000001e26 or 1.25e45 < z Initial program 68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in z around inf 61.3%
if -1.7000000000000001e26 < z < -4.6000000000000002e-24 or -2.00000000000000013e-152 < z < 1.25e45Initial program 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in x around inf 77.7%
*-commutative77.7%
Simplified77.7%
if -4.6000000000000002e-24 < z < -2.00000000000000013e-152Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 75.4%
mul-1-neg75.4%
associate-/l*56.4%
associate-/r/71.2%
cancel-sign-sub-inv71.2%
+-commutative71.2%
distribute-lft-neg-in71.2%
distribute-rgt-neg-in71.2%
fma-udef71.2%
associate-/r/56.4%
fma-udef56.4%
distribute-rgt-neg-in56.4%
distribute-lft-neg-in56.4%
+-commutative56.4%
cancel-sign-sub-inv56.4%
*-commutative56.4%
Simplified56.4%
Taylor expanded in t around 0 56.4%
neg-mul-156.4%
+-commutative56.4%
unsub-neg56.4%
Simplified56.4%
Taylor expanded in t around inf 66.9%
Final simplification69.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y) (- (/ t z) a))))
(if (<= z -6.7e+16)
t_1
(if (<= z -6.7e-155)
(/ (- x (* z y)) t)
(if (<= z 3e-53) (/ x (- t (* z a))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y / ((t / z) - a);
double tmp;
if (z <= -6.7e+16) {
tmp = t_1;
} else if (z <= -6.7e-155) {
tmp = (x - (z * y)) / t;
} else if (z <= 3e-53) {
tmp = x / (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 / ((t / z) - a)
if (z <= (-6.7d+16)) then
tmp = t_1
else if (z <= (-6.7d-155)) then
tmp = (x - (z * y)) / t
else if (z <= 3d-53) then
tmp = x / (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 / ((t / z) - a);
double tmp;
if (z <= -6.7e+16) {
tmp = t_1;
} else if (z <= -6.7e-155) {
tmp = (x - (z * y)) / t;
} else if (z <= 3e-53) {
tmp = x / (t - (z * a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y / ((t / z) - a) tmp = 0 if z <= -6.7e+16: tmp = t_1 elif z <= -6.7e-155: tmp = (x - (z * y)) / t elif z <= 3e-53: tmp = x / (t - (z * a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) / Float64(Float64(t / z) - a)) tmp = 0.0 if (z <= -6.7e+16) tmp = t_1; elseif (z <= -6.7e-155) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 3e-53) tmp = Float64(x / 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 / ((t / z) - a); tmp = 0.0; if (z <= -6.7e+16) tmp = t_1; elseif (z <= -6.7e-155) tmp = (x - (z * y)) / t; elseif (z <= 3e-53) tmp = x / (t - (z * a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.7e+16], t$95$1, If[LessEqual[z, -6.7e-155], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 3e-53], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-y}{\frac{t}{z} - a}\\
\mathbf{if}\;z \leq -6.7 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.7 \cdot 10^{-155}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-53}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.7e16 or 3.0000000000000002e-53 < z Initial program 71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in x around 0 52.2%
mul-1-neg52.2%
associate-/l*62.6%
associate-/r/60.3%
cancel-sign-sub-inv60.3%
+-commutative60.3%
distribute-lft-neg-in60.3%
distribute-rgt-neg-in60.3%
fma-udef60.3%
associate-/r/62.6%
fma-udef62.6%
distribute-rgt-neg-in62.6%
distribute-lft-neg-in62.6%
+-commutative62.6%
cancel-sign-sub-inv62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in t around 0 76.4%
neg-mul-176.4%
+-commutative76.4%
unsub-neg76.4%
Simplified76.4%
if -6.7e16 < z < -6.70000000000000028e-155Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 87.6%
if -6.70000000000000028e-155 < z < 3.0000000000000002e-53Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 84.0%
*-commutative84.0%
Simplified84.0%
Final simplification80.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y) (- (/ t z) a))))
(if (<= z -7.8e+18)
t_1
(if (<= z -5.1e-154)
(- (/ x t) (/ (* z y) t))
(if (<= z 1.25e-53) (/ x (- t (* z a))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y / ((t / z) - a);
double tmp;
if (z <= -7.8e+18) {
tmp = t_1;
} else if (z <= -5.1e-154) {
tmp = (x / t) - ((z * y) / t);
} else if (z <= 1.25e-53) {
tmp = x / (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 / ((t / z) - a)
if (z <= (-7.8d+18)) then
tmp = t_1
else if (z <= (-5.1d-154)) then
tmp = (x / t) - ((z * y) / t)
else if (z <= 1.25d-53) then
tmp = x / (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 / ((t / z) - a);
double tmp;
if (z <= -7.8e+18) {
tmp = t_1;
} else if (z <= -5.1e-154) {
tmp = (x / t) - ((z * y) / t);
} else if (z <= 1.25e-53) {
tmp = x / (t - (z * a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y / ((t / z) - a) tmp = 0 if z <= -7.8e+18: tmp = t_1 elif z <= -5.1e-154: tmp = (x / t) - ((z * y) / t) elif z <= 1.25e-53: tmp = x / (t - (z * a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) / Float64(Float64(t / z) - a)) tmp = 0.0 if (z <= -7.8e+18) tmp = t_1; elseif (z <= -5.1e-154) tmp = Float64(Float64(x / t) - Float64(Float64(z * y) / t)); elseif (z <= 1.25e-53) tmp = Float64(x / 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 / ((t / z) - a); tmp = 0.0; if (z <= -7.8e+18) tmp = t_1; elseif (z <= -5.1e-154) tmp = (x / t) - ((z * y) / t); elseif (z <= 1.25e-53) tmp = x / (t - (z * a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.8e+18], t$95$1, If[LessEqual[z, -5.1e-154], N[(N[(x / t), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e-53], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-y}{\frac{t}{z} - a}\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.1 \cdot 10^{-154}:\\
\;\;\;\;\frac{x}{t} - \frac{z \cdot y}{t}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-53}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.8e18 or 1.25e-53 < z Initial program 71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in x around 0 52.2%
mul-1-neg52.2%
associate-/l*62.6%
associate-/r/60.3%
cancel-sign-sub-inv60.3%
+-commutative60.3%
distribute-lft-neg-in60.3%
distribute-rgt-neg-in60.3%
fma-udef60.3%
associate-/r/62.6%
fma-udef62.6%
distribute-rgt-neg-in62.6%
distribute-lft-neg-in62.6%
+-commutative62.6%
cancel-sign-sub-inv62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in t around 0 76.4%
neg-mul-176.4%
+-commutative76.4%
unsub-neg76.4%
Simplified76.4%
if -7.8e18 < z < -5.0999999999999998e-154Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in a around 0 87.7%
if -5.0999999999999998e-154 < z < 1.25e-53Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 84.0%
*-commutative84.0%
Simplified84.0%
Final simplification80.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5.5e+25)
(/ y a)
(if (<= z -3.8e-154)
(/ (- x (* z y)) t)
(if (<= z 2.3e+44) (/ x (- t (* z a))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+25) {
tmp = y / a;
} else if (z <= -3.8e-154) {
tmp = (x - (z * y)) / t;
} else if (z <= 2.3e+44) {
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.5d+25)) then
tmp = y / a
else if (z <= (-3.8d-154)) then
tmp = (x - (z * y)) / t
else if (z <= 2.3d+44) 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.5e+25) {
tmp = y / a;
} else if (z <= -3.8e-154) {
tmp = (x - (z * y)) / t;
} else if (z <= 2.3e+44) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.5e+25: tmp = y / a elif z <= -3.8e-154: tmp = (x - (z * y)) / t elif z <= 2.3e+44: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e+25) tmp = Float64(y / a); elseif (z <= -3.8e-154) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 2.3e+44) 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.5e+25) tmp = y / a; elseif (z <= -3.8e-154) tmp = (x - (z * y)) / t; elseif (z <= 2.3e+44) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+25], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.8e-154], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 2.3e+44], 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.5 \cdot 10^{+25}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-154}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+44}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -5.50000000000000018e25 or 2.30000000000000004e44 < z Initial program 68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in z around inf 61.3%
if -5.50000000000000018e25 < z < -3.8000000000000001e-154Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 87.6%
if -3.8000000000000001e-154 < z < 2.30000000000000004e44Initial program 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 77.7%
*-commutative77.7%
Simplified77.7%
Final simplification71.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -1.06e+26)
t_1
(if (<= z -1.65e-155)
(/ (- x (* z y)) t)
(if (<= z 2.3e+38) (/ x (- 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 <= -1.06e+26) {
tmp = t_1;
} else if (z <= -1.65e-155) {
tmp = (x - (z * y)) / t;
} else if (z <= 2.3e+38) {
tmp = x / (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 <= (-1.06d+26)) then
tmp = t_1
else if (z <= (-1.65d-155)) then
tmp = (x - (z * y)) / t
else if (z <= 2.3d+38) then
tmp = x / (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 <= -1.06e+26) {
tmp = t_1;
} else if (z <= -1.65e-155) {
tmp = (x - (z * y)) / t;
} else if (z <= 2.3e+38) {
tmp = x / (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 <= -1.06e+26: tmp = t_1 elif z <= -1.65e-155: tmp = (x - (z * y)) / t elif z <= 2.3e+38: tmp = x / (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 <= -1.06e+26) tmp = t_1; elseif (z <= -1.65e-155) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 2.3e+38) tmp = Float64(x / 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 <= -1.06e+26) tmp = t_1; elseif (z <= -1.65e-155) tmp = (x - (z * y)) / t; elseif (z <= 2.3e+38) tmp = x / (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, -1.06e+26], t$95$1, If[LessEqual[z, -1.65e-155], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 2.3e+38], N[(x / 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 -1.06 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-155}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+38}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.05999999999999997e26 or 2.3000000000000001e38 < z Initial program 67.6%
*-commutative67.6%
Simplified67.6%
Taylor expanded in x around 0 67.6%
Taylor expanded in a around inf 75.9%
mul-1-neg75.9%
unsub-neg75.9%
Simplified75.9%
if -1.05999999999999997e26 < z < -1.64999999999999993e-155Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 87.6%
if -1.64999999999999993e-155 < z < 2.3000000000000001e38Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 78.3%
*-commutative78.3%
Simplified78.3%
Final simplification78.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.2e+78) (not (<= z 6.8e+103))) (/ (- y) (- (/ t z) a)) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e+78) || !(z <= 6.8e+103)) {
tmp = -y / ((t / z) - a);
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-4.2d+78)) .or. (.not. (z <= 6.8d+103))) then
tmp = -y / ((t / z) - a)
else
tmp = (x - (z * y)) / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e+78) || !(z <= 6.8e+103)) {
tmp = -y / ((t / z) - a);
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.2e+78) or not (z <= 6.8e+103): tmp = -y / ((t / z) - a) else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.2e+78) || !(z <= 6.8e+103)) tmp = Float64(Float64(-y) / Float64(Float64(t / z) - a)); else tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.2e+78) || ~((z <= 6.8e+103))) tmp = -y / ((t / z) - a); else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.2e+78], N[Not[LessEqual[z, 6.8e+103]], $MachinePrecision]], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+78} \lor \neg \left(z \leq 6.8 \cdot 10^{+103}\right):\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -4.2000000000000002e78 or 6.7999999999999997e103 < z Initial program 61.1%
*-commutative61.1%
Simplified61.1%
Taylor expanded in x around 0 52.7%
mul-1-neg52.7%
associate-/l*66.7%
associate-/r/63.1%
cancel-sign-sub-inv63.1%
+-commutative63.1%
distribute-lft-neg-in63.1%
distribute-rgt-neg-in63.1%
fma-udef63.2%
associate-/r/66.7%
fma-udef66.7%
distribute-rgt-neg-in66.7%
distribute-lft-neg-in66.7%
+-commutative66.7%
cancel-sign-sub-inv66.7%
*-commutative66.7%
Simplified66.7%
Taylor expanded in t around 0 86.0%
neg-mul-186.0%
+-commutative86.0%
unsub-neg86.0%
Simplified86.0%
if -4.2000000000000002e78 < z < 6.7999999999999997e103Initial program 97.0%
Final simplification93.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.5e+23) (/ y a) (if (<= z -2e-152) (/ (* z (- y)) t) (if (<= z 0.032) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+23) {
tmp = y / a;
} else if (z <= -2e-152) {
tmp = (z * -y) / t;
} else if (z <= 0.032) {
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 <= (-5.5d+23)) then
tmp = y / a
else if (z <= (-2d-152)) then
tmp = (z * -y) / t
else if (z <= 0.032d0) 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 <= -5.5e+23) {
tmp = y / a;
} else if (z <= -2e-152) {
tmp = (z * -y) / t;
} else if (z <= 0.032) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.5e+23: tmp = y / a elif z <= -2e-152: tmp = (z * -y) / t elif z <= 0.032: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e+23) tmp = Float64(y / a); elseif (z <= -2e-152) tmp = Float64(Float64(z * Float64(-y)) / t); elseif (z <= 0.032) 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 <= -5.5e+23) tmp = y / a; elseif (z <= -2e-152) tmp = (z * -y) / t; elseif (z <= 0.032) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+23], N[(y / a), $MachinePrecision], If[LessEqual[z, -2e-152], N[(N[(z * (-y)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 0.032], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-152}:\\
\;\;\;\;\frac{z \cdot \left(-y\right)}{t}\\
\mathbf{elif}\;z \leq 0.032:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -5.50000000000000004e23 or 0.032000000000000001 < z Initial program 69.7%
*-commutative69.7%
Simplified69.7%
Taylor expanded in z around inf 59.4%
if -5.50000000000000004e23 < z < -2.00000000000000013e-152Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 61.5%
mul-1-neg61.5%
associate-/l*47.7%
associate-/r/58.5%
cancel-sign-sub-inv58.5%
+-commutative58.5%
distribute-lft-neg-in58.5%
distribute-rgt-neg-in58.5%
fma-udef58.5%
associate-/r/47.7%
fma-udef47.7%
distribute-rgt-neg-in47.7%
distribute-lft-neg-in47.7%
+-commutative47.7%
cancel-sign-sub-inv47.7%
*-commutative47.7%
Simplified47.7%
Taylor expanded in t around 0 47.7%
neg-mul-147.7%
+-commutative47.7%
unsub-neg47.7%
Simplified47.7%
Taylor expanded in t around inf 55.2%
if -2.00000000000000013e-152 < z < 0.032000000000000001Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 57.6%
Final simplification58.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.3e+23) (not (<= z 310.0))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.3e+23) || !(z <= 310.0)) {
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 <= (-1.3d+23)) .or. (.not. (z <= 310.0d0))) 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 <= -1.3e+23) || !(z <= 310.0)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.3e+23) or not (z <= 310.0): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.3e+23) || !(z <= 310.0)) 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 <= -1.3e+23) || ~((z <= 310.0))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.3e+23], N[Not[LessEqual[z, 310.0]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+23} \lor \neg \left(z \leq 310\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -1.29999999999999996e23 or 310 < z Initial program 69.7%
*-commutative69.7%
Simplified69.7%
Taylor expanded in z around inf 59.4%
if -1.29999999999999996e23 < z < 310Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 52.5%
Final simplification55.9%
(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 85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in z around 0 35.7%
Final simplification35.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t\_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024026
(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))))