
(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 13 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 (if (or (<= z -1.86e+22) (not (<= z 48000000000000.0))) (- (/ t (- b y)) (/ (- a (* y (/ x z))) (- b y))) (/ (+ (* x y) (* 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.86e+22) || !(z <= 48000000000000.0)) {
tmp = (t / (b - y)) - ((a - (y * (x / z))) / (b - y));
} else {
tmp = ((x * y) + (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.86d+22)) .or. (.not. (z <= 48000000000000.0d0))) then
tmp = (t / (b - y)) - ((a - (y * (x / z))) / (b - y))
else
tmp = ((x * y) + (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.86e+22) || !(z <= 48000000000000.0)) {
tmp = (t / (b - y)) - ((a - (y * (x / z))) / (b - y));
} else {
tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.86e+22) or not (z <= 48000000000000.0): tmp = (t / (b - y)) - ((a - (y * (x / z))) / (b - y)) else: tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.86e+22) || !(z <= 48000000000000.0)) tmp = Float64(Float64(t / Float64(b - y)) - Float64(Float64(a - Float64(y * Float64(x / z))) / Float64(b - y))); else tmp = Float64(Float64(Float64(x * y) + 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.86e+22) || ~((z <= 48000000000000.0))) tmp = (t / (b - y)) - ((a - (y * (x / z))) / (b - y)); else tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.86e+22], N[Not[LessEqual[z, 48000000000000.0]], $MachinePrecision]], N[(N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision] - N[(N[(a - N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.86 \cdot 10^{+22} \lor \neg \left(z \leq 48000000000000\right):\\
\;\;\;\;\frac{t}{b - y} - \frac{a - y \cdot \frac{x}{z}}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
\end{array}
\end{array}
if z < -1.86e22 or 4.8e13 < z Initial program 49.3%
Taylor expanded in z around inf
Applied rewrites93.1%
Applied rewrites91.5%
Taylor expanded in x around inf
Applied rewrites98.4%
if -1.86e22 < z < 4.8e13Initial program 83.8%
Final simplification91.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y)))
(t_2 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_3 (+ (/ (- x) z) t_1)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 -1e-303)
t_2
(if (<= t_2 0.0) t_1 (if (<= t_2 2e+257) t_2 t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_3 = (-x / z) + t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= -1e-303) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 2e+257) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double t_2 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_3 = (-x / z) + t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_3;
} else if (t_2 <= -1e-303) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 2e+257) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) t_2 = ((x * y) + (z * (t - a))) / (y + (z * (b - y))) t_3 = (-x / z) + t_1 tmp = 0 if t_2 <= -math.inf: tmp = t_3 elif t_2 <= -1e-303: tmp = t_2 elif t_2 <= 0.0: tmp = t_1 elif t_2 <= 2e+257: tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) t_2 = Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) t_3 = Float64(Float64(Float64(-x) / z) + t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= -1e-303) tmp = t_2; elseif (t_2 <= 0.0) tmp = t_1; elseif (t_2 <= 2e+257) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); t_2 = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); t_3 = (-x / z) + t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = t_3; elseif (t_2 <= -1e-303) tmp = t_2; elseif (t_2 <= 0.0) tmp = t_1; elseif (t_2 <= 2e+257) tmp = t_2; else tmp = t_3; 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]}, Block[{t$95$2 = 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]}, Block[{t$95$3 = N[(N[((-x) / z), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, -1e-303], t$95$2, If[LessEqual[t$95$2, 0.0], t$95$1, If[LessEqual[t$95$2, 2e+257], t$95$2, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
t_2 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_3 := \frac{-x}{z} + t\_1\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-303}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+257}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 2.00000000000000006e257 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 20.1%
Taylor expanded in z around inf
Applied rewrites66.0%
Taylor expanded in y around inf
Applied rewrites71.9%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -9.99999999999999931e-304 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 2.00000000000000006e257Initial program 99.6%
if -9.99999999999999931e-304 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0Initial program 35.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6489.5
Applied rewrites89.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- b y) z y)) (t_2 (/ (- t a) (- b y))))
(if (<= z -6.5e-54)
t_2
(if (<= z 9e-258)
(* (/ y t_1) x)
(if (<= z 1.45e+15) (/ (fma t z (* y x)) t_1) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((b - y), z, y);
double t_2 = (t - a) / (b - y);
double tmp;
if (z <= -6.5e-54) {
tmp = t_2;
} else if (z <= 9e-258) {
tmp = (y / t_1) * x;
} else if (z <= 1.45e+15) {
tmp = fma(t, z, (y * x)) / t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(b - y), z, y) t_2 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -6.5e-54) tmp = t_2; elseif (z <= 9e-258) tmp = Float64(Float64(y / t_1) * x); elseif (z <= 1.45e+15) tmp = Float64(fma(t, z, Float64(y * x)) / t_1); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e-54], t$95$2, If[LessEqual[z, 9e-258], N[(N[(y / t$95$1), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.45e+15], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b - y, z, y\right)\\
t_2 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{-54}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-258}:\\
\;\;\;\;\frac{y}{t\_1} \cdot x\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -6.49999999999999991e-54 or 1.45e15 < z Initial program 52.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6481.6
Applied rewrites81.6%
if -6.49999999999999991e-54 < z < 9.00000000000000017e-258Initial program 77.2%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6470.8
Applied rewrites70.8%
if 9.00000000000000017e-258 < z < 1.45e15Initial program 90.4%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6466.4
Applied rewrites66.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -5.5e+19) (not (<= z 230000000.0))) (+ (/ (- x) z) (/ (- t a) (- b y))) (/ (fma t z (* y x)) (fma (- b y) z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5.5e+19) || !(z <= 230000000.0)) {
tmp = (-x / z) + ((t - a) / (b - y));
} else {
tmp = fma(t, z, (y * x)) / fma((b - y), z, y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5.5e+19) || !(z <= 230000000.0)) tmp = Float64(Float64(Float64(-x) / z) + Float64(Float64(t - a) / Float64(b - y))); else tmp = Float64(fma(t, z, Float64(y * x)) / fma(Float64(b - y), z, y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5.5e+19], N[Not[LessEqual[z, 230000000.0]], $MachinePrecision]], N[(N[((-x) / z), $MachinePrecision] + N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+19} \lor \neg \left(z \leq 230000000\right):\\
\;\;\;\;\frac{-x}{z} + \frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, z, y \cdot x\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\end{array}
\end{array}
if z < -5.5e19 or 2.3e8 < z Initial program 49.7%
Taylor expanded in z around inf
Applied rewrites93.0%
Taylor expanded in y around inf
Applied rewrites86.3%
if -5.5e19 < z < 2.3e8Initial program 84.2%
Taylor expanded in a around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6464.1
Applied rewrites64.1%
Final simplification75.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -6.5e-54) (not (<= z 3.6e-113))) (/ (- t a) (- b y)) (* (/ y (fma (- b y) z y)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -6.5e-54) || !(z <= 3.6e-113)) {
tmp = (t - a) / (b - y);
} else {
tmp = (y / fma((b - y), z, y)) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -6.5e-54) || !(z <= 3.6e-113)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(Float64(y / fma(Float64(b - y), z, y)) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -6.5e-54], N[Not[LessEqual[z, 3.6e-113]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-54} \lor \neg \left(z \leq 3.6 \cdot 10^{-113}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(b - y, z, y\right)} \cdot x\\
\end{array}
\end{array}
if z < -6.49999999999999991e-54 or 3.59999999999999975e-113 < z Initial program 58.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.7
Applied rewrites76.7%
if -6.49999999999999991e-54 < z < 3.59999999999999975e-113Initial program 80.6%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6469.3
Applied rewrites69.3%
Final simplification74.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -5.2e-54) (not (<= z 3.6e-113))) (/ (- t a) (- b y)) (/ x 1.0)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5.2e-54) || !(z <= 3.6e-113)) {
tmp = (t - a) / (b - y);
} else {
tmp = x / 1.0;
}
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.2d-54)) .or. (.not. (z <= 3.6d-113))) then
tmp = (t - a) / (b - y)
else
tmp = x / 1.0d0
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.2e-54) || !(z <= 3.6e-113)) {
tmp = (t - a) / (b - y);
} else {
tmp = x / 1.0;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -5.2e-54) or not (z <= 3.6e-113): tmp = (t - a) / (b - y) else: tmp = x / 1.0 return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5.2e-54) || !(z <= 3.6e-113)) tmp = Float64(Float64(t - a) / Float64(b - y)); else tmp = Float64(x / 1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -5.2e-54) || ~((z <= 3.6e-113))) tmp = (t - a) / (b - y); else tmp = x / 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5.2e-54], N[Not[LessEqual[z, 3.6e-113]], $MachinePrecision]], N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(x / 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-54} \lor \neg \left(z \leq 3.6 \cdot 10^{-113}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1}\\
\end{array}
\end{array}
if z < -5.20000000000000004e-54 or 3.59999999999999975e-113 < z Initial program 58.5%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.7
Applied rewrites76.7%
if -5.20000000000000004e-54 < z < 3.59999999999999975e-113Initial program 80.6%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6459.6
Applied rewrites59.6%
Taylor expanded in z around 0
Applied rewrites59.6%
Final simplification70.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.04e-70) (not (<= y 9.4e-57))) (/ 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 <= -1.04e-70) || !(y <= 9.4e-57)) {
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 <= (-1.04d-70)) .or. (.not. (y <= 9.4d-57))) 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 <= -1.04e-70) || !(y <= 9.4e-57)) {
tmp = x / (1.0 - z);
} else {
tmp = (t - a) / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.04e-70) or not (y <= 9.4e-57): 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 <= -1.04e-70) || !(y <= 9.4e-57)) 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 <= -1.04e-70) || ~((y <= 9.4e-57))) 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, -1.04e-70], N[Not[LessEqual[y, 9.4e-57]], $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 -1.04 \cdot 10^{-70} \lor \neg \left(y \leq 9.4 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t - a}{b}\\
\end{array}
\end{array}
if y < -1.0399999999999999e-70 or 9.3999999999999996e-57 < y Initial program 55.3%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6448.8
Applied rewrites48.8%
if -1.0399999999999999e-70 < y < 9.3999999999999996e-57Initial program 82.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6462.8
Applied rewrites62.8%
Final simplification54.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -7.4e-30) (not (<= z 5.5e+16))) (/ 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 <= -7.4e-30) || !(z <= 5.5e+16)) {
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 <= (-7.4d-30)) .or. (.not. (z <= 5.5d+16))) 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 <= -7.4e-30) || !(z <= 5.5e+16)) {
tmp = t / (b - y);
} else {
tmp = x / (1.0 - z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -7.4e-30) or not (z <= 5.5e+16): 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 <= -7.4e-30) || !(z <= 5.5e+16)) 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 <= -7.4e-30) || ~((z <= 5.5e+16))) 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, -7.4e-30], N[Not[LessEqual[z, 5.5e+16]], $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 -7.4 \cdot 10^{-30} \lor \neg \left(z \leq 5.5 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - z}\\
\end{array}
\end{array}
if z < -7.4000000000000006e-30 or 5.5e16 < z Initial program 51.5%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6431.2
Applied rewrites31.2%
Taylor expanded in z around inf
Applied rewrites48.0%
if -7.4000000000000006e-30 < z < 5.5e16Initial program 83.0%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6455.1
Applied rewrites55.1%
Final simplification51.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -7.4e-30) (not (<= z 1.95e-14))) (/ t (- b y)) (fma x z x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7.4e-30) || !(z <= 1.95e-14)) {
tmp = t / (b - y);
} else {
tmp = fma(x, z, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -7.4e-30) || !(z <= 1.95e-14)) tmp = Float64(t / Float64(b - y)); else tmp = fma(x, z, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.4e-30], N[Not[LessEqual[z, 1.95e-14]], $MachinePrecision]], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], N[(x * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-30} \lor \neg \left(z \leq 1.95 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\end{array}
\end{array}
if z < -7.4000000000000006e-30 or 1.9499999999999999e-14 < z Initial program 51.8%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6431.3
Applied rewrites31.3%
Taylor expanded in z around inf
Applied rewrites47.7%
if -7.4000000000000006e-30 < z < 1.9499999999999999e-14Initial program 83.4%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6454.8
Applied rewrites54.8%
Taylor expanded in z around 0
Applied rewrites54.8%
Final simplification50.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -7.4e-30) (not (<= z 1.95e-14))) (/ t b) (fma x z x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7.4e-30) || !(z <= 1.95e-14)) {
tmp = t / b;
} else {
tmp = fma(x, z, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -7.4e-30) || !(z <= 1.95e-14)) tmp = Float64(t / b); else tmp = fma(x, z, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.4e-30], N[Not[LessEqual[z, 1.95e-14]], $MachinePrecision]], N[(t / b), $MachinePrecision], N[(x * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-30} \lor \neg \left(z \leq 1.95 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{t}{b}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\end{array}
\end{array}
if z < -7.4000000000000006e-30 or 1.9499999999999999e-14 < z Initial program 51.8%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6431.3
Applied rewrites31.3%
Taylor expanded in y around 0
Applied rewrites20.5%
if -7.4000000000000006e-30 < z < 1.9499999999999999e-14Initial program 83.4%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6454.8
Applied rewrites54.8%
Taylor expanded in z around 0
Applied rewrites54.8%
Final simplification36.0%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.4e+31) (/ x (- z)) (if (<= z 1.95e-14) (fma x z x) (/ t b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.4e+31) {
tmp = x / -z;
} else if (z <= 1.95e-14) {
tmp = fma(x, z, x);
} else {
tmp = t / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.4e+31) tmp = Float64(x / Float64(-z)); elseif (z <= 1.95e-14) tmp = fma(x, z, x); else tmp = Float64(t / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.4e+31], N[(x / (-z)), $MachinePrecision], If[LessEqual[z, 1.95e-14], N[(x * z + x), $MachinePrecision], N[(t / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+31}:\\
\;\;\;\;\frac{x}{-z}\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{b}\\
\end{array}
\end{array}
if z < -1.40000000000000008e31Initial program 54.1%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6415.4
Applied rewrites15.4%
Taylor expanded in z around inf
Applied rewrites15.4%
if -1.40000000000000008e31 < z < 1.9499999999999999e-14Initial program 83.7%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6451.5
Applied rewrites51.5%
Taylor expanded in z around 0
Applied rewrites51.5%
if 1.9499999999999999e-14 < z Initial program 45.3%
Taylor expanded in t around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6434.3
Applied rewrites34.3%
Taylor expanded in y around 0
Applied rewrites28.3%
(FPCore (x y z t a b) :precision binary64 (fma x z x))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, z, x);
}
function code(x, y, z, t, a, b) return fma(x, z, x) end
code[x_, y_, z_, t_, a_, b_] := N[(x * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, z, x\right)
\end{array}
Initial program 66.1%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6433.7
Applied rewrites33.7%
Taylor expanded in z around 0
Applied rewrites26.6%
(FPCore (x y z t a b) :precision binary64 (* z x))
double code(double x, double y, double z, double t, double a, double b) {
return z * 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 = z * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return z * x;
}
def code(x, y, z, t, a, b): return z * x
function code(x, y, z, t, a, b) return Float64(z * x) end
function tmp = code(x, y, z, t, a, b) tmp = z * x; end
code[x_, y_, z_, t_, a_, b_] := N[(z * x), $MachinePrecision]
\begin{array}{l}
\\
z \cdot x
\end{array}
Initial program 66.1%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6433.7
Applied rewrites33.7%
Taylor expanded in z around 0
Applied rewrites26.6%
Taylor expanded in z around inf
Applied rewrites3.7%
(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 2024318
(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)))))