
(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
(let* ((t_1 (- x (* y z))) (t_2 (/ t_1 (- t (* z a)))))
(if (<= t_2 -5e-290)
t_2
(if (<= t_2 0.0)
(* (/ t_1 z) (/ 1.0 (- (/ t z) a)))
(if (<= t_2 1e+269) t_2 (/ y (- a (/ t z))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * z);
double t_2 = t_1 / (t - (z * a));
double tmp;
if (t_2 <= -5e-290) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = (t_1 / z) * (1.0 / ((t / z) - a));
} else if (t_2 <= 1e+269) {
tmp = t_2;
} else {
tmp = y / (a - (t / z));
}
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 - (y * z)
t_2 = t_1 / (t - (z * a))
if (t_2 <= (-5d-290)) then
tmp = t_2
else if (t_2 <= 0.0d0) then
tmp = (t_1 / z) * (1.0d0 / ((t / z) - a))
else if (t_2 <= 1d+269) then
tmp = t_2
else
tmp = y / (a - (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * z);
double t_2 = t_1 / (t - (z * a));
double tmp;
if (t_2 <= -5e-290) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = (t_1 / z) * (1.0 / ((t / z) - a));
} else if (t_2 <= 1e+269) {
tmp = t_2;
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * z) t_2 = t_1 / (t - (z * a)) tmp = 0 if t_2 <= -5e-290: tmp = t_2 elif t_2 <= 0.0: tmp = (t_1 / z) * (1.0 / ((t / z) - a)) elif t_2 <= 1e+269: tmp = t_2 else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * z)) t_2 = Float64(t_1 / Float64(t - Float64(z * a))) tmp = 0.0 if (t_2 <= -5e-290) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(Float64(t_1 / z) * Float64(1.0 / Float64(Float64(t / z) - a))); elseif (t_2 <= 1e+269) tmp = t_2; else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * z); t_2 = t_1 / (t - (z * a)); tmp = 0.0; if (t_2 <= -5e-290) tmp = t_2; elseif (t_2 <= 0.0) tmp = (t_1 / z) * (1.0 / ((t / z) - a)); elseif (t_2 <= 1e+269) tmp = t_2; else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-290], t$95$2, If[LessEqual[t$95$2, 0.0], N[(N[(t$95$1 / z), $MachinePrecision] * N[(1.0 / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+269], t$95$2, N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot z\\
t_2 := \frac{t\_1}{t - z \cdot a}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-290}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{t\_1}{z} \cdot \frac{1}{\frac{t}{z} - a}\\
\mathbf{elif}\;t\_2 \leq 10^{+269}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -5.0000000000000001e-290 or 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 1e269Initial program 97.8%
if -5.0000000000000001e-290 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0Initial program 54.3%
*-commutative54.3%
Simplified54.3%
Taylor expanded in z around inf 54.3%
associate-/r*99.9%
div-inv99.8%
Applied egg-rr99.8%
if 1e269 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 36.4%
*-commutative36.4%
Simplified36.4%
Taylor expanded in z around inf 36.4%
Taylor expanded in x around 0 83.1%
mul-1-neg83.1%
distribute-neg-frac283.1%
sub-neg83.1%
+-commutative83.1%
distribute-neg-in83.1%
remove-double-neg83.1%
unsub-neg83.1%
Simplified83.1%
Final simplification96.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ y (- a (/ t z)))))
(if (<= z -1.45e+116)
t_1
(if (<= z -4.2e-14)
(/ x (- t (* z a)))
(if (<= z 2.45e-11) (/ (- x (* y z)) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a - (t / z));
double tmp;
if (z <= -1.45e+116) {
tmp = t_1;
} else if (z <= -4.2e-14) {
tmp = x / (t - (z * a));
} else if (z <= 2.45e-11) {
tmp = (x - (y * z)) / 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 / (a - (t / z))
if (z <= (-1.45d+116)) then
tmp = t_1
else if (z <= (-4.2d-14)) then
tmp = x / (t - (z * a))
else if (z <= 2.45d-11) then
tmp = (x - (y * z)) / 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 / (a - (t / z));
double tmp;
if (z <= -1.45e+116) {
tmp = t_1;
} else if (z <= -4.2e-14) {
tmp = x / (t - (z * a));
} else if (z <= 2.45e-11) {
tmp = (x - (y * z)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y / (a - (t / z)) tmp = 0 if z <= -1.45e+116: tmp = t_1 elif z <= -4.2e-14: tmp = x / (t - (z * a)) elif z <= 2.45e-11: tmp = (x - (y * z)) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y / Float64(a - Float64(t / z))) tmp = 0.0 if (z <= -1.45e+116) tmp = t_1; elseif (z <= -4.2e-14) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 2.45e-11) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y / (a - (t / z)); tmp = 0.0; if (z <= -1.45e+116) tmp = t_1; elseif (z <= -4.2e-14) tmp = x / (t - (z * a)); elseif (z <= 2.45e-11) tmp = (x - (y * z)) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e+116], t$95$1, If[LessEqual[z, -4.2e-14], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.45e-11], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{-11}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.4500000000000001e116 or 2.4499999999999999e-11 < z Initial program 65.9%
*-commutative65.9%
Simplified65.9%
Taylor expanded in z around inf 65.9%
Taylor expanded in x around 0 77.3%
mul-1-neg77.3%
distribute-neg-frac277.3%
sub-neg77.3%
+-commutative77.3%
distribute-neg-in77.3%
remove-double-neg77.3%
unsub-neg77.3%
Simplified77.3%
if -1.4500000000000001e116 < z < -4.1999999999999998e-14Initial program 95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in x around inf 67.5%
*-commutative67.5%
Simplified67.5%
if -4.1999999999999998e-14 < z < 2.4499999999999999e-11Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 83.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.2e+122) (not (<= z 9.2e+165))) (/ y (- a (/ t z))) (/ (- x (* y z)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.2e+122) || !(z <= 9.2e+165)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / (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.2d+122)) .or. (.not. (z <= 9.2d+165))) then
tmp = y / (a - (t / z))
else
tmp = (x - (y * z)) / (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.2e+122) || !(z <= 9.2e+165)) {
tmp = y / (a - (t / z));
} else {
tmp = (x - (y * z)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.2e+122) or not (z <= 9.2e+165): tmp = y / (a - (t / z)) else: tmp = (x - (y * z)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.2e+122) || !(z <= 9.2e+165)) tmp = Float64(y / Float64(a - Float64(t / z))); else tmp = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.2e+122) || ~((z <= 9.2e+165))) tmp = y / (a - (t / z)); else tmp = (x - (y * z)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.2e+122], N[Not[LessEqual[z, 9.2e+165]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+122} \lor \neg \left(z \leq 9.2 \cdot 10^{+165}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -1.2000000000000001e122 or 9.20000000000000063e165 < z Initial program 51.7%
*-commutative51.7%
Simplified51.7%
Taylor expanded in z around inf 51.8%
Taylor expanded in x around 0 87.7%
mul-1-neg87.7%
distribute-neg-frac287.7%
sub-neg87.7%
+-commutative87.7%
distribute-neg-in87.7%
remove-double-neg87.7%
unsub-neg87.7%
Simplified87.7%
if -1.2000000000000001e122 < z < 9.20000000000000063e165Initial program 96.8%
Final simplification94.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.4e+109)
(/ y a)
(if (<= z -8.4e-16)
(/ (/ x a) (- z))
(if (<= z 2.55e-11) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.4e+109) {
tmp = y / a;
} else if (z <= -8.4e-16) {
tmp = (x / a) / -z;
} else if (z <= 2.55e-11) {
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.4d+109)) then
tmp = y / a
else if (z <= (-8.4d-16)) then
tmp = (x / a) / -z
else if (z <= 2.55d-11) 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.4e+109) {
tmp = y / a;
} else if (z <= -8.4e-16) {
tmp = (x / a) / -z;
} else if (z <= 2.55e-11) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.4e+109: tmp = y / a elif z <= -8.4e-16: tmp = (x / a) / -z elif z <= 2.55e-11: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.4e+109) tmp = Float64(y / a); elseif (z <= -8.4e-16) tmp = Float64(Float64(x / a) / Float64(-z)); elseif (z <= 2.55e-11) 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.4e+109) tmp = y / a; elseif (z <= -8.4e-16) tmp = (x / a) / -z; elseif (z <= 2.55e-11) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.4e+109], N[(y / a), $MachinePrecision], If[LessEqual[z, -8.4e-16], N[(N[(x / a), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[z, 2.55e-11], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+109}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -8.4 \cdot 10^{-16}:\\
\;\;\;\;\frac{\frac{x}{a}}{-z}\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -3.40000000000000006e109 or 2.54999999999999992e-11 < z Initial program 66.2%
*-commutative66.2%
Simplified66.2%
Taylor expanded in z around inf 54.9%
if -3.40000000000000006e109 < z < -8.4000000000000004e-16Initial program 95.8%
*-commutative95.8%
Simplified95.8%
Taylor expanded in y around inf 87.6%
Simplified87.6%
Taylor expanded in a around inf 47.8%
associate-/l*47.7%
associate-*r/47.7%
neg-mul-147.7%
*-commutative47.7%
Simplified47.7%
Taylor expanded in y around 0 49.5%
mul-1-neg49.5%
associate-/r*53.4%
distribute-neg-frac253.4%
Simplified53.4%
if -8.4000000000000004e-16 < z < 2.54999999999999992e-11Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 62.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e+108) (/ y a) (if (<= z -2.7e-12) (/ x (* z (- a))) (if (<= z 2.6e-11) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+108) {
tmp = y / a;
} else if (z <= -2.7e-12) {
tmp = x / (z * -a);
} else if (z <= 2.6e-11) {
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.1d+108)) then
tmp = y / a
else if (z <= (-2.7d-12)) then
tmp = x / (z * -a)
else if (z <= 2.6d-11) 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.1e+108) {
tmp = y / a;
} else if (z <= -2.7e-12) {
tmp = x / (z * -a);
} else if (z <= 2.6e-11) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.1e+108: tmp = y / a elif z <= -2.7e-12: tmp = x / (z * -a) elif z <= 2.6e-11: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e+108) tmp = Float64(y / a); elseif (z <= -2.7e-12) tmp = Float64(x / Float64(z * Float64(-a))); elseif (z <= 2.6e-11) 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.1e+108) tmp = y / a; elseif (z <= -2.7e-12) tmp = x / (z * -a); elseif (z <= 2.6e-11) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+108], N[(y / a), $MachinePrecision], If[LessEqual[z, -2.7e-12], N[(x / N[(z * (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e-11], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+108}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{z \cdot \left(-a\right)}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.1000000000000001e108 or 2.6000000000000001e-11 < z Initial program 66.2%
*-commutative66.2%
Simplified66.2%
Taylor expanded in z around inf 54.9%
if -2.1000000000000001e108 < z < -2.6999999999999998e-12Initial program 95.8%
*-commutative95.8%
Simplified95.8%
Taylor expanded in t around 0 59.9%
associate-*r/59.9%
neg-mul-159.9%
neg-sub059.9%
sub-neg59.9%
distribute-rgt-neg-out59.9%
+-commutative59.9%
associate--r+59.9%
neg-sub059.9%
distribute-rgt-neg-out59.9%
remove-double-neg59.9%
*-commutative59.9%
Simplified59.9%
Taylor expanded in y around 0 49.5%
neg-mul-149.5%
Simplified49.5%
if -2.6999999999999998e-12 < z < 2.6000000000000001e-11Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 62.2%
Final simplification57.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.2e+117) (not (<= z 1.02e-21))) (/ y (- a (/ t z))) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e+117) || !(z <= 1.02e-21)) {
tmp = y / (a - (t / z));
} 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 <= (-7.2d+117)) .or. (.not. (z <= 1.02d-21))) then
tmp = y / (a - (t / z))
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 <= -7.2e+117) || !(z <= 1.02e-21)) {
tmp = y / (a - (t / z));
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e+117) or not (z <= 1.02e-21): tmp = y / (a - (t / z)) else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e+117) || !(z <= 1.02e-21)) tmp = Float64(y / Float64(a - Float64(t / z))); 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 <= -7.2e+117) || ~((z <= 1.02e-21))) tmp = y / (a - (t / z)); else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e+117], N[Not[LessEqual[z, 1.02e-21]], $MachinePrecision]], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+117} \lor \neg \left(z \leq 1.02 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -7.20000000000000025e117 or 1.02000000000000004e-21 < z Initial program 67.1%
*-commutative67.1%
Simplified67.1%
Taylor expanded in z around inf 67.1%
Taylor expanded in x around 0 76.4%
mul-1-neg76.4%
distribute-neg-frac276.4%
sub-neg76.4%
+-commutative76.4%
distribute-neg-in76.4%
remove-double-neg76.4%
unsub-neg76.4%
Simplified76.4%
if -7.20000000000000025e117 < z < 1.02000000000000004e-21Initial program 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 73.4%
*-commutative73.4%
Simplified73.4%
Final simplification74.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.2e+118) (not (<= z 1.8e+163))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.2e+118) || !(z <= 1.8e+163)) {
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.2d+118)) .or. (.not. (z <= 1.8d+163))) 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.2e+118) || !(z <= 1.8e+163)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.2e+118) or not (z <= 1.8e+163): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.2e+118) || !(z <= 1.8e+163)) 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.2e+118) || ~((z <= 1.8e+163))) 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.2e+118], N[Not[LessEqual[z, 1.8e+163]], $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.2 \cdot 10^{+118} \lor \neg \left(z \leq 1.8 \cdot 10^{+163}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -5.20000000000000032e118 or 1.79999999999999989e163 < z Initial program 51.7%
*-commutative51.7%
Simplified51.7%
Taylor expanded in z around inf 68.3%
if -5.20000000000000032e118 < z < 1.79999999999999989e163Initial program 96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in x around inf 66.5%
*-commutative66.5%
Simplified66.5%
Final simplification67.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.7e+50) (not (<= z 5.5e-16))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.7e+50) || !(z <= 5.5e-16)) {
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.7d+50)) .or. (.not. (z <= 5.5d-16))) 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.7e+50) || !(z <= 5.5e-16)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.7e+50) or not (z <= 5.5e-16): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.7e+50) || !(z <= 5.5e-16)) 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.7e+50) || ~((z <= 5.5e-16))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.7e+50], N[Not[LessEqual[z, 5.5e-16]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+50} \lor \neg \left(z \leq 5.5 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -1.6999999999999999e50 or 5.49999999999999964e-16 < z Initial program 67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in z around inf 52.8%
if -1.6999999999999999e50 < z < 5.49999999999999964e-16Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 58.6%
Final simplification55.9%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around 0 36.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 2024139
(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))))