
(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 (<= z -4e+169) (/ (- y) (- (/ t z) a)) (if (<= z 1.5e+108) (/ (- x (* z y)) (- t (* z a))) (/ (- y (/ x z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4e+169) {
tmp = -y / ((t / z) - a);
} else if (z <= 1.5e+108) {
tmp = (x - (z * y)) / (t - (z * a));
} else {
tmp = (y - (x / 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 <= (-4d+169)) then
tmp = -y / ((t / z) - a)
else if (z <= 1.5d+108) then
tmp = (x - (z * y)) / (t - (z * a))
else
tmp = (y - (x / 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 <= -4e+169) {
tmp = -y / ((t / z) - a);
} else if (z <= 1.5e+108) {
tmp = (x - (z * y)) / (t - (z * a));
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4e+169: tmp = -y / ((t / z) - a) elif z <= 1.5e+108: tmp = (x - (z * y)) / (t - (z * a)) else: tmp = (y - (x / z)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4e+169) tmp = Float64(Float64(-y) / Float64(Float64(t / z) - a)); elseif (z <= 1.5e+108) tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); else tmp = Float64(Float64(y - Float64(x / z)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4e+169) tmp = -y / ((t / z) - a); elseif (z <= 1.5e+108) tmp = (x - (z * y)) / (t - (z * a)); else tmp = (y - (x / z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4e+169], N[((-y) / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e+108], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+169}:\\
\;\;\;\;\frac{-y}{\frac{t}{z} - a}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+108}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if z < -3.99999999999999974e169Initial program 56.4%
*-commutative56.4%
Simplified56.4%
clear-num56.4%
associate-/r/56.3%
Applied egg-rr56.3%
Taylor expanded in x around 0 48.0%
mul-1-neg48.0%
associate-/l*64.9%
distribute-neg-frac64.9%
*-commutative64.9%
Simplified64.9%
Taylor expanded in t around 0 90.9%
neg-mul-190.9%
unsub-neg90.9%
Simplified90.9%
if -3.99999999999999974e169 < z < 1.49999999999999992e108Initial program 95.6%
if 1.49999999999999992e108 < z Initial program 56.6%
*-commutative56.6%
Simplified56.6%
Taylor expanded in z around inf 75.3%
+-commutative75.3%
associate--l+75.3%
associate-/r*75.2%
associate-*r/75.2%
associate-/r*75.2%
associate-*r/75.2%
div-sub75.2%
distribute-lft-out--75.2%
associate-*r/75.2%
mul-1-neg75.2%
unsub-neg75.2%
Simplified81.9%
Taylor expanded in a around inf 87.1%
Final simplification93.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* z a)))))
(if (<= z -1.05e+96)
(/ y a)
(if (<= z -1.75e-48)
t_1
(if (<= z 1.9e+66)
(/ (- x (* z y)) t)
(if (<= z 1.7e+116) 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.05e+96) {
tmp = y / a;
} else if (z <= -1.75e-48) {
tmp = t_1;
} else if (z <= 1.9e+66) {
tmp = (x - (z * y)) / t;
} else if (z <= 1.7e+116) {
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.05d+96)) then
tmp = y / a
else if (z <= (-1.75d-48)) then
tmp = t_1
else if (z <= 1.9d+66) then
tmp = (x - (z * y)) / t
else if (z <= 1.7d+116) 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.05e+96) {
tmp = y / a;
} else if (z <= -1.75e-48) {
tmp = t_1;
} else if (z <= 1.9e+66) {
tmp = (x - (z * y)) / t;
} else if (z <= 1.7e+116) {
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.05e+96: tmp = y / a elif z <= -1.75e-48: tmp = t_1 elif z <= 1.9e+66: tmp = (x - (z * y)) / t elif z <= 1.7e+116: 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.05e+96) tmp = Float64(y / a); elseif (z <= -1.75e-48) tmp = t_1; elseif (z <= 1.9e+66) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 1.7e+116) 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.05e+96) tmp = y / a; elseif (z <= -1.75e-48) tmp = t_1; elseif (z <= 1.9e+66) tmp = (x - (z * y)) / t; elseif (z <= 1.7e+116) 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.05e+96], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.75e-48], t$95$1, If[LessEqual[z, 1.9e+66], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.7e+116], 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.05 \cdot 10^{+96}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+66}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+116}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.0500000000000001e96 or 1.70000000000000011e116 < z Initial program 59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in z around inf 70.9%
if -1.0500000000000001e96 < z < -1.74999999999999996e-48 or 1.9000000000000001e66 < z < 1.70000000000000011e116Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in x around inf 68.4%
*-commutative68.4%
Simplified68.4%
if -1.74999999999999996e-48 < z < 1.9000000000000001e66Initial program 98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in t around inf 78.7%
Final simplification74.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (/ (- x) a) z)))
(if (<= z -7.6e+87)
(/ y a)
(if (<= z -5e-25)
t_1
(if (<= z 6600000000000.0)
(/ x t)
(if (<= z 1.65e+116) t_1 (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (-x / a) / z;
double tmp;
if (z <= -7.6e+87) {
tmp = y / a;
} else if (z <= -5e-25) {
tmp = t_1;
} else if (z <= 6600000000000.0) {
tmp = x / t;
} else if (z <= 1.65e+116) {
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 / a) / z
if (z <= (-7.6d+87)) then
tmp = y / a
else if (z <= (-5d-25)) then
tmp = t_1
else if (z <= 6600000000000.0d0) then
tmp = x / t
else if (z <= 1.65d+116) 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 / a) / z;
double tmp;
if (z <= -7.6e+87) {
tmp = y / a;
} else if (z <= -5e-25) {
tmp = t_1;
} else if (z <= 6600000000000.0) {
tmp = x / t;
} else if (z <= 1.65e+116) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (-x / a) / z tmp = 0 if z <= -7.6e+87: tmp = y / a elif z <= -5e-25: tmp = t_1 elif z <= 6600000000000.0: tmp = x / t elif z <= 1.65e+116: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(-x) / a) / z) tmp = 0.0 if (z <= -7.6e+87) tmp = Float64(y / a); elseif (z <= -5e-25) tmp = t_1; elseif (z <= 6600000000000.0) tmp = Float64(x / t); elseif (z <= 1.65e+116) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (-x / a) / z; tmp = 0.0; if (z <= -7.6e+87) tmp = y / a; elseif (z <= -5e-25) tmp = t_1; elseif (z <= 6600000000000.0) tmp = x / t; elseif (z <= 1.65e+116) 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) / a), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -7.6e+87], N[(y / a), $MachinePrecision], If[LessEqual[z, -5e-25], t$95$1, If[LessEqual[z, 6600000000000.0], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.65e+116], t$95$1, N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{-x}{a}}{z}\\
\mathbf{if}\;z \leq -7.6 \cdot 10^{+87}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-25}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 6600000000000:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+116}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -7.60000000000000022e87 or 1.6499999999999999e116 < z Initial program 59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in z around inf 70.9%
if -7.60000000000000022e87 < z < -4.99999999999999962e-25 or 6.6e12 < z < 1.6499999999999999e116Initial program 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around inf 62.7%
*-commutative62.7%
Simplified62.7%
Taylor expanded in t around 0 51.0%
mul-1-neg51.0%
associate-/r*56.0%
Simplified56.0%
if -4.99999999999999962e-25 < z < 6.6e12Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 62.7%
Final simplification64.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -7.6e+87)
(/ y a)
(if (<= z -1.65e-24)
(/ (/ (- x) a) z)
(if (<= z 13000000000000.0)
(/ x t)
(if (<= z 1.65e+116) (/ (/ (- x) z) a) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.6e+87) {
tmp = y / a;
} else if (z <= -1.65e-24) {
tmp = (-x / a) / z;
} else if (z <= 13000000000000.0) {
tmp = x / t;
} else if (z <= 1.65e+116) {
tmp = (-x / 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 <= (-7.6d+87)) then
tmp = y / a
else if (z <= (-1.65d-24)) then
tmp = (-x / a) / z
else if (z <= 13000000000000.0d0) then
tmp = x / t
else if (z <= 1.65d+116) then
tmp = (-x / 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 <= -7.6e+87) {
tmp = y / a;
} else if (z <= -1.65e-24) {
tmp = (-x / a) / z;
} else if (z <= 13000000000000.0) {
tmp = x / t;
} else if (z <= 1.65e+116) {
tmp = (-x / z) / a;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.6e+87: tmp = y / a elif z <= -1.65e-24: tmp = (-x / a) / z elif z <= 13000000000000.0: tmp = x / t elif z <= 1.65e+116: tmp = (-x / z) / a else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.6e+87) tmp = Float64(y / a); elseif (z <= -1.65e-24) tmp = Float64(Float64(Float64(-x) / a) / z); elseif (z <= 13000000000000.0) tmp = Float64(x / t); elseif (z <= 1.65e+116) tmp = Float64(Float64(Float64(-x) / 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 <= -7.6e+87) tmp = y / a; elseif (z <= -1.65e-24) tmp = (-x / a) / z; elseif (z <= 13000000000000.0) tmp = x / t; elseif (z <= 1.65e+116) tmp = (-x / z) / a; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.6e+87], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.65e-24], N[(N[((-x) / a), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 13000000000000.0], N[(x / t), $MachinePrecision], If[LessEqual[z, 1.65e+116], N[(N[((-x) / z), $MachinePrecision] / a), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{+87}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{-x}{a}}{z}\\
\mathbf{elif}\;z \leq 13000000000000:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+116}:\\
\;\;\;\;\frac{\frac{-x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -7.60000000000000022e87 or 1.6499999999999999e116 < z Initial program 59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in z around inf 70.9%
if -7.60000000000000022e87 < z < -1.64999999999999992e-24Initial program 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in x around inf 57.7%
*-commutative57.7%
Simplified57.7%
Taylor expanded in t around 0 49.0%
mul-1-neg49.0%
associate-/r*53.7%
Simplified53.7%
if -1.64999999999999992e-24 < z < 1.3e13Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 62.7%
if 1.3e13 < z < 1.6499999999999999e116Initial program 81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in x around inf 67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in t around 0 53.0%
associate-*r/53.0%
neg-mul-153.0%
*-commutative53.0%
associate-/r*62.9%
Simplified62.9%
Final simplification64.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -32.0) (not (<= z 8500000000000.0))) (/ (- y (/ x z)) a) (/ (- x (* z y)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -32.0) || !(z <= 8500000000000.0)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / 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 <= (-32.0d0)) .or. (.not. (z <= 8500000000000.0d0))) then
tmp = (y - (x / z)) / a
else
tmp = (x - (z * y)) / 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 <= -32.0) || !(z <= 8500000000000.0)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -32.0) or not (z <= 8500000000000.0): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -32.0) || !(z <= 8500000000000.0)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(x - Float64(z * y)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -32.0) || ~((z <= 8500000000000.0))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -32.0], N[Not[LessEqual[z, 8500000000000.0]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -32 \lor \neg \left(z \leq 8500000000000\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\end{array}
\end{array}
if z < -32 or 8.5e12 < z Initial program 66.5%
*-commutative66.5%
Simplified66.5%
Taylor expanded in z around inf 69.7%
+-commutative69.7%
associate--l+69.7%
associate-/r*69.1%
associate-*r/69.1%
associate-/r*69.1%
associate-*r/69.1%
div-sub69.1%
distribute-lft-out--69.1%
associate-*r/69.1%
mul-1-neg69.1%
unsub-neg69.1%
Simplified76.6%
Taylor expanded in a around inf 82.0%
if -32 < z < 8.5e12Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 78.2%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -5e+79) (/ y a) (if (<= z 1.8e+116) (/ x (- t (* z a))) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e+79) {
tmp = y / a;
} else if (z <= 1.8e+116) {
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 <= (-5d+79)) then
tmp = y / a
else if (z <= 1.8d+116) 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 <= -5e+79) {
tmp = y / a;
} else if (z <= 1.8e+116) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5e+79: tmp = y / a elif z <= 1.8e+116: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e+79) tmp = Float64(y / a); elseif (z <= 1.8e+116) 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 <= -5e+79) tmp = y / a; elseif (z <= 1.8e+116) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e+79], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.8e+116], 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 \cdot 10^{+79}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+116}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -5e79 or 1.79999999999999985e116 < z Initial program 59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in z around inf 70.9%
if -5e79 < z < 1.79999999999999985e116Initial program 96.4%
*-commutative96.4%
Simplified96.4%
Taylor expanded in x around inf 72.4%
*-commutative72.4%
Simplified72.4%
Final simplification71.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.7e-26) (/ y a) (if (<= z 1.6e+98) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.7e-26) {
tmp = y / a;
} else if (z <= 1.6e+98) {
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 <= (-3.7d-26)) then
tmp = y / a
else if (z <= 1.6d+98) 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 <= -3.7e-26) {
tmp = y / a;
} else if (z <= 1.6e+98) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.7e-26: tmp = y / a elif z <= 1.6e+98: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.7e-26) tmp = Float64(y / a); elseif (z <= 1.6e+98) 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 <= -3.7e-26) tmp = y / a; elseif (z <= 1.6e+98) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.7e-26], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.6e+98], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-26}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+98}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -3.6999999999999999e-26 or 1.6000000000000001e98 < z Initial program 66.7%
*-commutative66.7%
Simplified66.7%
Taylor expanded in z around inf 59.2%
if -3.6999999999999999e-26 < z < 1.6000000000000001e98Initial program 98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in z around 0 60.4%
Final simplification59.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 84.5%
*-commutative84.5%
Simplified84.5%
Taylor expanded in z around 0 38.6%
Final simplification38.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 2023274
(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))))