
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.75e+137) (not (<= z 5.1e+148))) (/ (- y (/ x z)) a) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.75e+137) || !(z <= 5.1e+148)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.75d+137)) .or. (.not. (z <= 5.1d+148))) then
tmp = (y - (x / z)) / a
else
tmp = (x - (z * y)) / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.75e+137) || !(z <= 5.1e+148)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.75e+137) or not (z <= 5.1e+148): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.75e+137) || !(z <= 5.1e+148)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.75e+137) || ~((z <= 5.1e+148))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.75e+137], N[Not[LessEqual[z, 5.1e+148]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+137} \lor \neg \left(z \leq 5.1 \cdot 10^{+148}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.7500000000000001e137 or 5.09999999999999985e148 < z Initial program 44.8%
*-commutative44.8%
Simplified44.8%
Taylor expanded in z around inf 61.4%
+-commutative61.4%
associate--l+61.4%
associate-/r*63.4%
associate-*r/63.4%
associate-/r*63.5%
associate-*r/63.5%
div-sub63.5%
distribute-lft-out--63.5%
associate-*r/63.5%
mul-1-neg63.5%
unsub-neg63.5%
Simplified70.4%
Taylor expanded in a around inf 84.1%
if -1.7500000000000001e137 < z < 5.09999999999999985e148Initial program 96.7%
Final simplification93.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* z y)) t)) (t_2 (/ x (- t (* z a)))))
(if (<= z -8.2e+93)
(/ y a)
(if (<= z -5.6e+51)
t_2
(if (<= z -1.55e+33)
(/ y a)
(if (<= z -8.2e-7)
t_1
(if (<= z -1.18e-67) t_2 (if (<= z 5.2e+37) t_1 (/ y a)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (z * y)) / t;
double t_2 = x / (t - (z * a));
double tmp;
if (z <= -8.2e+93) {
tmp = y / a;
} else if (z <= -5.6e+51) {
tmp = t_2;
} else if (z <= -1.55e+33) {
tmp = y / a;
} else if (z <= -8.2e-7) {
tmp = t_1;
} else if (z <= -1.18e-67) {
tmp = t_2;
} else if (z <= 5.2e+37) {
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) :: t_2
real(8) :: tmp
t_1 = (x - (z * y)) / t
t_2 = x / (t - (z * a))
if (z <= (-8.2d+93)) then
tmp = y / a
else if (z <= (-5.6d+51)) then
tmp = t_2
else if (z <= (-1.55d+33)) then
tmp = y / a
else if (z <= (-8.2d-7)) then
tmp = t_1
else if (z <= (-1.18d-67)) then
tmp = t_2
else if (z <= 5.2d+37) 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 - (z * y)) / t;
double t_2 = x / (t - (z * a));
double tmp;
if (z <= -8.2e+93) {
tmp = y / a;
} else if (z <= -5.6e+51) {
tmp = t_2;
} else if (z <= -1.55e+33) {
tmp = y / a;
} else if (z <= -8.2e-7) {
tmp = t_1;
} else if (z <= -1.18e-67) {
tmp = t_2;
} else if (z <= 5.2e+37) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (z * y)) / t t_2 = x / (t - (z * a)) tmp = 0 if z <= -8.2e+93: tmp = y / a elif z <= -5.6e+51: tmp = t_2 elif z <= -1.55e+33: tmp = y / a elif z <= -8.2e-7: tmp = t_1 elif z <= -1.18e-67: tmp = t_2 elif z <= 5.2e+37: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(z * y)) / t) t_2 = Float64(x / Float64(t - Float64(z * a))) tmp = 0.0 if (z <= -8.2e+93) tmp = Float64(y / a); elseif (z <= -5.6e+51) tmp = t_2; elseif (z <= -1.55e+33) tmp = Float64(y / a); elseif (z <= -8.2e-7) tmp = t_1; elseif (z <= -1.18e-67) tmp = t_2; elseif (z <= 5.2e+37) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (z * y)) / t; t_2 = x / (t - (z * a)); tmp = 0.0; if (z <= -8.2e+93) tmp = y / a; elseif (z <= -5.6e+51) tmp = t_2; elseif (z <= -1.55e+33) tmp = y / a; elseif (z <= -8.2e-7) tmp = t_1; elseif (z <= -1.18e-67) tmp = t_2; elseif (z <= 5.2e+37) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.2e+93], N[(y / a), $MachinePrecision], If[LessEqual[z, -5.6e+51], t$95$2, If[LessEqual[z, -1.55e+33], N[(y / a), $MachinePrecision], If[LessEqual[z, -8.2e-7], t$95$1, If[LessEqual[z, -1.18e-67], t$95$2, If[LessEqual[z, 5.2e+37], t$95$1, N[(y / a), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - z \cdot y}{t}\\
t_2 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{+93}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{+51}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{+33}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.18 \cdot 10^{-67}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -8.2000000000000002e93 or -5.60000000000000009e51 < z < -1.55e33 or 5.1999999999999998e37 < z Initial program 59.4%
*-commutative59.4%
Simplified59.4%
Taylor expanded in z around inf 67.4%
if -8.2000000000000002e93 < z < -5.60000000000000009e51 or -8.1999999999999998e-7 < z < -1.18e-67Initial program 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in x around inf 84.6%
*-commutative84.6%
Simplified84.6%
if -1.55e33 < z < -8.1999999999999998e-7 or -1.18e-67 < z < 5.1999999999999998e37Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 82.5%
Final simplification76.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.2e+98)
(/ y a)
(if (<= z -4.6e+50)
(/ (/ (- x) z) a)
(if (<= z -1.2e+33)
(/ y a)
(if (<= z 6.1e-86)
(/ x t)
(if (<= z 5.5e-11) (* (/ y t) (- z)) (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.2e+98) {
tmp = y / a;
} else if (z <= -4.6e+50) {
tmp = (-x / z) / a;
} else if (z <= -1.2e+33) {
tmp = y / a;
} else if (z <= 6.1e-86) {
tmp = x / t;
} else if (z <= 5.5e-11) {
tmp = (y / t) * -z;
} 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.2d+98)) then
tmp = y / a
else if (z <= (-4.6d+50)) then
tmp = (-x / z) / a
else if (z <= (-1.2d+33)) then
tmp = y / a
else if (z <= 6.1d-86) then
tmp = x / t
else if (z <= 5.5d-11) then
tmp = (y / t) * -z
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.2e+98) {
tmp = y / a;
} else if (z <= -4.6e+50) {
tmp = (-x / z) / a;
} else if (z <= -1.2e+33) {
tmp = y / a;
} else if (z <= 6.1e-86) {
tmp = x / t;
} else if (z <= 5.5e-11) {
tmp = (y / t) * -z;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.2e+98: tmp = y / a elif z <= -4.6e+50: tmp = (-x / z) / a elif z <= -1.2e+33: tmp = y / a elif z <= 6.1e-86: tmp = x / t elif z <= 5.5e-11: tmp = (y / t) * -z else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.2e+98) tmp = Float64(y / a); elseif (z <= -4.6e+50) tmp = Float64(Float64(Float64(-x) / z) / a); elseif (z <= -1.2e+33) tmp = Float64(y / a); elseif (z <= 6.1e-86) tmp = Float64(x / t); elseif (z <= 5.5e-11) tmp = Float64(Float64(y / t) * Float64(-z)); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.2e+98) tmp = y / a; elseif (z <= -4.6e+50) tmp = (-x / z) / a; elseif (z <= -1.2e+33) tmp = y / a; elseif (z <= 6.1e-86) tmp = x / t; elseif (z <= 5.5e-11) tmp = (y / t) * -z; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.2e+98], N[(y / a), $MachinePrecision], If[LessEqual[z, -4.6e+50], N[(N[((-x) / z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, -1.2e+33], N[(y / a), $MachinePrecision], If[LessEqual[z, 6.1e-86], N[(x / t), $MachinePrecision], If[LessEqual[z, 5.5e-11], N[(N[(y / t), $MachinePrecision] * (-z)), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+98}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{+50}:\\
\;\;\;\;\frac{\frac{-x}{z}}{a}\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{+33}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{-86}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-11}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.1999999999999999e98 or -4.59999999999999994e50 < z < -1.2e33 or 5.49999999999999975e-11 < z Initial program 61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in z around inf 65.5%
if -1.1999999999999999e98 < z < -4.59999999999999994e50Initial program 83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in z around inf 51.1%
+-commutative51.1%
associate--l+51.1%
associate-/r*59.0%
associate-*r/59.0%
associate-/r*59.0%
associate-*r/59.0%
div-sub59.0%
distribute-lft-out--59.0%
associate-*r/59.0%
mul-1-neg59.0%
unsub-neg59.0%
Simplified67.3%
Taylor expanded in a around inf 67.4%
Taylor expanded in y around 0 67.3%
associate-*r/67.3%
neg-mul-167.3%
Simplified67.3%
if -1.2e33 < z < 6.10000000000000032e-86Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 64.9%
if 6.10000000000000032e-86 < z < 5.49999999999999975e-11Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 67.3%
Taylor expanded in x around 0 55.4%
mul-1-neg55.4%
associate-/l*55.2%
Simplified55.2%
associate-/r/55.4%
Applied egg-rr55.4%
Final simplification64.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* z y)) t)) (t_2 (/ (- y (/ x z)) a)))
(if (<= z -1.4e+33)
t_2
(if (<= z -7.2e-7)
t_1
(if (<= z -5e-68) (/ x (- t (* z a))) (if (<= z 9.8e-20) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (z * y)) / t;
double t_2 = (y - (x / z)) / a;
double tmp;
if (z <= -1.4e+33) {
tmp = t_2;
} else if (z <= -7.2e-7) {
tmp = t_1;
} else if (z <= -5e-68) {
tmp = x / (t - (z * a));
} else if (z <= 9.8e-20) {
tmp = 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 = (x - (z * y)) / t
t_2 = (y - (x / z)) / a
if (z <= (-1.4d+33)) then
tmp = t_2
else if (z <= (-7.2d-7)) then
tmp = t_1
else if (z <= (-5d-68)) then
tmp = x / (t - (z * a))
else if (z <= 9.8d-20) then
tmp = 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 = (x - (z * y)) / t;
double t_2 = (y - (x / z)) / a;
double tmp;
if (z <= -1.4e+33) {
tmp = t_2;
} else if (z <= -7.2e-7) {
tmp = t_1;
} else if (z <= -5e-68) {
tmp = x / (t - (z * a));
} else if (z <= 9.8e-20) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (z * y)) / t t_2 = (y - (x / z)) / a tmp = 0 if z <= -1.4e+33: tmp = t_2 elif z <= -7.2e-7: tmp = t_1 elif z <= -5e-68: tmp = x / (t - (z * a)) elif z <= 9.8e-20: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(z * y)) / t) t_2 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -1.4e+33) tmp = t_2; elseif (z <= -7.2e-7) tmp = t_1; elseif (z <= -5e-68) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 9.8e-20) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (z * y)) / t; t_2 = (y - (x / z)) / a; tmp = 0.0; if (z <= -1.4e+33) tmp = t_2; elseif (z <= -7.2e-7) tmp = t_1; elseif (z <= -5e-68) tmp = x / (t - (z * a)); elseif (z <= 9.8e-20) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -1.4e+33], t$95$2, If[LessEqual[z, -7.2e-7], t$95$1, If[LessEqual[z, -5e-68], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.8e-20], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - z \cdot y}{t}\\
t_2 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{+33}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-68}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.4e33 or 9.8000000000000003e-20 < z Initial program 63.9%
*-commutative63.9%
Simplified63.9%
Taylor expanded in z around inf 62.8%
+-commutative62.8%
associate--l+62.8%
associate-/r*63.9%
associate-*r/63.9%
associate-/r*64.0%
associate-*r/64.0%
div-sub64.0%
distribute-lft-out--64.0%
associate-*r/64.0%
mul-1-neg64.0%
unsub-neg64.0%
Simplified70.2%
Taylor expanded in a around inf 78.2%
if -1.4e33 < z < -7.19999999999999989e-7 or -4.99999999999999971e-68 < z < 9.8000000000000003e-20Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 84.7%
if -7.19999999999999989e-7 < z < -4.99999999999999971e-68Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 99.8%
*-commutative99.8%
Simplified99.8%
Final simplification81.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.05e+33) (/ y a) (if (<= z 3.8e-86) (/ x t) (if (<= z 2.65e-11) (* (/ y t) (- z)) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+33) {
tmp = y / a;
} else if (z <= 3.8e-86) {
tmp = x / t;
} else if (z <= 2.65e-11) {
tmp = (y / t) * -z;
} 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.05d+33)) then
tmp = y / a
else if (z <= 3.8d-86) then
tmp = x / t
else if (z <= 2.65d-11) then
tmp = (y / t) * -z
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.05e+33) {
tmp = y / a;
} else if (z <= 3.8e-86) {
tmp = x / t;
} else if (z <= 2.65e-11) {
tmp = (y / t) * -z;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.05e+33: tmp = y / a elif z <= 3.8e-86: tmp = x / t elif z <= 2.65e-11: tmp = (y / t) * -z else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+33) tmp = Float64(y / a); elseif (z <= 3.8e-86) tmp = Float64(x / t); elseif (z <= 2.65e-11) tmp = Float64(Float64(y / t) * Float64(-z)); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.05e+33) tmp = y / a; elseif (z <= 3.8e-86) tmp = x / t; elseif (z <= 2.65e-11) tmp = (y / t) * -z; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+33], N[(y / a), $MachinePrecision], If[LessEqual[z, 3.8e-86], N[(x / t), $MachinePrecision], If[LessEqual[z, 2.65e-11], N[(N[(y / t), $MachinePrecision] * (-z)), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+33}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-86}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-11}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.05e33 or 2.6499999999999999e-11 < z Initial program 63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in z around inf 62.0%
if -1.05e33 < z < 3.8e-86Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 64.9%
if 3.8e-86 < z < 2.6499999999999999e-11Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 67.3%
Taylor expanded in x around 0 55.4%
mul-1-neg55.4%
associate-/l*55.2%
Simplified55.2%
associate-/r/55.4%
Applied egg-rr55.4%
Final simplification62.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.4e+98) (not (<= z 4.8e+34))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.4e+98) || !(z <= 4.8e+34)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-3.4d+98)) .or. (.not. (z <= 4.8d+34))) then
tmp = y / a
else
tmp = x / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.4e+98) || !(z <= 4.8e+34)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.4e+98) or not (z <= 4.8e+34): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.4e+98) || !(z <= 4.8e+34)) tmp = Float64(y / a); else tmp = Float64(x / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.4e+98) || ~((z <= 4.8e+34))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.4e+98], N[Not[LessEqual[z, 4.8e+34]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+98} \lor \neg \left(z \leq 4.8 \cdot 10^{+34}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -3.39999999999999972e98 or 4.79999999999999974e34 < z Initial program 58.0%
*-commutative58.0%
Simplified58.0%
Taylor expanded in z around inf 66.6%
if -3.39999999999999972e98 < z < 4.79999999999999974e34Initial program 98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in x around inf 74.7%
*-commutative74.7%
Simplified74.7%
Final simplification71.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.35e+33) (/ y a) (if (<= z 1.5e+26) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e+33) {
tmp = y / a;
} else if (z <= 1.5e+26) {
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 <= (-1.35d+33)) then
tmp = y / a
else if (z <= 1.5d+26) 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 <= -1.35e+33) {
tmp = y / a;
} else if (z <= 1.5e+26) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.35e+33: tmp = y / a elif z <= 1.5e+26: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e+33) tmp = Float64(y / a); elseif (z <= 1.5e+26) 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 <= -1.35e+33) tmp = y / a; elseif (z <= 1.5e+26) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e+33], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.5e+26], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+33}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.34999999999999996e33 or 1.49999999999999999e26 < z Initial program 61.8%
*-commutative61.8%
Simplified61.8%
Taylor expanded in z around inf 63.5%
if -1.34999999999999996e33 < z < 1.49999999999999999e26Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 59.2%
Final simplification61.2%
(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 81.9%
*-commutative81.9%
Simplified81.9%
Taylor expanded in z around 0 35.2%
Final simplification35.2%
(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 2023290
(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))))