
(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 -3.6e+84) (not (<= z 3.3e+111))) (/ (- y (/ x z)) a) (/ (- (* z y) x) (- (* z a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.6e+84) || !(z <= 3.3e+111)) {
tmp = (y - (x / z)) / a;
} else {
tmp = ((z * y) - x) / ((z * a) - 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 <= (-3.6d+84)) .or. (.not. (z <= 3.3d+111))) then
tmp = (y - (x / z)) / a
else
tmp = ((z * y) - x) / ((z * a) - 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 <= -3.6e+84) || !(z <= 3.3e+111)) {
tmp = (y - (x / z)) / a;
} else {
tmp = ((z * y) - x) / ((z * a) - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.6e+84) or not (z <= 3.3e+111): tmp = (y - (x / z)) / a else: tmp = ((z * y) - x) / ((z * a) - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.6e+84) || !(z <= 3.3e+111)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(Float64(z * y) - x) / Float64(Float64(z * a) - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.6e+84) || ~((z <= 3.3e+111))) tmp = (y - (x / z)) / a; else tmp = ((z * y) - x) / ((z * a) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.6e+84], N[Not[LessEqual[z, 3.3e+111]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+84} \lor \neg \left(z \leq 3.3 \cdot 10^{+111}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y - x}{z \cdot a - t}\\
\end{array}
\end{array}
if z < -3.5999999999999999e84 or 3.3000000000000001e111 < z Initial program 48.7%
*-commutative48.7%
Simplified48.7%
Taylor expanded in z around inf 48.6%
Taylor expanded in t around 0 84.9%
mul-1-neg84.9%
distribute-neg-frac284.9%
Simplified84.9%
if -3.5999999999999999e84 < z < 3.3000000000000001e111Initial program 97.6%
Final simplification93.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -6.2e+17)
t_1
(if (<= z -6e-62)
(* y (/ z (- (* z a) t)))
(if (<= z 8.8e-51)
(/ x (- t (* z a)))
(if (<= z 1.25e+20) (/ (* z (- (/ x z) y)) t) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -6.2e+17) {
tmp = t_1;
} else if (z <= -6e-62) {
tmp = y * (z / ((z * a) - t));
} else if (z <= 8.8e-51) {
tmp = x / (t - (z * a));
} else if (z <= 1.25e+20) {
tmp = (z * ((x / z) - y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y - (x / z)) / a
if (z <= (-6.2d+17)) then
tmp = t_1
else if (z <= (-6d-62)) then
tmp = y * (z / ((z * a) - t))
else if (z <= 8.8d-51) then
tmp = x / (t - (z * a))
else if (z <= 1.25d+20) then
tmp = (z * ((x / z) - y)) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -6.2e+17) {
tmp = t_1;
} else if (z <= -6e-62) {
tmp = y * (z / ((z * a) - t));
} else if (z <= 8.8e-51) {
tmp = x / (t - (z * a));
} else if (z <= 1.25e+20) {
tmp = (z * ((x / z) - y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -6.2e+17: tmp = t_1 elif z <= -6e-62: tmp = y * (z / ((z * a) - t)) elif z <= 8.8e-51: tmp = x / (t - (z * a)) elif z <= 1.25e+20: tmp = (z * ((x / z) - y)) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -6.2e+17) tmp = t_1; elseif (z <= -6e-62) tmp = Float64(y * Float64(z / Float64(Float64(z * a) - t))); elseif (z <= 8.8e-51) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 1.25e+20) tmp = Float64(Float64(z * Float64(Float64(x / z) - y)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; tmp = 0.0; if (z <= -6.2e+17) tmp = t_1; elseif (z <= -6e-62) tmp = y * (z / ((z * a) - t)); elseif (z <= 8.8e-51) tmp = x / (t - (z * a)); elseif (z <= 1.25e+20) tmp = (z * ((x / z) - y)) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -6.2e+17], t$95$1, If[LessEqual[z, -6e-62], N[(y * N[(z / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.8e-51], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e+20], N[(N[(z * N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-62}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot a - t}\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+20}:\\
\;\;\;\;\frac{z \cdot \left(\frac{x}{z} - y\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.2e17 or 1.25e20 < z Initial program 58.6%
*-commutative58.6%
Simplified58.6%
Taylor expanded in z around inf 58.6%
Taylor expanded in t around 0 82.1%
mul-1-neg82.1%
distribute-neg-frac282.1%
Simplified82.1%
if -6.2e17 < z < -6.0000000000000002e-62Initial program 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 67.5%
mul-1-neg67.5%
associate-/l*67.7%
distribute-rgt-neg-in67.7%
sub-neg67.7%
mul-1-neg67.7%
+-commutative67.7%
mul-1-neg67.7%
distribute-rgt-neg-in67.7%
fma-undefine67.7%
distribute-neg-frac267.7%
neg-sub067.7%
fma-undefine67.7%
distribute-rgt-neg-in67.7%
mul-1-neg67.7%
associate-*r*67.7%
neg-mul-167.7%
*-commutative67.7%
associate--r+67.7%
neg-sub067.7%
distribute-rgt-neg-out67.7%
remove-double-neg67.7%
*-commutative67.7%
Simplified67.7%
if -6.0000000000000002e-62 < z < 8.8000000000000001e-51Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 82.1%
if 8.8000000000000001e-51 < z < 1.25e20Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 75.4%
*-commutative75.4%
Simplified75.4%
Taylor expanded in z around inf 75.4%
Final simplification80.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -33000000.0)
t_1
(if (<= z -6.4e-62)
(* y (/ z (- (* z a) t)))
(if (<= z 9e-53)
(/ x (- t (* z a)))
(if (<= z 9.8e+16) (/ (- x (* z y)) t) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -33000000.0) {
tmp = t_1;
} else if (z <= -6.4e-62) {
tmp = y * (z / ((z * a) - t));
} else if (z <= 9e-53) {
tmp = x / (t - (z * a));
} else if (z <= 9.8e+16) {
tmp = (x - (z * y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y - (x / z)) / a
if (z <= (-33000000.0d0)) then
tmp = t_1
else if (z <= (-6.4d-62)) then
tmp = y * (z / ((z * a) - t))
else if (z <= 9d-53) then
tmp = x / (t - (z * a))
else if (z <= 9.8d+16) then
tmp = (x - (z * y)) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -33000000.0) {
tmp = t_1;
} else if (z <= -6.4e-62) {
tmp = y * (z / ((z * a) - t));
} else if (z <= 9e-53) {
tmp = x / (t - (z * a));
} else if (z <= 9.8e+16) {
tmp = (x - (z * y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -33000000.0: tmp = t_1 elif z <= -6.4e-62: tmp = y * (z / ((z * a) - t)) elif z <= 9e-53: tmp = x / (t - (z * a)) elif z <= 9.8e+16: tmp = (x - (z * y)) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -33000000.0) tmp = t_1; elseif (z <= -6.4e-62) tmp = Float64(y * Float64(z / Float64(Float64(z * a) - t))); elseif (z <= 9e-53) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 9.8e+16) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; tmp = 0.0; if (z <= -33000000.0) tmp = t_1; elseif (z <= -6.4e-62) tmp = y * (z / ((z * a) - t)); elseif (z <= 9e-53) tmp = x / (t - (z * a)); elseif (z <= 9.8e+16) tmp = (x - (z * y)) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -33000000.0], t$95$1, If[LessEqual[z, -6.4e-62], N[(y * N[(z / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e-53], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.8e+16], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -33000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{-62}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot a - t}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-53}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+16}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.3e7 or 9.8e16 < z Initial program 58.6%
*-commutative58.6%
Simplified58.6%
Taylor expanded in z around inf 58.6%
Taylor expanded in t around 0 82.1%
mul-1-neg82.1%
distribute-neg-frac282.1%
Simplified82.1%
if -3.3e7 < z < -6.40000000000000043e-62Initial program 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 67.5%
mul-1-neg67.5%
associate-/l*67.7%
distribute-rgt-neg-in67.7%
sub-neg67.7%
mul-1-neg67.7%
+-commutative67.7%
mul-1-neg67.7%
distribute-rgt-neg-in67.7%
fma-undefine67.7%
distribute-neg-frac267.7%
neg-sub067.7%
fma-undefine67.7%
distribute-rgt-neg-in67.7%
mul-1-neg67.7%
associate-*r*67.7%
neg-mul-167.7%
*-commutative67.7%
associate--r+67.7%
neg-sub067.7%
distribute-rgt-neg-out67.7%
remove-double-neg67.7%
*-commutative67.7%
Simplified67.7%
if -6.40000000000000043e-62 < z < 8.9999999999999997e-53Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 82.1%
if 8.9999999999999997e-53 < z < 9.8e16Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 75.4%
*-commutative75.4%
Simplified75.4%
Final simplification80.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -6.8e-62)
t_1
(if (<= z 8e-52)
(/ x (- t (* z a)))
(if (<= z 5.6e+17) (/ (- x (* z y)) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -6.8e-62) {
tmp = t_1;
} else if (z <= 8e-52) {
tmp = x / (t - (z * a));
} else if (z <= 5.6e+17) {
tmp = (x - (z * y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y - (x / z)) / a
if (z <= (-6.8d-62)) then
tmp = t_1
else if (z <= 8d-52) then
tmp = x / (t - (z * a))
else if (z <= 5.6d+17) then
tmp = (x - (z * y)) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -6.8e-62) {
tmp = t_1;
} else if (z <= 8e-52) {
tmp = x / (t - (z * a));
} else if (z <= 5.6e+17) {
tmp = (x - (z * y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -6.8e-62: tmp = t_1 elif z <= 8e-52: tmp = x / (t - (z * a)) elif z <= 5.6e+17: tmp = (x - (z * y)) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -6.8e-62) tmp = t_1; elseif (z <= 8e-52) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 5.6e+17) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; tmp = 0.0; if (z <= -6.8e-62) tmp = t_1; elseif (z <= 8e-52) tmp = x / (t - (z * a)); elseif (z <= 5.6e+17) tmp = (x - (z * y)) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -6.8e-62], t$95$1, If[LessEqual[z, 8e-52], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e+17], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+17}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.79999999999999975e-62 or 5.6e17 < z Initial program 64.2%
*-commutative64.2%
Simplified64.2%
Taylor expanded in z around inf 64.2%
Taylor expanded in t around 0 76.7%
mul-1-neg76.7%
distribute-neg-frac276.7%
Simplified76.7%
if -6.79999999999999975e-62 < z < 8.0000000000000001e-52Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 82.1%
if 8.0000000000000001e-52 < z < 5.6e17Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 75.4%
*-commutative75.4%
Simplified75.4%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.1e+60) (not (<= z 8.5e+33))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.1e+60) || !(z <= 8.5e+33)) {
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 <= (-5.1d+60)) .or. (.not. (z <= 8.5d+33))) 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 <= -5.1e+60) || !(z <= 8.5e+33)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.1e+60) or not (z <= 8.5e+33): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.1e+60) || !(z <= 8.5e+33)) 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 <= -5.1e+60) || ~((z <= 8.5e+33))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.1e+60], N[Not[LessEqual[z, 8.5e+33]], $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 -5.1 \cdot 10^{+60} \lor \neg \left(z \leq 8.5 \cdot 10^{+33}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -5.09999999999999996e60 or 8.4999999999999998e33 < z Initial program 55.4%
*-commutative55.4%
Simplified55.4%
Taylor expanded in z around inf 65.8%
if -5.09999999999999996e60 < z < 8.4999999999999998e33Initial program 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 72.9%
Final simplification70.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7e-62) (not (<= z 1e+20))) (/ y a) (/ 1.0 (/ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7e-62) || !(z <= 1e+20)) {
tmp = y / a;
} else {
tmp = 1.0 / (t / x);
}
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 <= (-7d-62)) .or. (.not. (z <= 1d+20))) then
tmp = y / a
else
tmp = 1.0d0 / (t / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7e-62) || !(z <= 1e+20)) {
tmp = y / a;
} else {
tmp = 1.0 / (t / x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7e-62) or not (z <= 1e+20): tmp = y / a else: tmp = 1.0 / (t / x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7e-62) || !(z <= 1e+20)) tmp = Float64(y / a); else tmp = Float64(1.0 / Float64(t / x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7e-62) || ~((z <= 1e+20))) tmp = y / a; else tmp = 1.0 / (t / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7e-62], N[Not[LessEqual[z, 1e+20]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(1.0 / N[(t / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-62} \lor \neg \left(z \leq 10^{+20}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{t}{x}}\\
\end{array}
\end{array}
if z < -7.0000000000000003e-62 or 1e20 < z Initial program 64.2%
*-commutative64.2%
Simplified64.2%
Taylor expanded in z around inf 59.4%
if -7.0000000000000003e-62 < z < 1e20Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 56.2%
clear-num56.4%
inv-pow56.4%
Applied egg-rr56.4%
unpow-156.4%
Simplified56.4%
Final simplification57.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.4e-62) (not (<= z 2e+21))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.4e-62) || !(z <= 2e+21)) {
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 <= (-6.4d-62)) .or. (.not. (z <= 2d+21))) 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 <= -6.4e-62) || !(z <= 2e+21)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.4e-62) or not (z <= 2e+21): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.4e-62) || !(z <= 2e+21)) 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 <= -6.4e-62) || ~((z <= 2e+21))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.4e-62], N[Not[LessEqual[z, 2e+21]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{-62} \lor \neg \left(z \leq 2 \cdot 10^{+21}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -6.40000000000000043e-62 or 2e21 < z Initial program 64.2%
*-commutative64.2%
Simplified64.2%
Taylor expanded in z around inf 59.4%
if -6.40000000000000043e-62 < z < 2e21Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 56.2%
Final simplification57.8%
(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.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in z around 0 34.5%
(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 2024191
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))
(/ (- x (* y z)) (- t (* a z))))