
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -6.2e+63)
t_1
(if (<= z 1.85e+89)
(/ (+ (* y x) (- (* z t) (* z a))) (+ y (* z (- b y))))
(-
t_1
(/ (- (* y (/ (- t a) (pow (- b y) 2.0))) (* x (/ y (- b y)))) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -6.2e+63) {
tmp = t_1;
} else if (z <= 1.85e+89) {
tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y)));
} else {
tmp = t_1 - (((y * ((t - a) / pow((b - y), 2.0))) - (x * (y / (b - y)))) / z);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / (b - y)
if (z <= (-6.2d+63)) then
tmp = t_1
else if (z <= 1.85d+89) then
tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y)))
else
tmp = t_1 - (((y * ((t - a) / ((b - y) ** 2.0d0))) - (x * (y / (b - y)))) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -6.2e+63) {
tmp = t_1;
} else if (z <= 1.85e+89) {
tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y)));
} else {
tmp = t_1 - (((y * ((t - a) / Math.pow((b - y), 2.0))) - (x * (y / (b - y)))) / z);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -6.2e+63: tmp = t_1 elif z <= 1.85e+89: tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y))) else: tmp = t_1 - (((y * ((t - a) / math.pow((b - y), 2.0))) - (x * (y / (b - y)))) / z) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -6.2e+63) tmp = t_1; elseif (z <= 1.85e+89) tmp = Float64(Float64(Float64(y * x) + Float64(Float64(z * t) - Float64(z * a))) / Float64(y + Float64(z * Float64(b - y)))); else tmp = Float64(t_1 - Float64(Float64(Float64(y * Float64(Float64(t - a) / (Float64(b - y) ^ 2.0))) - Float64(x * Float64(y / Float64(b - y)))) / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -6.2e+63) tmp = t_1; elseif (z <= 1.85e+89) tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y))); else tmp = t_1 - (((y * ((t - a) / ((b - y) ^ 2.0))) - (x * (y / (b - y)))) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.2e+63], t$95$1, If[LessEqual[z, 1.85e+89], N[(N[(N[(y * x), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - N[(N[(N[(y * N[(N[(t - a), $MachinePrecision] / N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+89}:\\
\;\;\;\;\frac{y \cdot x + \left(z \cdot t - z \cdot a\right)}{y + z \cdot \left(b - y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \frac{y \cdot \frac{t - a}{{\left(b - y\right)}^{2}} - x \cdot \frac{y}{b - y}}{z}\\
\end{array}
\end{array}
if z < -6.2000000000000001e63Initial program 42.2%
fma-define42.2%
+-commutative42.2%
fma-define42.2%
Simplified42.2%
Taylor expanded in z around inf 91.7%
if -6.2000000000000001e63 < z < 1.8499999999999999e89Initial program 88.4%
sub-neg88.4%
distribute-lft-in88.4%
Applied egg-rr88.4%
if 1.8499999999999999e89 < z Initial program 23.4%
fma-define23.4%
+-commutative23.4%
fma-define23.4%
Simplified23.4%
Taylor expanded in z around -inf 64.2%
associate--l+64.2%
mul-1-neg64.2%
distribute-lft-out--64.2%
associate-/l*72.3%
associate-/l*100.0%
div-sub100.0%
Simplified100.0%
Final simplification90.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y)))) (t_2 (+ b (/ y z))) (t_3 (- t_2 y)))
(if (or (<= z -7.6e-31) (not (<= z 1.2e-86)))
(+ (+ (/ t t_3) (/ (* y x) (* z t_3))) (/ a (- y t_2)))
(* x (+ (/ y t_1) (/ (* z (- t a)) (* x t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = b + (y / z);
double t_3 = t_2 - y;
double tmp;
if ((z <= -7.6e-31) || !(z <= 1.2e-86)) {
tmp = ((t / t_3) + ((y * x) / (z * t_3))) + (a / (y - t_2));
} else {
tmp = x * ((y / t_1) + ((z * (t - a)) / (x * t_1)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = y + (z * (b - y))
t_2 = b + (y / z)
t_3 = t_2 - y
if ((z <= (-7.6d-31)) .or. (.not. (z <= 1.2d-86))) then
tmp = ((t / t_3) + ((y * x) / (z * t_3))) + (a / (y - t_2))
else
tmp = x * ((y / t_1) + ((z * (t - a)) / (x * t_1)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = b + (y / z);
double t_3 = t_2 - y;
double tmp;
if ((z <= -7.6e-31) || !(z <= 1.2e-86)) {
tmp = ((t / t_3) + ((y * x) / (z * t_3))) + (a / (y - t_2));
} else {
tmp = x * ((y / t_1) + ((z * (t - a)) / (x * t_1)));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (z * (b - y)) t_2 = b + (y / z) t_3 = t_2 - y tmp = 0 if (z <= -7.6e-31) or not (z <= 1.2e-86): tmp = ((t / t_3) + ((y * x) / (z * t_3))) + (a / (y - t_2)) else: tmp = x * ((y / t_1) + ((z * (t - a)) / (x * t_1))) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) t_2 = Float64(b + Float64(y / z)) t_3 = Float64(t_2 - y) tmp = 0.0 if ((z <= -7.6e-31) || !(z <= 1.2e-86)) tmp = Float64(Float64(Float64(t / t_3) + Float64(Float64(y * x) / Float64(z * t_3))) + Float64(a / Float64(y - t_2))); else tmp = Float64(x * Float64(Float64(y / t_1) + Float64(Float64(z * Float64(t - a)) / Float64(x * t_1)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (z * (b - y)); t_2 = b + (y / z); t_3 = t_2 - y; tmp = 0.0; if ((z <= -7.6e-31) || ~((z <= 1.2e-86))) tmp = ((t / t_3) + ((y * x) / (z * t_3))) + (a / (y - t_2)); else tmp = x * ((y / t_1) + ((z * (t - a)) / (x * t_1))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b + N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 - y), $MachinePrecision]}, If[Or[LessEqual[z, -7.6e-31], N[Not[LessEqual[z, 1.2e-86]], $MachinePrecision]], N[(N[(N[(t / t$95$3), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] / N[(z * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a / N[(y - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / t$95$1), $MachinePrecision] + N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := b + \frac{y}{z}\\
t_3 := t\_2 - y\\
\mathbf{if}\;z \leq -7.6 \cdot 10^{-31} \lor \neg \left(z \leq 1.2 \cdot 10^{-86}\right):\\
\;\;\;\;\left(\frac{t}{t\_3} + \frac{y \cdot x}{z \cdot t\_3}\right) + \frac{a}{y - t\_2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{t\_1} + \frac{z \cdot \left(t - a\right)}{x \cdot t\_1}\right)\\
\end{array}
\end{array}
if z < -7.5999999999999999e-31 or 1.20000000000000007e-86 < z Initial program 57.0%
Taylor expanded in z around inf 57.0%
Taylor expanded in x around 0 86.4%
if -7.5999999999999999e-31 < z < 1.20000000000000007e-86Initial program 88.9%
fma-define88.9%
+-commutative88.9%
fma-define88.9%
Simplified88.9%
Taylor expanded in x around inf 93.0%
Final simplification89.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.1e+65) (not (<= z 2.35e+21))) (/ (- t a) (- b y)) (/ (+ (* y x) (- (* z t) (* z a))) (+ y (* z (- b y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.1e+65) || !(z <= 2.35e+21)) {
tmp = (t - a) / (b - y);
} else {
tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-3.1d+65)) .or. (.not. (z <= 2.35d+21))) then
tmp = (t - a) / (b - y)
else
tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.1e+65) || !(z <= 2.35e+21)) {
tmp = (t - a) / (b - y);
} else {
tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.1e+65) or not (z <= 2.35e+21): tmp = (t - a) / (b - y) else: tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.1e+65) || !(z <= 2.35e+21)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(Float64(Float64(y * x) + Float64(Float64(z * t) - Float64(z * a))) / Float64(y + Float64(z * Float64(b - y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -3.1e+65) || ~((z <= 2.35e+21))) tmp = (t - a) / (b - y); else tmp = ((y * x) + ((z * t) - (z * a))) / (y + (z * (b - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.1e+65], N[Not[LessEqual[z, 2.35e+21]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+65} \lor \neg \left(z \leq 2.35 \cdot 10^{+21}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x + \left(z \cdot t - z \cdot a\right)}{y + z \cdot \left(b - y\right)}\\
\end{array}
\end{array}
if z < -3.09999999999999991e65 or 2.35e21 < z Initial program 39.9%
fma-define39.9%
+-commutative39.9%
fma-define39.9%
Simplified39.9%
Taylor expanded in z around inf 86.8%
if -3.09999999999999991e65 < z < 2.35e21Initial program 89.3%
sub-neg89.3%
distribute-lft-in89.3%
Applied egg-rr89.3%
Final simplification88.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.6e+62) (not (<= z 2.6e+21))) (/ (- t a) (- b y)) (/ (+ (* y x) (* z (- t a))) (+ y (* z (- b y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.6e+62) || !(z <= 2.6e+21)) {
tmp = (t - a) / (b - y);
} else {
tmp = ((y * x) + (z * (t - a))) / (y + (z * (b - y)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-1.6d+62)) .or. (.not. (z <= 2.6d+21))) then
tmp = (t - a) / (b - y)
else
tmp = ((y * x) + (z * (t - a))) / (y + (z * (b - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.6e+62) || !(z <= 2.6e+21)) {
tmp = (t - a) / (b - y);
} else {
tmp = ((y * x) + (z * (t - a))) / (y + (z * (b - y)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.6e+62) or not (z <= 2.6e+21): tmp = (t - a) / (b - y) else: tmp = ((y * x) + (z * (t - a))) / (y + (z * (b - y))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.6e+62) || !(z <= 2.6e+21)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(Float64(Float64(y * x) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.6e+62) || ~((z <= 2.6e+21))) tmp = (t - a) / (b - y); else tmp = ((y * x) + (z * (t - a))) / (y + (z * (b - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.6e+62], N[Not[LessEqual[z, 2.6e+21]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+62} \lor \neg \left(z \leq 2.6 \cdot 10^{+21}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
\end{array}
\end{array}
if z < -1.59999999999999992e62 or 2.6e21 < z Initial program 39.9%
fma-define39.9%
+-commutative39.9%
fma-define39.9%
Simplified39.9%
Taylor expanded in z around inf 86.8%
if -1.59999999999999992e62 < z < 2.6e21Initial program 89.3%
Final simplification88.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -8.5e-37) (not (<= z 3.7e-99))) (/ (- t a) (- (+ b (/ y z)) y)) (+ x (/ (* z (- t a)) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -8.5e-37) || !(z <= 3.7e-99)) {
tmp = (t - a) / ((b + (y / z)) - y);
} else {
tmp = x + ((z * (t - a)) / y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-8.5d-37)) .or. (.not. (z <= 3.7d-99))) then
tmp = (t - a) / ((b + (y / z)) - y)
else
tmp = x + ((z * (t - a)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -8.5e-37) || !(z <= 3.7e-99)) {
tmp = (t - a) / ((b + (y / z)) - y);
} else {
tmp = x + ((z * (t - a)) / y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -8.5e-37) or not (z <= 3.7e-99): tmp = (t - a) / ((b + (y / z)) - y) else: tmp = x + ((z * (t - a)) / y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -8.5e-37) || !(z <= 3.7e-99)) tmp = Float64(Float64(t - a) / Float64(Float64(b + Float64(y / z)) - y)); else tmp = Float64(x + Float64(Float64(z * Float64(t - a)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -8.5e-37) || ~((z <= 3.7e-99))) tmp = (t - a) / ((b + (y / z)) - y); else tmp = x + ((z * (t - a)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -8.5e-37], N[Not[LessEqual[z, 3.7e-99]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(N[(b + N[(y / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-37} \lor \neg \left(z \leq 3.7 \cdot 10^{-99}\right):\\
\;\;\;\;\frac{t - a}{\left(b + \frac{y}{z}\right) - y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot \left(t - a\right)}{y}\\
\end{array}
\end{array}
if z < -8.5000000000000007e-37 or 3.7e-99 < z Initial program 58.1%
Taylor expanded in z around inf 58.0%
Taylor expanded in x around 0 80.0%
if -8.5000000000000007e-37 < z < 3.7e-99Initial program 89.2%
Taylor expanded in z around 0 71.2%
Taylor expanded in x around 0 81.9%
Final simplification80.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -5.8e-33) (not (<= z 8e-33))) (/ (- t a) (- b y)) (+ x (/ (* z (- t a)) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5.8e-33) || !(z <= 8e-33)) {
tmp = (t - a) / (b - y);
} else {
tmp = x + ((z * (t - a)) / y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-5.8d-33)) .or. (.not. (z <= 8d-33))) then
tmp = (t - a) / (b - y)
else
tmp = x + ((z * (t - a)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5.8e-33) || !(z <= 8e-33)) {
tmp = (t - a) / (b - y);
} else {
tmp = x + ((z * (t - a)) / y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -5.8e-33) or not (z <= 8e-33): tmp = (t - a) / (b - y) else: tmp = x + ((z * (t - a)) / y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5.8e-33) || !(z <= 8e-33)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(x + Float64(Float64(z * Float64(t - a)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -5.8e-33) || ~((z <= 8e-33))) tmp = (t - a) / (b - y); else tmp = x + ((z * (t - a)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5.8e-33], N[Not[LessEqual[z, 8e-33]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{-33} \lor \neg \left(z \leq 8 \cdot 10^{-33}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot \left(t - a\right)}{y}\\
\end{array}
\end{array}
if z < -5.80000000000000005e-33 or 8.0000000000000004e-33 < z Initial program 53.1%
fma-define53.1%
+-commutative53.1%
fma-define53.1%
Simplified53.1%
Taylor expanded in z around inf 79.0%
if -5.80000000000000005e-33 < z < 8.0000000000000004e-33Initial program 90.0%
Taylor expanded in z around 0 68.6%
Taylor expanded in x around 0 78.5%
Final simplification78.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -4.6e-36) (not (<= z 3.7e-99))) (/ (- t a) (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.6e-36) || !(z <= 3.7e-99)) {
tmp = (t - a) / (b - y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-4.6d-36)) .or. (.not. (z <= 3.7d-99))) then
tmp = (t - a) / (b - y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.6e-36) || !(z <= 3.7e-99)) {
tmp = (t - a) / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -4.6e-36) or not (z <= 3.7e-99): tmp = (t - a) / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -4.6e-36) || !(z <= 3.7e-99)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -4.6e-36) || ~((z <= 3.7e-99))) tmp = (t - a) / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -4.6e-36], N[Not[LessEqual[z, 3.7e-99]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{-36} \lor \neg \left(z \leq 3.7 \cdot 10^{-99}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.59999999999999993e-36 or 3.7e-99 < z Initial program 58.1%
fma-define58.1%
+-commutative58.1%
fma-define58.1%
Simplified58.1%
Taylor expanded in z around inf 73.0%
if -4.59999999999999993e-36 < z < 3.7e-99Initial program 89.2%
fma-define89.2%
+-commutative89.2%
fma-define89.2%
Simplified89.2%
Taylor expanded in z around 0 55.7%
Final simplification65.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -0.7) (not (<= y 6e-32))) (/ x (- 1.0 z)) (/ (- t a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -0.7) || !(y <= 6e-32)) {
tmp = x / (1.0 - z);
} else {
tmp = (t - a) / b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((y <= (-0.7d0)) .or. (.not. (y <= 6d-32))) then
tmp = x / (1.0d0 - z)
else
tmp = (t - a) / b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -0.7) || !(y <= 6e-32)) {
tmp = x / (1.0 - z);
} else {
tmp = (t - a) / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -0.7) or not (y <= 6e-32): tmp = x / (1.0 - z) else: tmp = (t - a) / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -0.7) || !(y <= 6e-32)) tmp = Float64(x / Float64(1.0 - z)); else tmp = Float64(Float64(t - a) / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -0.7) || ~((y <= 6e-32))) tmp = x / (1.0 - z); else tmp = (t - a) / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -0.7], N[Not[LessEqual[y, 6e-32]], $MachinePrecision]], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.7 \lor \neg \left(y \leq 6 \cdot 10^{-32}\right):\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b}\\
\end{array}
\end{array}
if y < -0.69999999999999996 or 6.0000000000000001e-32 < y Initial program 56.3%
fma-define56.3%
+-commutative56.3%
fma-define56.3%
Simplified56.3%
Taylor expanded in y around inf 51.0%
mul-1-neg51.0%
unsub-neg51.0%
Simplified51.0%
if -0.69999999999999996 < y < 6.0000000000000001e-32Initial program 86.4%
fma-define86.3%
+-commutative86.3%
fma-define86.3%
Simplified86.3%
Taylor expanded in y around 0 55.3%
Final simplification53.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.15e-38) (not (<= z 2.3e+22))) (/ t (- b y)) (/ x (- 1.0 z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.15e-38) || !(z <= 2.3e+22)) {
tmp = t / (b - y);
} else {
tmp = x / (1.0 - z);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-1.15d-38)) .or. (.not. (z <= 2.3d+22))) then
tmp = t / (b - y)
else
tmp = x / (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.15e-38) || !(z <= 2.3e+22)) {
tmp = t / (b - y);
} else {
tmp = x / (1.0 - z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.15e-38) or not (z <= 2.3e+22): tmp = t / (b - y) else: tmp = x / (1.0 - z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.15e-38) || !(z <= 2.3e+22)) tmp = Float64(t / Float64(b - y)); else tmp = Float64(x / Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.15e-38) || ~((z <= 2.3e+22))) tmp = t / (b - y); else tmp = x / (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.15e-38], N[Not[LessEqual[z, 2.3e+22]], $MachinePrecision]], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-38} \lor \neg \left(z \leq 2.3 \cdot 10^{+22}\right):\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - z}\\
\end{array}
\end{array}
if z < -1.15000000000000001e-38 or 2.3000000000000002e22 < z Initial program 49.1%
fma-define49.1%
+-commutative49.1%
fma-define49.1%
Simplified49.1%
Taylor expanded in t around inf 27.6%
Taylor expanded in z around inf 51.0%
if -1.15000000000000001e-38 < z < 2.3000000000000002e22Initial program 88.5%
fma-define88.5%
+-commutative88.5%
fma-define88.5%
Simplified88.5%
Taylor expanded in y around inf 49.5%
mul-1-neg49.5%
unsub-neg49.5%
Simplified49.5%
Final simplification50.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.55e-37) (not (<= z 6.5e-37))) (/ t (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.55e-37) || !(z <= 6.5e-37)) {
tmp = t / (b - y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-1.55d-37)) .or. (.not. (z <= 6.5d-37))) then
tmp = t / (b - y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.55e-37) || !(z <= 6.5e-37)) {
tmp = t / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.55e-37) or not (z <= 6.5e-37): tmp = t / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.55e-37) || !(z <= 6.5e-37)) tmp = Float64(t / Float64(b - y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -1.55e-37) || ~((z <= 6.5e-37))) tmp = t / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.55e-37], N[Not[LessEqual[z, 6.5e-37]], $MachinePrecision]], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{-37} \lor \neg \left(z \leq 6.5 \cdot 10^{-37}\right):\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.54999999999999997e-37 or 6.5000000000000001e-37 < z Initial program 53.8%
fma-define53.8%
+-commutative53.8%
fma-define53.8%
Simplified53.8%
Taylor expanded in t around inf 28.9%
Taylor expanded in z around inf 46.8%
if -1.54999999999999997e-37 < z < 6.5000000000000001e-37Initial program 89.8%
fma-define89.8%
+-commutative89.8%
fma-define89.8%
Simplified89.8%
Taylor expanded in z around 0 52.4%
Final simplification49.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.05e-34) (not (<= z 6.8e-35))) (/ t b) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.05e-34) || !(z <= 6.8e-35)) {
tmp = t / b;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-2.05d-34)) .or. (.not. (z <= 6.8d-35))) then
tmp = t / b
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.05e-34) || !(z <= 6.8e-35)) {
tmp = t / b;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.05e-34) or not (z <= 6.8e-35): tmp = t / b else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.05e-34) || !(z <= 6.8e-35)) tmp = Float64(t / b); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -2.05e-34) || ~((z <= 6.8e-35))) tmp = t / b; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.05e-34], N[Not[LessEqual[z, 6.8e-35]], $MachinePrecision]], N[(t / b), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-34} \lor \neg \left(z \leq 6.8 \cdot 10^{-35}\right):\\
\;\;\;\;\frac{t}{b}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.0500000000000002e-34 or 6.8000000000000005e-35 < z Initial program 53.8%
fma-define53.8%
+-commutative53.8%
fma-define53.8%
Simplified53.8%
Taylor expanded in t around inf 28.9%
Taylor expanded in y around 0 31.7%
if -2.0500000000000002e-34 < z < 6.8000000000000005e-35Initial program 89.8%
fma-define89.8%
+-commutative89.8%
fma-define89.8%
Simplified89.8%
Taylor expanded in z around 0 52.4%
Final simplification41.5%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 71.0%
fma-define71.0%
+-commutative71.0%
fma-define71.0%
Simplified71.0%
Taylor expanded in z around 0 27.8%
(FPCore (x y z t a b) :precision binary64 (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z)))))
double code(double x, double y, double z, double t, double a, double b) {
return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)));
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)));
}
def code(x, y, z, t, a, b): return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(z * t) + Float64(y * x)) / Float64(y + Float64(z * Float64(b - y)))) - Float64(a / Float64(Float64(b - y) + Float64(y / z)))) end
function tmp = code(x, y, z, t, a, b) tmp = (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(z * t), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(N[(b - y), $MachinePrecision] + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}
\end{array}
herbie shell --seed 2024185
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
:alt
(! :herbie-platform default (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z)))))
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))