
(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 (+ y (* z (- b y)))))
(if (or (<= z -4.4e+15) (not (<= z 1800.0)))
(+
(+ (* (/ x z) (/ y (- b y))) (/ (- t a) (- b y)))
(* (/ y (pow (- b y) 2.0)) (/ (- a t) z)))
(* 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 tmp;
if ((z <= -4.4e+15) || !(z <= 1800.0)) {
tmp = (((x / z) * (y / (b - y))) + ((t - a) / (b - y))) + ((y / pow((b - y), 2.0)) * ((a - t) / z));
} 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) :: tmp
t_1 = y + (z * (b - y))
if ((z <= (-4.4d+15)) .or. (.not. (z <= 1800.0d0))) then
tmp = (((x / z) * (y / (b - y))) + ((t - a) / (b - y))) + ((y / ((b - y) ** 2.0d0)) * ((a - t) / z))
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 tmp;
if ((z <= -4.4e+15) || !(z <= 1800.0)) {
tmp = (((x / z) * (y / (b - y))) + ((t - a) / (b - y))) + ((y / Math.pow((b - y), 2.0)) * ((a - t) / z));
} 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)) tmp = 0 if (z <= -4.4e+15) or not (z <= 1800.0): tmp = (((x / z) * (y / (b - y))) + ((t - a) / (b - y))) + ((y / math.pow((b - y), 2.0)) * ((a - t) / z)) 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))) tmp = 0.0 if ((z <= -4.4e+15) || !(z <= 1800.0)) tmp = Float64(Float64(Float64(Float64(x / z) * Float64(y / Float64(b - y))) + Float64(Float64(t - a) / Float64(b - y))) + Float64(Float64(y / (Float64(b - y) ^ 2.0)) * Float64(Float64(a - t) / z))); 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)); tmp = 0.0; if ((z <= -4.4e+15) || ~((z <= 1800.0))) tmp = (((x / z) * (y / (b - y))) + ((t - a) / (b - y))) + ((y / ((b - y) ^ 2.0)) * ((a - t) / z)); 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]}, If[Or[LessEqual[z, -4.4e+15], N[Not[LessEqual[z, 1800.0]], $MachinePrecision]], N[(N[(N[(N[(x / z), $MachinePrecision] * N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y / N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(a - t), $MachinePrecision] / z), $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)\\
\mathbf{if}\;z \leq -4.4 \cdot 10^{+15} \lor \neg \left(z \leq 1800\right):\\
\;\;\;\;\left(\frac{x}{z} \cdot \frac{y}{b - y} + \frac{t - a}{b - y}\right) + \frac{y}{{\left(b - y\right)}^{2}} \cdot \frac{a - t}{z}\\
\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 < -4.4e15 or 1800 < z Initial program 48.0%
fma-define48.0%
+-commutative48.0%
fma-define48.0%
Simplified48.0%
Taylor expanded in z around inf 63.9%
associate--r+63.9%
+-commutative63.9%
associate--l+63.9%
times-frac72.3%
div-sub72.3%
*-commutative72.3%
times-frac95.8%
Simplified95.8%
if -4.4e15 < z < 1800Initial program 88.8%
fma-define88.8%
+-commutative88.8%
fma-define88.8%
Simplified88.8%
Taylor expanded in x around inf 91.0%
Final simplification93.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y)))))
(if (or (<= z -1.15e+18) (not (<= z 6.6e+19)))
(/ (- t a) (- b y))
(* 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 tmp;
if ((z <= -1.15e+18) || !(z <= 6.6e+19)) {
tmp = (t - a) / (b - y);
} 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) :: tmp
t_1 = y + (z * (b - y))
if ((z <= (-1.15d+18)) .or. (.not. (z <= 6.6d+19))) then
tmp = (t - a) / (b - y)
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 tmp;
if ((z <= -1.15e+18) || !(z <= 6.6e+19)) {
tmp = (t - a) / (b - y);
} 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)) tmp = 0 if (z <= -1.15e+18) or not (z <= 6.6e+19): tmp = (t - a) / (b - y) 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))) tmp = 0.0 if ((z <= -1.15e+18) || !(z <= 6.6e+19)) tmp = Float64(Float64(t - a) / Float64(b - y)); 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)); tmp = 0.0; if ((z <= -1.15e+18) || ~((z <= 6.6e+19))) tmp = (t - a) / (b - y); 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]}, If[Or[LessEqual[z, -1.15e+18], N[Not[LessEqual[z, 6.6e+19]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $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)\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+18} \lor \neg \left(z \leq 6.6 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\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 < -1.15e18 or 6.6e19 < z Initial program 47.1%
fma-define47.1%
+-commutative47.1%
fma-define47.1%
Simplified47.1%
Taylor expanded in z around inf 85.4%
if -1.15e18 < z < 6.6e19Initial program 88.9%
fma-define88.9%
+-commutative88.9%
fma-define89.0%
Simplified89.0%
Taylor expanded in x around inf 91.1%
Final simplification88.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y)))))
(if (or (<= z -2.8e+41) (not (<= z 6.6e+19)))
(/ (- t a) (- b y))
(+ (/ (* x y) t_1) (/ (* z (- t a)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double tmp;
if ((z <= -2.8e+41) || !(z <= 6.6e+19)) {
tmp = (t - a) / (b - y);
} else {
tmp = ((x * y) / t_1) + ((z * (t - a)) / 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) :: tmp
t_1 = y + (z * (b - y))
if ((z <= (-2.8d+41)) .or. (.not. (z <= 6.6d+19))) then
tmp = (t - a) / (b - y)
else
tmp = ((x * y) / t_1) + ((z * (t - a)) / 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 tmp;
if ((z <= -2.8e+41) || !(z <= 6.6e+19)) {
tmp = (t - a) / (b - y);
} else {
tmp = ((x * y) / t_1) + ((z * (t - a)) / t_1);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (z * (b - y)) tmp = 0 if (z <= -2.8e+41) or not (z <= 6.6e+19): tmp = (t - a) / (b - y) else: tmp = ((x * y) / t_1) + ((z * (t - a)) / t_1) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) tmp = 0.0 if ((z <= -2.8e+41) || !(z <= 6.6e+19)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(Float64(Float64(x * y) / t_1) + Float64(Float64(z * Float64(t - a)) / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (z * (b - y)); tmp = 0.0; if ((z <= -2.8e+41) || ~((z <= 6.6e+19))) tmp = (t - a) / (b - y); else tmp = ((x * y) / t_1) + ((z * (t - a)) / 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]}, If[Or[LessEqual[z, -2.8e+41], N[Not[LessEqual[z, 6.6e+19]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+41} \lor \neg \left(z \leq 6.6 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{t\_1} + \frac{z \cdot \left(t - a\right)}{t\_1}\\
\end{array}
\end{array}
if z < -2.7999999999999999e41 or 6.6e19 < z Initial program 44.8%
fma-define44.8%
+-commutative44.8%
fma-define44.8%
Simplified44.8%
Taylor expanded in z around inf 85.6%
if -2.7999999999999999e41 < z < 6.6e19Initial program 89.3%
fma-define89.3%
+-commutative89.3%
fma-define89.3%
Simplified89.3%
Taylor expanded in x around 0 89.3%
Final simplification87.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -1.62e-37)
t_1
(if (<= z 1.32e-58)
(- x (/ (* z a) y))
(if (<= z 3400000000000.0)
(+ (/ (* x y) (+ y (* z (- b y)))) (/ (- t a) b))
t_1)))))
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 <= -1.62e-37) {
tmp = t_1;
} else if (z <= 1.32e-58) {
tmp = x - ((z * a) / y);
} else if (z <= 3400000000000.0) {
tmp = ((x * y) / (y + (z * (b - y)))) + ((t - a) / b);
} else {
tmp = 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) :: tmp
t_1 = (t - a) / (b - y)
if (z <= (-1.62d-37)) then
tmp = t_1
else if (z <= 1.32d-58) then
tmp = x - ((z * a) / y)
else if (z <= 3400000000000.0d0) then
tmp = ((x * y) / (y + (z * (b - y)))) + ((t - a) / b)
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 b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -1.62e-37) {
tmp = t_1;
} else if (z <= 1.32e-58) {
tmp = x - ((z * a) / y);
} else if (z <= 3400000000000.0) {
tmp = ((x * y) / (y + (z * (b - y)))) + ((t - a) / b);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -1.62e-37: tmp = t_1 elif z <= 1.32e-58: tmp = x - ((z * a) / y) elif z <= 3400000000000.0: tmp = ((x * y) / (y + (z * (b - y)))) + ((t - a) / b) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -1.62e-37) tmp = t_1; elseif (z <= 1.32e-58) tmp = Float64(x - Float64(Float64(z * a) / y)); elseif (z <= 3400000000000.0) tmp = Float64(Float64(Float64(x * y) / Float64(y + Float64(z * Float64(b - y)))) + Float64(Float64(t - a) / b)); else tmp = t_1; 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 <= -1.62e-37) tmp = t_1; elseif (z <= 1.32e-58) tmp = x - ((z * a) / y); elseif (z <= 3400000000000.0) tmp = ((x * y) / (y + (z * (b - y)))) + ((t - a) / b); else tmp = t_1; 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, -1.62e-37], t$95$1, If[LessEqual[z, 1.32e-58], N[(x - N[(N[(z * a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3400000000000.0], N[(N[(N[(x * y), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -1.62 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.32 \cdot 10^{-58}:\\
\;\;\;\;x - \frac{z \cdot a}{y}\\
\mathbf{elif}\;z \leq 3400000000000:\\
\;\;\;\;\frac{x \cdot y}{y + z \cdot \left(b - y\right)} + \frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.6199999999999999e-37 or 3.4e12 < z Initial program 50.1%
fma-define50.1%
+-commutative50.1%
fma-define50.1%
Simplified50.1%
Taylor expanded in z around inf 84.8%
if -1.6199999999999999e-37 < z < 1.31999999999999993e-58Initial program 87.4%
fma-define87.4%
+-commutative87.4%
fma-define87.4%
Simplified87.4%
Taylor expanded in z around 0 58.1%
Taylor expanded in a around inf 66.4%
associate-*r/66.4%
associate-*r*66.4%
neg-mul-166.4%
Simplified66.4%
if 1.31999999999999993e-58 < z < 3.4e12Initial program 94.3%
fma-define94.3%
+-commutative94.3%
fma-define94.3%
Simplified94.3%
Taylor expanded in x around 0 94.3%
Taylor expanded in y around 0 73.9%
Final simplification75.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -5e+41) (not (<= z 7.4e+19))) (/ (- t a) (- b y)) (/ (+ (* z (- t a)) (* x y)) (+ y (* z (- b y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5e+41) || !(z <= 7.4e+19)) {
tmp = (t - a) / (b - y);
} else {
tmp = ((z * (t - a)) + (x * y)) / (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 <= (-5d+41)) .or. (.not. (z <= 7.4d+19))) then
tmp = (t - a) / (b - y)
else
tmp = ((z * (t - a)) + (x * y)) / (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 <= -5e+41) || !(z <= 7.4e+19)) {
tmp = (t - a) / (b - y);
} else {
tmp = ((z * (t - a)) + (x * y)) / (y + (z * (b - y)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -5e+41) or not (z <= 7.4e+19): tmp = (t - a) / (b - y) else: tmp = ((z * (t - a)) + (x * y)) / (y + (z * (b - y))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5e+41) || !(z <= 7.4e+19)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(Float64(Float64(z * Float64(t - a)) + Float64(x * y)) / 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 <= -5e+41) || ~((z <= 7.4e+19))) tmp = (t - a) / (b - y); else tmp = ((z * (t - a)) + (x * y)) / (y + (z * (b - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5e+41], N[Not[LessEqual[z, 7.4e+19]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+41} \lor \neg \left(z \leq 7.4 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(t - a\right) + x \cdot y}{y + z \cdot \left(b - y\right)}\\
\end{array}
\end{array}
if z < -5.00000000000000022e41 or 7.4e19 < z Initial program 44.8%
fma-define44.8%
+-commutative44.8%
fma-define44.8%
Simplified44.8%
Taylor expanded in z around inf 85.6%
if -5.00000000000000022e41 < z < 7.4e19Initial program 89.3%
Final simplification87.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -8.8e-37) (not (<= z 5.4e-55))) (/ (- t a) (- b y)) (- x (/ (* z a) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -8.8e-37) || !(z <= 5.4e-55)) {
tmp = (t - a) / (b - y);
} else {
tmp = x - ((z * 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.8d-37)) .or. (.not. (z <= 5.4d-55))) then
tmp = (t - a) / (b - y)
else
tmp = x - ((z * 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.8e-37) || !(z <= 5.4e-55)) {
tmp = (t - a) / (b - y);
} else {
tmp = x - ((z * a) / y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -8.8e-37) or not (z <= 5.4e-55): tmp = (t - a) / (b - y) else: tmp = x - ((z * a) / y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -8.8e-37) || !(z <= 5.4e-55)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(x - Float64(Float64(z * a) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -8.8e-37) || ~((z <= 5.4e-55))) tmp = (t - a) / (b - y); else tmp = x - ((z * a) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -8.8e-37], N[Not[LessEqual[z, 5.4e-55]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(z * a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-37} \lor \neg \left(z \leq 5.4 \cdot 10^{-55}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z \cdot a}{y}\\
\end{array}
\end{array}
if z < -8.80000000000000008e-37 or 5.40000000000000008e-55 < z Initial program 55.4%
fma-define55.4%
+-commutative55.4%
fma-define55.4%
Simplified55.4%
Taylor expanded in z around inf 80.4%
if -8.80000000000000008e-37 < z < 5.40000000000000008e-55Initial program 87.6%
fma-define87.6%
+-commutative87.6%
fma-define87.6%
Simplified87.6%
Taylor expanded in z around 0 58.0%
Taylor expanded in a around inf 66.2%
associate-*r/66.2%
associate-*r*66.2%
neg-mul-166.2%
Simplified66.2%
Final simplification74.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -6.8e-37) (not (<= z 1.1e-54))) (/ (- t a) (- b y)) (- x (* z (/ a y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -6.8e-37) || !(z <= 1.1e-54)) {
tmp = (t - a) / (b - y);
} else {
tmp = x - (z * (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 <= (-6.8d-37)) .or. (.not. (z <= 1.1d-54))) then
tmp = (t - a) / (b - y)
else
tmp = x - (z * (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 <= -6.8e-37) || !(z <= 1.1e-54)) {
tmp = (t - a) / (b - y);
} else {
tmp = x - (z * (a / y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -6.8e-37) or not (z <= 1.1e-54): tmp = (t - a) / (b - y) else: tmp = x - (z * (a / y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -6.8e-37) || !(z <= 1.1e-54)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(x - Float64(z * Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -6.8e-37) || ~((z <= 1.1e-54))) tmp = (t - a) / (b - y); else tmp = x - (z * (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -6.8e-37], N[Not[LessEqual[z, 1.1e-54]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-37} \lor \neg \left(z \leq 1.1 \cdot 10^{-54}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{a}{y}\\
\end{array}
\end{array}
if z < -6.80000000000000037e-37 or 1.1e-54 < z Initial program 55.4%
fma-define55.4%
+-commutative55.4%
fma-define55.4%
Simplified55.4%
Taylor expanded in z around inf 80.4%
if -6.80000000000000037e-37 < z < 1.1e-54Initial program 87.6%
fma-define87.6%
+-commutative87.6%
fma-define87.6%
Simplified87.6%
Taylor expanded in z around 0 58.0%
Taylor expanded in a around inf 64.9%
associate-*r/64.9%
neg-mul-164.9%
Simplified64.9%
Final simplification73.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -9e-82) (not (<= z 2.2e-55))) (/ (- t a) (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -9e-82) || !(z <= 2.2e-55)) {
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 <= (-9d-82)) .or. (.not. (z <= 2.2d-55))) 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 <= -9e-82) || !(z <= 2.2e-55)) {
tmp = (t - a) / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -9e-82) or not (z <= 2.2e-55): tmp = (t - a) / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -9e-82) || !(z <= 2.2e-55)) 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 <= -9e-82) || ~((z <= 2.2e-55))) tmp = (t - a) / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -9e-82], N[Not[LessEqual[z, 2.2e-55]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-82} \lor \neg \left(z \leq 2.2 \cdot 10^{-55}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.9999999999999997e-82 or 2.2e-55 < z Initial program 56.8%
fma-define56.8%
+-commutative56.8%
fma-define56.8%
Simplified56.8%
Taylor expanded in z around inf 78.1%
if -8.9999999999999997e-82 < z < 2.2e-55Initial program 87.7%
fma-define87.7%
+-commutative87.7%
fma-define87.7%
Simplified87.7%
Taylor expanded in z around 0 55.7%
Final simplification68.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -0.0011) (not (<= y 1.85e+41))) (/ 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.0011) || !(y <= 1.85e+41)) {
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.0011d0)) .or. (.not. (y <= 1.85d+41))) 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.0011) || !(y <= 1.85e+41)) {
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.0011) or not (y <= 1.85e+41): 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.0011) || !(y <= 1.85e+41)) 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.0011) || ~((y <= 1.85e+41))) 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.0011], N[Not[LessEqual[y, 1.85e+41]], $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.0011 \lor \neg \left(y \leq 1.85 \cdot 10^{+41}\right):\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b}\\
\end{array}
\end{array}
if y < -0.00110000000000000007 or 1.84999999999999991e41 < y Initial program 54.6%
fma-define54.6%
+-commutative54.6%
fma-define54.6%
Simplified54.6%
Taylor expanded in y around inf 56.8%
mul-1-neg56.8%
unsub-neg56.8%
Simplified56.8%
if -0.00110000000000000007 < y < 1.84999999999999991e41Initial program 83.9%
fma-define83.9%
+-commutative83.9%
fma-define83.9%
Simplified83.9%
Taylor expanded in y around 0 55.1%
Final simplification55.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -5e-81) (not (<= z 1.8e-51))) (/ t (- b y)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5e-81) || !(z <= 1.8e-51)) {
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 <= (-5d-81)) .or. (.not. (z <= 1.8d-51))) 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 <= -5e-81) || !(z <= 1.8e-51)) {
tmp = t / (b - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -5e-81) or not (z <= 1.8e-51): tmp = t / (b - y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5e-81) || !(z <= 1.8e-51)) 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 <= -5e-81) || ~((z <= 1.8e-51))) tmp = t / (b - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5e-81], N[Not[LessEqual[z, 1.8e-51]], $MachinePrecision]], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-81} \lor \neg \left(z \leq 1.8 \cdot 10^{-51}\right):\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.99999999999999981e-81 or 1.8e-51 < z Initial program 56.5%
fma-define56.5%
+-commutative56.5%
fma-define56.5%
Simplified56.5%
Taylor expanded in t around inf 30.2%
Taylor expanded in z around inf 44.3%
if -4.99999999999999981e-81 < z < 1.8e-51Initial program 87.8%
fma-define87.8%
+-commutative87.8%
fma-define87.8%
Simplified87.8%
Taylor expanded in z around 0 55.2%
Final simplification49.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.3e-81) (not (<= z 6.4e-53))) (/ t b) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.3e-81) || !(z <= 6.4e-53)) {
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 <= (-1.3d-81)) .or. (.not. (z <= 6.4d-53))) 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 <= -1.3e-81) || !(z <= 6.4e-53)) {
tmp = t / b;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.3e-81) or not (z <= 6.4e-53): tmp = t / b else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.3e-81) || !(z <= 6.4e-53)) 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 <= -1.3e-81) || ~((z <= 6.4e-53))) tmp = t / b; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.3e-81], N[Not[LessEqual[z, 6.4e-53]], $MachinePrecision]], N[(t / b), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-81} \lor \neg \left(z \leq 6.4 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{t}{b}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.2999999999999999e-81 or 6.4000000000000002e-53 < z Initial program 56.5%
fma-define56.5%
+-commutative56.5%
fma-define56.5%
Simplified56.5%
Taylor expanded in t around inf 30.2%
Taylor expanded in y around 0 29.5%
if -1.2999999999999999e-81 < z < 6.4000000000000002e-53Initial program 87.8%
fma-define87.8%
+-commutative87.8%
fma-define87.8%
Simplified87.8%
Taylor expanded in z around 0 55.2%
Final simplification40.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 69.8%
fma-define69.8%
+-commutative69.8%
fma-define69.8%
Simplified69.8%
Taylor expanded in z around 0 27.6%
(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 2024132
(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)))))