
(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 (if (or (<= z -4.4e+98) (not (<= z 2.3e+72))) (/ (- 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 <= -4.4e+98) || !(z <= 2.3e+72)) {
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 <= (-4.4d+98)) .or. (.not. (z <= 2.3d+72))) 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 <= -4.4e+98) || !(z <= 2.3e+72)) {
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 <= -4.4e+98) or not (z <= 2.3e+72): 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 <= -4.4e+98) || !(z <= 2.3e+72)) 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 <= -4.4e+98) || ~((z <= 2.3e+72))) 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, -4.4e+98], N[Not[LessEqual[z, 2.3e+72]], $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 -4.4 \cdot 10^{+98} \lor \neg \left(z \leq 2.3 \cdot 10^{+72}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -4.40000000000000017e98 or 2.3e72 < z Initial program 57.1%
*-commutative57.1%
Simplified57.1%
Taylor expanded in x around inf 50.0%
+-commutative50.0%
mul-1-neg50.0%
unsub-neg50.0%
*-commutative50.0%
associate-/l*51.6%
*-commutative51.6%
Simplified51.6%
Taylor expanded in a around inf 74.3%
associate-*r/74.3%
associate-*r*74.3%
mul-1-neg74.3%
+-commutative74.3%
mul-1-neg74.3%
sub-neg74.3%
Simplified74.3%
Taylor expanded in x around 0 81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified81.3%
if -4.40000000000000017e98 < z < 2.3e72Initial program 99.2%
Final simplification92.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.3e+116)
(/ y a)
(if (<= z -8e+57)
(/ (/ x z) (- a))
(if (<= z -1.36e-27)
(/ y a)
(if (<= z 8.8e-47)
(/ x t)
(if (<= z 82000000000000.0)
(* x (/ (/ -1.0 a) z))
(if (<= z 6.8e+25) (/ x t) (/ y a))))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+116) {
tmp = y / a;
} else if (z <= -8e+57) {
tmp = (x / z) / -a;
} else if (z <= -1.36e-27) {
tmp = y / a;
} else if (z <= 8.8e-47) {
tmp = x / t;
} else if (z <= 82000000000000.0) {
tmp = x * ((-1.0 / a) / z);
} else if (z <= 6.8e+25) {
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.3d+116)) then
tmp = y / a
else if (z <= (-8d+57)) then
tmp = (x / z) / -a
else if (z <= (-1.36d-27)) then
tmp = y / a
else if (z <= 8.8d-47) then
tmp = x / t
else if (z <= 82000000000000.0d0) then
tmp = x * (((-1.0d0) / a) / z)
else if (z <= 6.8d+25) 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.3e+116) {
tmp = y / a;
} else if (z <= -8e+57) {
tmp = (x / z) / -a;
} else if (z <= -1.36e-27) {
tmp = y / a;
} else if (z <= 8.8e-47) {
tmp = x / t;
} else if (z <= 82000000000000.0) {
tmp = x * ((-1.0 / a) / z);
} else if (z <= 6.8e+25) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.3e+116: tmp = y / a elif z <= -8e+57: tmp = (x / z) / -a elif z <= -1.36e-27: tmp = y / a elif z <= 8.8e-47: tmp = x / t elif z <= 82000000000000.0: tmp = x * ((-1.0 / a) / z) elif z <= 6.8e+25: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+116) tmp = Float64(y / a); elseif (z <= -8e+57) tmp = Float64(Float64(x / z) / Float64(-a)); elseif (z <= -1.36e-27) tmp = Float64(y / a); elseif (z <= 8.8e-47) tmp = Float64(x / t); elseif (z <= 82000000000000.0) tmp = Float64(x * Float64(Float64(-1.0 / a) / z)); elseif (z <= 6.8e+25) 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.3e+116) tmp = y / a; elseif (z <= -8e+57) tmp = (x / z) / -a; elseif (z <= -1.36e-27) tmp = y / a; elseif (z <= 8.8e-47) tmp = x / t; elseif (z <= 82000000000000.0) tmp = x * ((-1.0 / a) / z); elseif (z <= 6.8e+25) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+116], N[(y / a), $MachinePrecision], If[LessEqual[z, -8e+57], N[(N[(x / z), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[z, -1.36e-27], N[(y / a), $MachinePrecision], If[LessEqual[z, 8.8e-47], N[(x / t), $MachinePrecision], If[LessEqual[z, 82000000000000.0], N[(x * N[(N[(-1.0 / a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8e+25], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+116}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+57}:\\
\;\;\;\;\frac{\frac{x}{z}}{-a}\\
\mathbf{elif}\;z \leq -1.36 \cdot 10^{-27}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-47}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 82000000000000:\\
\;\;\;\;x \cdot \frac{\frac{-1}{a}}{z}\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+25}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.29999999999999995e116 or -8.00000000000000039e57 < z < -1.36e-27 or 6.79999999999999967e25 < z Initial program 66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in z around inf 62.8%
if -2.29999999999999995e116 < z < -8.00000000000000039e57Initial program 70.5%
*-commutative70.5%
Simplified70.5%
Taylor expanded in x around inf 70.0%
+-commutative70.0%
mul-1-neg70.0%
unsub-neg70.0%
*-commutative70.0%
associate-/l*70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in a around inf 69.9%
associate-*r/69.9%
associate-*r*69.9%
mul-1-neg69.9%
+-commutative69.9%
mul-1-neg69.9%
sub-neg69.9%
Simplified69.9%
Taylor expanded in x around inf 63.2%
associate-*r/63.2%
mul-1-neg63.2%
Simplified63.2%
if -1.36e-27 < z < 8.80000000000000075e-47 or 8.2e13 < z < 6.79999999999999967e25Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 63.7%
if 8.80000000000000075e-47 < z < 8.2e13Initial program 99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 92.6%
*-commutative92.6%
Simplified92.6%
div-inv92.5%
Applied egg-rr92.5%
Taylor expanded in t around 0 64.8%
associate-/r*64.8%
Simplified64.8%
Final simplification63.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.8e+115)
(/ y a)
(if (<= z -1.05e+58)
(/ (/ x z) (- a))
(if (<= z -2.9e-27)
(/ y a)
(if (<= z 6.2e-47)
(/ x t)
(if (<= z 60000000000.0)
(/ (- x) (* z a))
(if (<= z 4.7e+26) (/ x t) (/ y a))))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e+115) {
tmp = y / a;
} else if (z <= -1.05e+58) {
tmp = (x / z) / -a;
} else if (z <= -2.9e-27) {
tmp = y / a;
} else if (z <= 6.2e-47) {
tmp = x / t;
} else if (z <= 60000000000.0) {
tmp = -x / (z * a);
} else if (z <= 4.7e+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 <= (-2.8d+115)) then
tmp = y / a
else if (z <= (-1.05d+58)) then
tmp = (x / z) / -a
else if (z <= (-2.9d-27)) then
tmp = y / a
else if (z <= 6.2d-47) then
tmp = x / t
else if (z <= 60000000000.0d0) then
tmp = -x / (z * a)
else if (z <= 4.7d+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 <= -2.8e+115) {
tmp = y / a;
} else if (z <= -1.05e+58) {
tmp = (x / z) / -a;
} else if (z <= -2.9e-27) {
tmp = y / a;
} else if (z <= 6.2e-47) {
tmp = x / t;
} else if (z <= 60000000000.0) {
tmp = -x / (z * a);
} else if (z <= 4.7e+26) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e+115: tmp = y / a elif z <= -1.05e+58: tmp = (x / z) / -a elif z <= -2.9e-27: tmp = y / a elif z <= 6.2e-47: tmp = x / t elif z <= 60000000000.0: tmp = -x / (z * a) elif z <= 4.7e+26: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e+115) tmp = Float64(y / a); elseif (z <= -1.05e+58) tmp = Float64(Float64(x / z) / Float64(-a)); elseif (z <= -2.9e-27) tmp = Float64(y / a); elseif (z <= 6.2e-47) tmp = Float64(x / t); elseif (z <= 60000000000.0) tmp = Float64(Float64(-x) / Float64(z * a)); elseif (z <= 4.7e+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 <= -2.8e+115) tmp = y / a; elseif (z <= -1.05e+58) tmp = (x / z) / -a; elseif (z <= -2.9e-27) tmp = y / a; elseif (z <= 6.2e-47) tmp = x / t; elseif (z <= 60000000000.0) tmp = -x / (z * a); elseif (z <= 4.7e+26) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e+115], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.05e+58], N[(N[(x / z), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[z, -2.9e-27], N[(y / a), $MachinePrecision], If[LessEqual[z, 6.2e-47], N[(x / t), $MachinePrecision], If[LessEqual[z, 60000000000.0], N[((-x) / N[(z * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.7e+26], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+115}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{+58}:\\
\;\;\;\;\frac{\frac{x}{z}}{-a}\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-27}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-47}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 60000000000:\\
\;\;\;\;\frac{-x}{z \cdot a}\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.8e115 or -1.05000000000000006e58 < z < -2.90000000000000004e-27 or 4.6999999999999998e26 < z Initial program 66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in z around inf 62.8%
if -2.8e115 < z < -1.05000000000000006e58Initial program 70.5%
*-commutative70.5%
Simplified70.5%
Taylor expanded in x around inf 70.0%
+-commutative70.0%
mul-1-neg70.0%
unsub-neg70.0%
*-commutative70.0%
associate-/l*70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in a around inf 69.9%
associate-*r/69.9%
associate-*r*69.9%
mul-1-neg69.9%
+-commutative69.9%
mul-1-neg69.9%
sub-neg69.9%
Simplified69.9%
Taylor expanded in x around inf 63.2%
associate-*r/63.2%
mul-1-neg63.2%
Simplified63.2%
if -2.90000000000000004e-27 < z < 6.1999999999999996e-47 or 6e10 < z < 4.6999999999999998e26Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 63.7%
if 6.1999999999999996e-47 < z < 6e10Initial program 99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in t around 0 71.5%
associate-*r/71.5%
neg-mul-171.5%
neg-sub071.5%
sub-neg71.5%
distribute-rgt-neg-out71.5%
+-commutative71.5%
associate--r+71.5%
neg-sub071.5%
distribute-rgt-neg-out71.5%
remove-double-neg71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in y around 0 64.7%
mul-1-neg64.7%
Simplified64.7%
Final simplification63.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.6e+115)
(/ y a)
(if (<= z -3.5e+57)
(/ (/ x a) (- z))
(if (<= z -1.36e-27)
(/ y a)
(if (<= z 1.4e-46)
(/ x t)
(if (<= z 5500000000000.0)
(/ (- x) (* z a))
(if (<= z 1.26e+26) (/ x t) (/ y a))))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.6e+115) {
tmp = y / a;
} else if (z <= -3.5e+57) {
tmp = (x / a) / -z;
} else if (z <= -1.36e-27) {
tmp = y / a;
} else if (z <= 1.4e-46) {
tmp = x / t;
} else if (z <= 5500000000000.0) {
tmp = -x / (z * a);
} else if (z <= 1.26e+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 <= (-4.6d+115)) then
tmp = y / a
else if (z <= (-3.5d+57)) then
tmp = (x / a) / -z
else if (z <= (-1.36d-27)) then
tmp = y / a
else if (z <= 1.4d-46) then
tmp = x / t
else if (z <= 5500000000000.0d0) then
tmp = -x / (z * a)
else if (z <= 1.26d+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 <= -4.6e+115) {
tmp = y / a;
} else if (z <= -3.5e+57) {
tmp = (x / a) / -z;
} else if (z <= -1.36e-27) {
tmp = y / a;
} else if (z <= 1.4e-46) {
tmp = x / t;
} else if (z <= 5500000000000.0) {
tmp = -x / (z * a);
} else if (z <= 1.26e+26) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.6e+115: tmp = y / a elif z <= -3.5e+57: tmp = (x / a) / -z elif z <= -1.36e-27: tmp = y / a elif z <= 1.4e-46: tmp = x / t elif z <= 5500000000000.0: tmp = -x / (z * a) elif z <= 1.26e+26: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.6e+115) tmp = Float64(y / a); elseif (z <= -3.5e+57) tmp = Float64(Float64(x / a) / Float64(-z)); elseif (z <= -1.36e-27) tmp = Float64(y / a); elseif (z <= 1.4e-46) tmp = Float64(x / t); elseif (z <= 5500000000000.0) tmp = Float64(Float64(-x) / Float64(z * a)); elseif (z <= 1.26e+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 <= -4.6e+115) tmp = y / a; elseif (z <= -3.5e+57) tmp = (x / a) / -z; elseif (z <= -1.36e-27) tmp = y / a; elseif (z <= 1.4e-46) tmp = x / t; elseif (z <= 5500000000000.0) tmp = -x / (z * a); elseif (z <= 1.26e+26) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.6e+115], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.5e+57], N[(N[(x / a), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[z, -1.36e-27], N[(y / a), $MachinePrecision], If[LessEqual[z, 1.4e-46], N[(x / t), $MachinePrecision], If[LessEqual[z, 5500000000000.0], N[((-x) / N[(z * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.26e+26], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+115}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{+57}:\\
\;\;\;\;\frac{\frac{x}{a}}{-z}\\
\mathbf{elif}\;z \leq -1.36 \cdot 10^{-27}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-46}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 5500000000000:\\
\;\;\;\;\frac{-x}{z \cdot a}\\
\mathbf{elif}\;z \leq 1.26 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -4.60000000000000007e115 or -3.4999999999999997e57 < z < -1.36e-27 or 1.25999999999999995e26 < z Initial program 66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in z around inf 62.8%
if -4.60000000000000007e115 < z < -3.4999999999999997e57Initial program 70.5%
*-commutative70.5%
Simplified70.5%
Taylor expanded in x around inf 70.0%
+-commutative70.0%
mul-1-neg70.0%
unsub-neg70.0%
*-commutative70.0%
associate-/l*70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in a around inf 69.9%
associate-*r/69.9%
associate-*r*69.9%
mul-1-neg69.9%
+-commutative69.9%
mul-1-neg69.9%
sub-neg69.9%
Simplified69.9%
Taylor expanded in x around 0 69.9%
mul-1-neg69.9%
unsub-neg69.9%
Simplified69.9%
Taylor expanded in y around 0 48.4%
mul-1-neg48.4%
associate-/r*63.1%
distribute-frac-neg263.1%
Simplified63.1%
if -1.36e-27 < z < 1.3999999999999999e-46 or 5.5e12 < z < 1.25999999999999995e26Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 63.7%
if 1.3999999999999999e-46 < z < 5.5e12Initial program 99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in t around 0 71.5%
associate-*r/71.5%
neg-mul-171.5%
neg-sub071.5%
sub-neg71.5%
distribute-rgt-neg-out71.5%
+-commutative71.5%
associate--r+71.5%
neg-sub071.5%
distribute-rgt-neg-out71.5%
remove-double-neg71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in y around 0 64.7%
mul-1-neg64.7%
Simplified64.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1e-27)
(/ y a)
(if (<= z 7.2e-47)
(/ x t)
(if (<= z 35000000000.0)
(/ (- x) (* z a))
(if (<= z 4.4e+26) (/ x t) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e-27) {
tmp = y / a;
} else if (z <= 7.2e-47) {
tmp = x / t;
} else if (z <= 35000000000.0) {
tmp = -x / (z * a);
} else if (z <= 4.4e+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 <= (-1d-27)) then
tmp = y / a
else if (z <= 7.2d-47) then
tmp = x / t
else if (z <= 35000000000.0d0) then
tmp = -x / (z * a)
else if (z <= 4.4d+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 <= -1e-27) {
tmp = y / a;
} else if (z <= 7.2e-47) {
tmp = x / t;
} else if (z <= 35000000000.0) {
tmp = -x / (z * a);
} else if (z <= 4.4e+26) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e-27: tmp = y / a elif z <= 7.2e-47: tmp = x / t elif z <= 35000000000.0: tmp = -x / (z * a) elif z <= 4.4e+26: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e-27) tmp = Float64(y / a); elseif (z <= 7.2e-47) tmp = Float64(x / t); elseif (z <= 35000000000.0) tmp = Float64(Float64(-x) / Float64(z * a)); elseif (z <= 4.4e+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 <= -1e-27) tmp = y / a; elseif (z <= 7.2e-47) tmp = x / t; elseif (z <= 35000000000.0) tmp = -x / (z * a); elseif (z <= 4.4e+26) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e-27], N[(y / a), $MachinePrecision], If[LessEqual[z, 7.2e-47], N[(x / t), $MachinePrecision], If[LessEqual[z, 35000000000.0], N[((-x) / N[(z * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e+26], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-27}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-47}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 35000000000:\\
\;\;\;\;\frac{-x}{z \cdot a}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1e-27 or 4.40000000000000014e26 < z Initial program 66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in z around inf 59.2%
if -1e-27 < z < 7.19999999999999982e-47 or 3.5e10 < z < 4.40000000000000014e26Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 63.7%
if 7.19999999999999982e-47 < z < 3.5e10Initial program 99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in t around 0 71.5%
associate-*r/71.5%
neg-mul-171.5%
neg-sub071.5%
sub-neg71.5%
distribute-rgt-neg-out71.5%
+-commutative71.5%
associate--r+71.5%
neg-sub071.5%
distribute-rgt-neg-out71.5%
remove-double-neg71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in y around 0 64.7%
mul-1-neg64.7%
Simplified64.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e-43) (not (<= z 1.2e+15))) (/ (- y (/ x z)) a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e-43) || !(z <= 1.2e+15)) {
tmp = (y - (x / z)) / 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 <= (-2.4d-43)) .or. (.not. (z <= 1.2d+15))) then
tmp = (y - (x / z)) / 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 <= -2.4e-43) || !(z <= 1.2e+15)) {
tmp = (y - (x / z)) / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.4e-43) or not (z <= 1.2e+15): tmp = (y - (x / z)) / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e-43) || !(z <= 1.2e+15)) tmp = Float64(Float64(y - Float64(x / z)) / 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 <= -2.4e-43) || ~((z <= 1.2e+15))) tmp = (y - (x / z)) / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e-43], N[Not[LessEqual[z, 1.2e+15]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-43} \lor \neg \left(z \leq 1.2 \cdot 10^{+15}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -2.4000000000000002e-43 or 1.2e15 < z Initial program 68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in x around inf 59.6%
+-commutative59.6%
mul-1-neg59.6%
unsub-neg59.6%
*-commutative59.6%
associate-/l*60.1%
*-commutative60.1%
Simplified60.1%
Taylor expanded in a around inf 73.4%
associate-*r/73.4%
associate-*r*73.4%
mul-1-neg73.4%
+-commutative73.4%
mul-1-neg73.4%
sub-neg73.4%
Simplified73.4%
Taylor expanded in x around 0 80.4%
mul-1-neg80.4%
unsub-neg80.4%
Simplified80.4%
if -2.4000000000000002e-43 < z < 1.2e15Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 81.9%
*-commutative81.9%
Simplified81.9%
Final simplification81.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.3e+117) (not (<= z 1.7e+27))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.3e+117) || !(z <= 1.7e+27)) {
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 <= (-4.3d+117)) .or. (.not. (z <= 1.7d+27))) 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 <= -4.3e+117) || !(z <= 1.7e+27)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.3e+117) or not (z <= 1.7e+27): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.3e+117) || !(z <= 1.7e+27)) 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 <= -4.3e+117) || ~((z <= 1.7e+27))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.3e+117], N[Not[LessEqual[z, 1.7e+27]], $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 -4.3 \cdot 10^{+117} \lor \neg \left(z \leq 1.7 \cdot 10^{+27}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -4.29999999999999998e117 or 1.7e27 < z Initial program 61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in z around inf 64.2%
if -4.29999999999999998e117 < z < 1.7e27Initial program 97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in x around inf 75.8%
*-commutative75.8%
Simplified75.8%
Final simplification71.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.55e-27) (not (<= z 4.2e+25))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.55e-27) || !(z <= 4.2e+25)) {
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.55d-27)) .or. (.not. (z <= 4.2d+25))) 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.55e-27) || !(z <= 4.2e+25)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.55e-27) or not (z <= 4.2e+25): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.55e-27) || !(z <= 4.2e+25)) 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.55e-27) || ~((z <= 4.2e+25))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.55e-27], N[Not[LessEqual[z, 4.2e+25]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-27} \lor \neg \left(z \leq 4.2 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -1.5499999999999999e-27 or 4.1999999999999998e25 < z Initial program 66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in z around inf 59.2%
if -1.5499999999999999e-27 < z < 4.1999999999999998e25Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 59.9%
Final simplification59.5%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in z around 0 35.0%
(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 2024100
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(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))))