
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 5e-136) (fabs (/ (- (+ 4.0 x) (* x z)) y_m)) (fabs (fma x (/ z y_m) (/ (- -4.0 x) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 5e-136) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = fabs(fma(x, (z / y_m), ((-4.0 - x) / y_m)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 5e-136) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); else tmp = abs(fma(x, Float64(z / y_m), Float64(Float64(-4.0 - x) / y_m))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 5e-136], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y_m \leq 5 \cdot 10^{-136}:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y_m}, \frac{-4 - x}{y_m}\right)\right|\\
\end{array}
\end{array}
if y < 5.0000000000000002e-136Initial program 87.7%
Taylor expanded in y around 0 97.7%
if 5.0000000000000002e-136 < y Initial program 94.6%
Simplified99.9%
Final simplification98.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -5.8e-42)
(fabs (/ x (/ y_m (- 1.0 z))))
(if (<= x 2.5e-7)
(fabs (/ (- -4.0 x) y_m))
(fabs (* x (+ (/ z y_m) (/ -1.0 y_m)))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -5.8e-42) {
tmp = fabs((x / (y_m / (1.0 - z))));
} else if (x <= 2.5e-7) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((x * ((z / y_m) + (-1.0 / y_m))));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-5.8d-42)) then
tmp = abs((x / (y_m / (1.0d0 - z))))
else if (x <= 2.5d-7) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((x * ((z / y_m) + ((-1.0d0) / y_m))))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -5.8e-42) {
tmp = Math.abs((x / (y_m / (1.0 - z))));
} else if (x <= 2.5e-7) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((x * ((z / y_m) + (-1.0 / y_m))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -5.8e-42: tmp = math.fabs((x / (y_m / (1.0 - z)))) elif x <= 2.5e-7: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((x * ((z / y_m) + (-1.0 / y_m)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -5.8e-42) tmp = abs(Float64(x / Float64(y_m / Float64(1.0 - z)))); elseif (x <= 2.5e-7) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(x * Float64(Float64(z / y_m) + Float64(-1.0 / y_m)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -5.8e-42) tmp = abs((x / (y_m / (1.0 - z)))); elseif (x <= 2.5e-7) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((x * ((z / y_m) + (-1.0 / y_m)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -5.8e-42], N[Abs[N[(x / N[(y$95$m / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.5e-7], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(z / y$95$m), $MachinePrecision] + N[(-1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-42}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{1 - z}}\right|\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-7}:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \left(\frac{z}{y_m} + \frac{-1}{y_m}\right)\right|\\
\end{array}
\end{array}
if x < -5.8000000000000006e-42Initial program 80.5%
Taylor expanded in y around 0 97.3%
Taylor expanded in x around inf 94.0%
associate-/l*96.6%
Simplified96.6%
if -5.8000000000000006e-42 < x < 2.49999999999999989e-7Initial program 94.7%
Simplified92.8%
Taylor expanded in z around 0 82.7%
associate-*r/82.7%
distribute-lft-in82.7%
metadata-eval82.7%
neg-mul-182.7%
sub-neg82.7%
Simplified82.7%
if 2.49999999999999989e-7 < x Initial program 93.5%
Simplified96.7%
Taylor expanded in x around inf 97.8%
Final simplification90.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 3e-105) (fabs (/ (- (+ 4.0 x) (* x z)) y_m)) (fabs (- (/ (+ 4.0 x) y_m) (* x (/ z y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 3e-105) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = fabs((((4.0 + x) / y_m) - (x * (z / y_m))));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 3d-105) then
tmp = abs((((4.0d0 + x) - (x * z)) / y_m))
else
tmp = abs((((4.0d0 + x) / y_m) - (x * (z / y_m))))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 3e-105) {
tmp = Math.abs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = Math.abs((((4.0 + x) / y_m) - (x * (z / y_m))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 3e-105: tmp = math.fabs((((4.0 + x) - (x * z)) / y_m)) else: tmp = math.fabs((((4.0 + x) / y_m) - (x * (z / y_m)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 3e-105) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(Float64(4.0 + x) / y_m) - Float64(x * Float64(z / y_m)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (y_m <= 3e-105) tmp = abs((((4.0 + x) - (x * z)) / y_m)); else tmp = abs((((4.0 + x) / y_m) - (x * (z / y_m)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 3e-105], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y_m \leq 3 \cdot 10^{-105}:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4 + x}{y_m} - x \cdot \frac{z}{y_m}\right|\\
\end{array}
\end{array}
if y < 3.0000000000000001e-105Initial program 87.3%
Taylor expanded in y around 0 97.7%
if 3.0000000000000001e-105 < y Initial program 95.6%
Simplified97.7%
associate-*r/99.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification98.4%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -6700000000.0)
(fabs (/ x y_m))
(if (or (<= x -2.7e-41) (not (<= x 1.35e-7)))
(fabs (* x (/ z y_m)))
(fabs (/ 4.0 y_m)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -6700000000.0) {
tmp = fabs((x / y_m));
} else if ((x <= -2.7e-41) || !(x <= 1.35e-7)) {
tmp = fabs((x * (z / y_m)));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-6700000000.0d0)) then
tmp = abs((x / y_m))
else if ((x <= (-2.7d-41)) .or. (.not. (x <= 1.35d-7))) then
tmp = abs((x * (z / y_m)))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -6700000000.0) {
tmp = Math.abs((x / y_m));
} else if ((x <= -2.7e-41) || !(x <= 1.35e-7)) {
tmp = Math.abs((x * (z / y_m)));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -6700000000.0: tmp = math.fabs((x / y_m)) elif (x <= -2.7e-41) or not (x <= 1.35e-7): tmp = math.fabs((x * (z / y_m))) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -6700000000.0) tmp = abs(Float64(x / y_m)); elseif ((x <= -2.7e-41) || !(x <= 1.35e-7)) tmp = abs(Float64(x * Float64(z / y_m))); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -6700000000.0) tmp = abs((x / y_m)); elseif ((x <= -2.7e-41) || ~((x <= 1.35e-7))) tmp = abs((x * (z / y_m))); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -6700000000.0], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -2.7e-41], N[Not[LessEqual[x, 1.35e-7]], $MachinePrecision]], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6700000000:\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-41} \lor \neg \left(x \leq 1.35 \cdot 10^{-7}\right):\\
\;\;\;\;\left|x \cdot \frac{z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\end{array}
\end{array}
if x < -6.7e9Initial program 77.9%
Taylor expanded in y around 0 97.1%
Taylor expanded in x around inf 96.0%
associate-/l*98.9%
Simplified98.9%
Taylor expanded in z around 0 81.7%
if -6.7e9 < x < -2.7e-41 or 1.35000000000000004e-7 < x Initial program 94.3%
Simplified97.1%
Taylor expanded in x around inf 95.5%
Taylor expanded in z around inf 75.6%
if -2.7e-41 < x < 1.35000000000000004e-7Initial program 94.7%
Taylor expanded in x around 0 82.2%
Final simplification80.2%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -6800000000.0)
(fabs (/ x y_m))
(if (or (<= x -4.1e-40) (not (<= x 1.6e-7)))
(fabs (* z (/ x y_m)))
(fabs (/ 4.0 y_m)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -6800000000.0) {
tmp = fabs((x / y_m));
} else if ((x <= -4.1e-40) || !(x <= 1.6e-7)) {
tmp = fabs((z * (x / y_m)));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-6800000000.0d0)) then
tmp = abs((x / y_m))
else if ((x <= (-4.1d-40)) .or. (.not. (x <= 1.6d-7))) then
tmp = abs((z * (x / y_m)))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -6800000000.0) {
tmp = Math.abs((x / y_m));
} else if ((x <= -4.1e-40) || !(x <= 1.6e-7)) {
tmp = Math.abs((z * (x / y_m)));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -6800000000.0: tmp = math.fabs((x / y_m)) elif (x <= -4.1e-40) or not (x <= 1.6e-7): tmp = math.fabs((z * (x / y_m))) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -6800000000.0) tmp = abs(Float64(x / y_m)); elseif ((x <= -4.1e-40) || !(x <= 1.6e-7)) tmp = abs(Float64(z * Float64(x / y_m))); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -6800000000.0) tmp = abs((x / y_m)); elseif ((x <= -4.1e-40) || ~((x <= 1.6e-7))) tmp = abs((z * (x / y_m))); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -6800000000.0], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -4.1e-40], N[Not[LessEqual[x, 1.6e-7]], $MachinePrecision]], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6800000000:\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-40} \lor \neg \left(x \leq 1.6 \cdot 10^{-7}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\end{array}
\end{array}
if x < -6.8e9Initial program 77.9%
Taylor expanded in y around 0 97.1%
Taylor expanded in x around inf 96.0%
associate-/l*98.9%
Simplified98.9%
Taylor expanded in z around 0 81.7%
if -6.8e9 < x < -4.09999999999999963e-40 or 1.6e-7 < x Initial program 94.3%
Simplified97.1%
Taylor expanded in x around inf 95.5%
Taylor expanded in z around inf 70.4%
associate-*l/78.4%
*-commutative78.4%
Simplified78.4%
if -4.09999999999999963e-40 < x < 1.6e-7Initial program 94.7%
Taylor expanded in x around 0 82.2%
Final simplification81.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -7e-40) (not (<= x 1.5e-7))) (fabs (/ x (/ y_m (- 1.0 z)))) (fabs (/ (- -4.0 x) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -7e-40) || !(x <= 1.5e-7)) {
tmp = fabs((x / (y_m / (1.0 - z))));
} else {
tmp = fabs(((-4.0 - x) / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-7d-40)) .or. (.not. (x <= 1.5d-7))) then
tmp = abs((x / (y_m / (1.0d0 - z))))
else
tmp = abs((((-4.0d0) - x) / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -7e-40) || !(x <= 1.5e-7)) {
tmp = Math.abs((x / (y_m / (1.0 - z))));
} else {
tmp = Math.abs(((-4.0 - x) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -7e-40) or not (x <= 1.5e-7): tmp = math.fabs((x / (y_m / (1.0 - z)))) else: tmp = math.fabs(((-4.0 - x) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -7e-40) || !(x <= 1.5e-7)) tmp = abs(Float64(x / Float64(y_m / Float64(1.0 - z)))); else tmp = abs(Float64(Float64(-4.0 - x) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -7e-40) || ~((x <= 1.5e-7))) tmp = abs((x / (y_m / (1.0 - z)))); else tmp = abs(((-4.0 - x) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -7e-40], N[Not[LessEqual[x, 1.5e-7]], $MachinePrecision]], N[Abs[N[(x / N[(y$95$m / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-40} \lor \neg \left(x \leq 1.5 \cdot 10^{-7}\right):\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{1 - z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\
\end{array}
\end{array}
if x < -7.0000000000000003e-40 or 1.4999999999999999e-7 < x Initial program 86.3%
Taylor expanded in y around 0 95.8%
Taylor expanded in x around inf 93.0%
associate-/l*97.1%
Simplified97.1%
if -7.0000000000000003e-40 < x < 1.4999999999999999e-7Initial program 94.7%
Simplified92.8%
Taylor expanded in z around 0 82.7%
associate-*r/82.7%
distribute-lft-in82.7%
metadata-eval82.7%
neg-mul-182.7%
sub-neg82.7%
Simplified82.7%
Final simplification90.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= z -1.6e+70) (not (<= z 3.7e+64))) (fabs (* x (/ z y_m))) (fabs (/ (- -4.0 x) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((z <= -1.6e+70) || !(z <= 3.7e+64)) {
tmp = fabs((x * (z / y_m)));
} else {
tmp = fabs(((-4.0 - x) / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.6d+70)) .or. (.not. (z <= 3.7d+64))) then
tmp = abs((x * (z / y_m)))
else
tmp = abs((((-4.0d0) - x) / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((z <= -1.6e+70) || !(z <= 3.7e+64)) {
tmp = Math.abs((x * (z / y_m)));
} else {
tmp = Math.abs(((-4.0 - x) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (z <= -1.6e+70) or not (z <= 3.7e+64): tmp = math.fabs((x * (z / y_m))) else: tmp = math.fabs(((-4.0 - x) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((z <= -1.6e+70) || !(z <= 3.7e+64)) tmp = abs(Float64(x * Float64(z / y_m))); else tmp = abs(Float64(Float64(-4.0 - x) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((z <= -1.6e+70) || ~((z <= 3.7e+64))) tmp = abs((x * (z / y_m))); else tmp = abs(((-4.0 - x) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[z, -1.6e+70], N[Not[LessEqual[z, 3.7e+64]], $MachinePrecision]], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+70} \lor \neg \left(z \leq 3.7 \cdot 10^{+64}\right):\\
\;\;\;\;\left|x \cdot \frac{z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\
\end{array}
\end{array}
if z < -1.6000000000000001e70 or 3.69999999999999983e64 < z Initial program 86.4%
Simplified86.9%
Taylor expanded in x around inf 78.1%
Taylor expanded in z around inf 78.1%
if -1.6000000000000001e70 < z < 3.69999999999999983e64Initial program 92.7%
Simplified98.1%
Taylor expanded in z around 0 95.5%
associate-*r/95.5%
distribute-lft-in95.5%
metadata-eval95.5%
neg-mul-195.5%
sub-neg95.5%
Simplified95.5%
Final simplification88.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (- (+ 4.0 x) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((((4.0 + x) - (x * z)) / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs((((4.0d0 + x) - (x * z)) / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((((4.0 + x) - (x * z)) / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((((4.0 + x) - (x * z)) / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((((4.0 + x) - (x * z)) / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|
\end{array}
Initial program 90.1%
Taylor expanded in y around 0 97.7%
Final simplification97.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -10.5) (not (<= x 4.0))) (fabs (/ x y_m)) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 4.0)) {
tmp = fabs((x / y_m));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-10.5d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y_m))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 4.0)) {
tmp = Math.abs((x / y_m));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -10.5) or not (x <= 4.0): tmp = math.fabs((x / y_m)) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -10.5) || !(x <= 4.0)) tmp = abs(Float64(x / y_m)); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -10.5) || ~((x <= 4.0))) tmp = abs((x / y_m)); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -10.5], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -10.5 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\end{array}
\end{array}
if x < -10.5 or 4 < x Initial program 85.0%
Taylor expanded in y around 0 95.5%
Taylor expanded in x around inf 94.5%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in z around 0 64.3%
if -10.5 < x < 4Initial program 95.2%
Taylor expanded in x around 0 77.0%
Final simplification70.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ 4.0 y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((4.0 / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs((4.0d0 / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((4.0 / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((4.0 / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(4.0 / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((4.0 / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{4}{y_m}\right|
\end{array}
Initial program 90.1%
Taylor expanded in x around 0 41.5%
Final simplification41.5%
herbie shell --seed 2023318
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))